예제 #1
0
파일: EW_Main.cs 프로젝트: 15831944/EM
        public static void makeSurfaceOX()
        {
            bool boolFirstPass = false;

            timeBeg = DateTime.Now;

            Layer.manageLayers("SG-BRKLINE");
            Layer.manageLayers("_YY-BLDG LIM");

            SelectionSet objSSetBLDG_LIM = EW_Utility1.buildSSetBLDG_LIM();             //get _YY-BLDG LIM(s)

            SelectionSet objSSetFLOOR_SLAB = EW_Utility1.buildSSetFLOOR_SLAB();         //get _XX-FLOOR SLAB(s)

            if (objSSetBLDG_LIM.Count == 0)
            {
                //  For i = 0 To objSSetFLOOR_SLAB.Count - 1
                //
                //    Set objFLOORSLAB = objSSetFLOOR_SLAB.Item(i)
                //    strLayer = objFLOORSLAB.Layer
                //
                //    objFLOORSLAB.Closed = False
                //    Call forceClosed(objFLOORSLAB)
                //
                //    varXDataVal = Empty
                //    objFLOORSLAB.getXdata "OX", varXDataType, varXDataVal
                //
                //    If Not IsEmpty(varXDataVal) Then
                //      intBldgNo = varXDataVal(1)
                //    Else
                //      intBldgNo = i
                //    End If
                //
                //    Set objBldgOX2 = getBldgOX2(objFLOORSLAB, intBldgNo, "MAKE", strLayer)               'get BLDG OX limits
                //    objBldgOX2.color = acMagenta
                //    objBldgOX2.Lineweight = acLnWt100
                //
                //    If i = 0 Then
                //      boolFirstPass = True
                //    Else
                //      boolFirstPass = False
                //    End If
                //
                //    Call modAdjacentAreas_Subtract(objBldgOX2, boolFirstPass)                        'get modified areas adjacent to BLDG OX limits
                //
                //  Next i
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("There are Zero BLDG LIMs - there needs to be one BLDG LIM for each Building.  Exiting...");
                return;
                //BLDG LIM exists
            }
            else
            {
                color = Misc.getColorByBlock(6);
                ObjectId[] ids = objSSetBLDG_LIM.GetObjectIds();

                for (int i = 0; i < ids.Length; i++)
                {
                    string strLayer = EW_Build3dPoly.getBldgLayer(ids[i]);
                    //FOR EACH BLDG LIM GET CORRESPONDING FLOOR SLAB
                    //as is will return last bldg area inside BLDG LIM if more than one FLOOR SLAB

                    ObjectId idBldgOX2 = EW_GetBldgOX2.getBldgOX2(ids[i], 1, "MADE", strLayer);                    //get BLDG OX limits

                    if ((idBldgOX2 == ObjectId.Null))
                    {
                        return;
                    }

                    idBldgOX2.changeProp(LineWeight.LineWeight100, color);

                    if (i == 0)
                    {
                        boolFirstPass = true;                         //FOR MULTIPLE BUILDINGS
                    }
                    else
                    {
                        boolFirstPass = false;
                    }
                    EW_ModAdjacentAreas.modAdjacentAreas_Subtract(idBldgOX2, boolFirstPass);                     //build modified areas adjacent to BLDG OX limits
                }
                //  If objSSetBLDG_LIM.Count <> objSSetFLOOR_SLAB.Count Then
                //    MsgBox "Number of Building Limit not equal to Number of FLOOR SLAB"
                //  End If
            }

            SelectionSet ss = EW_Utility1.buildSSet22();              //OX-LIM-OUTER

            ObjectId[] idsOX_LIM_OUTER = ss.GetObjectIds();

            for (int i = 0; i < idsOX_LIM_OUTER.Length; i++)
            {
                ObjectId idBldgOX2 = idsOX_LIM_OUTER[i];

                Point3dCollection varPnts3d = idBldgOX2.getCoordinates3d();

                ss = EW_Utility1.buildSSet21(varPnts3d);                    //get OX-AREAS-2d - inside OX limit for removal
                ObjectId[] idsAreas = ss.GetObjectIds();
                for (int j = 0; j < idsAreas.Length; j++)
                {
                    idsAreas[j].changeProp(LineWeight.LineWeight050, clr.red);
                    idsAreas[j].delete();                     //delete areas inside OX-LIM-OUTER
                }
            }

            ss = EW_Utility1.buildSSet19();             //get OX-AREAS-2d - select all
            ObjectId[] idsOX_AREAS_2d = ss.GetObjectIds();

            for (int i = 0; i < idsOX_AREAS_2d.Length; i++)
            {
                ObjectId idLWPlineT = idsOX_AREAS_2d[i];
                idLWPlineT.changeProp(LineWeight.LineWeight000, clr.wht);

                ResultBuffer rb = idLWPlineT.getXData("OX-Layer");
                if (rb == null)
                {
                    continue;
                }

                string strLayer = rb.AsArray()[1].Value.ToString();

                color = Misc.getColorByBlock(140);
                ObjectId idLWPlineX = idLWPlineT.offset(-0.05);
                if (idLWPlineX == ObjectId.Null)
                {
                    idLWPlineT.changeProp(LineWeight.LineWeight200, color);
                    continue;
                }
                else
                {
                    idLWPlineX.changeProp(LineWeight.LineWeight100, clr.mag);
                    idLWPlineT.delete();

                    if (!offsetSegments("SG", "OX", idLWPlineX, strLayer))
                    {
                        return;
                    }
                }
            }

            viewResults("OX", true);

            if (!pub.boolDebug)
            {
                ss = EW_Utility1.buildSSetOX2d();
                ss.eraseSelectedItems();
            }

            ss = EW_Utility1.buildSSetLinesLayer0();
            ss.eraseSelectedItems();
        }
예제 #2
0
파일: EW_Main.cs 프로젝트: 15831944/EM
        public static bool offsetSegments(string strSurfaceName, string strSurfaceNameX, ObjectId idLWPlineX, string varLayerName = "")
        {
            double dblZOff = 0;

            int intCase1 = 0, intCase2_1 = 0, intCase2_2 = 0, intCase2_3 = 0, intCase2_4 = 0, intCase2_5 = 0, intCase2_6 = 0, intCase2_7 = 0;
            int intCase2_8 = 0, intCase5_1 = 0, intCase5_2 = 0, intCase5_3 = 0, intCase5_4 = 0, intCase5_5 = 0, intCase8_5 = 0, intCase11 = 0;

            TinSurface objSurfaceSG = null;

            if (strSurfaceName == "SG")
            {
                objSurfaceSG = Surf.getTinSurface("SG", out exists);

                if ((objSurfaceSG == null))
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Surface SG missing - exiting routine");
                    return(false);
                }
            }

            ObjectId id3dBrkP = ObjectId.Null, idTextB = ObjectId.Null, idTextE = ObjectId.Null;
            string   strLayerName = varLayerName;
            ObjectId id3dBndry    = EW_Build3dPoly.buildArea3dLimit(idLWPlineX, strSurfaceName, strSurfaceNameX, strLayerName);         //returns 3D poly with surface elevations, endPnt = begPnt

            if (id3dBndry == ObjectId.Null)
            {
                return(false);
            }

            string strHandle = idLWPlineX.getHandle().ToString();
            string strLayer  = idLWPlineX.getLayer();

            if (varLayerName == "")
            {
                dblZOff = EW_Utility1.getDepth(strLayer, strSurfaceNameX);                  //get depth for area
            }
            else
            {
                if (!varLayerName.Contains("_OX-AREA-"))
                {
                    dblZOff = EW_Utility1.getDepth(varLayerName, strSurfaceNameX);
                }
                else
                {
                    dblZOff = double.Parse(varLayerName.Substring(10));
                }
            }

            Point3d pnt3d0 = new Point3d(0, 0, 0);
            Point3d pnt3dX = new Point3d(0, 0, -dblZOff);

            id3dBndry.moveObj(pnt3d0, pnt3dX);

            if (idLWPlineX == ObjectId.Null)
            {
                MessageBox.Show("idLWPlineX is null");
            }

            List <Point3d> varPnts3dBndry0z = idLWPlineX.getCoordinates3dList();

            idLWPlineX.delete();

            List <Point3d> varPnts3dBndry0zForInt = varPnts3dBndry0z;

            varPnts3dBndry0zForInt.RemoveAt(varPnts3dBndry0z.Count - 1);                //remove endPnt ==>> endPnt <> begPnt

            if (strSurfaceName == "CPNT-ON")
            {
                strLayerName = "CPNT-BRKLINE";
            }
            else
            {
                strLayerName = string.Format("{0}-BRKLINE", strSurfaceName);
            }

            ObjectIdCollection ids = null;

            if (pub.boolDebug)
            {
                escape = Select.getSelSetFromUser(out ids);
            }
            else
            {
                ss = EW_Utility1.buildSSetCPNT_ON_SEGMENTS(strLayerName, varPnts3dBndry0z);                  //select triangle segments (3dPolylines) by polygon crossing
            }

            if (ss == null)
            {
                return(false);
            }

            ObjectId[] idsSegments = ss.GetObjectIds();

            TypedValue[] tvs = new TypedValue[3] {
                new TypedValue(1001, "makeBOT"),
                new TypedValue(1000, varLayerName),
                new TypedValue(1000, "BRKLINES")
            };

            for (int j = 0; j < idsSegments.Length; j++)
            {
                strLayer = string.Format("{0}-BRKLINE", strSurfaceNameX);
                ObjectId id    = idsSegments[j];
                ObjectId idBrk = ObjectId.Null;
                Entity   ent   = id.getEnt();

                if (ent.GetType() == typeof(PolylineVertex3d))
                {
                    idBrk = id.getOwnerOfVertex2d3d();
                }
                else if (ent.GetType() == typeof(Polyline3d))
                {
                    idBrk = id;
                }

                //ent = idBrk.getEnt();
                //MessageBox.Show(ent.GetType().ToString());

                ObjectId id3dBrkX = idBrk.copy(strLayer);

                //ent = id3dBrkX.getEnt();
                //MessageBox.Show(ent.GetType().ToString());


                id3dBrkX.moveObj(pnt3d0, pnt3dX);                  //move copy of triangle edge based on vertical offset
                id3dBrkX.changeProp(clr.byl, strLayer);

                //ent = id3dBrkX.getEnt();
                //MessageBox.Show(ent.GetType().ToString());

                List <Point3d> varPnts3d = id3dBrkX.getCoordinates3dList();

                Point3d dblPntBeg = varPnts3d[0];
                Point3d dblPntEnd = varPnts3d[1];                   //end point of triangle edge (3dPoly segment)
                if (pub.boolDebug)
                {
                    idTextB = Txt.addText("B", dblPntBeg, 0, AttachmentPoint.BottomLeft);
                    idTextB.changeProp(color, "DEBUG-0", LineWeight.LineWeight020);
                }

                if (pub.boolDebug)
                {
                    idTextE = Txt.addText("E", dblPntBeg, 0, AttachmentPoint.BottomLeft);
                    idTextE.changeProp(color, "DEBUG-0", LineWeight.LineWeight020);
                }

                //------------------------------------------------------------------test for intersection
                List <Point3d> dblPntInts = Geom.getPntInts(dblPntBeg, dblPntEnd, varPnts3dBndry0zForInt, false, extend.none);
                //------------------------------------------------------------------test for intersection
                bool boolAddEnt   = false;
                bool boolBegOnSeg = false;
                bool boolEndOnSeg = false;
                bool boolBegIn    = false;
                bool boolEndIn    = false;

                int intUBnd = 0;
                switch ((int)(dblPntInts[0].X))
                {
                case -1:

                    intUBnd = -1;

                    boolBegOnSeg = (dblPntBeg.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true;
                    boolEndOnSeg = (dblPntEnd.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true;

                    break;

                case -9:

                    intUBnd      = -9;
                    boolBegOnSeg = true;
                    boolEndOnSeg = true;

                    break;

                default:

                    intUBnd = dblPntInts.Count;

                    boolBegOnSeg = (dblPntBeg.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true;
                    boolEndOnSeg = (dblPntEnd.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true;

                    break;
                }

                if (boolBegOnSeg == false)
                {
                    boolBegIn = dblPntBeg.isInside(varPnts3dBndry0zForInt);
                }
                else
                {
                    boolBegIn = true;
                }

                if (boolEndOnSeg == false)
                {
                    boolEndIn = dblPntEnd.isInside(varPnts3dBndry0zForInt);
                }
                else
                {
                    boolEndIn = true;
                }

                switch (intUBnd)
                {
                case -1:
                    //Case -1

                    if (boolBegOnSeg & !boolEndIn)
                    {
                        boolAddEnt = false;
                    }
                    else if (boolEndOnSeg & !boolBegIn)
                    {
                        boolAddEnt = false;
                    }
                    else
                    {
                        boolAddEnt = true;
                        intCase1   = intCase1 + 1;
                    }

                    break;

                case 1:                         //one intersection - one point inside and one outside

                    //Case 2-1
                    if (boolBegOnSeg == true & boolEndOnSeg == true)
                    {
                        //both ends on the line
                        //test midPoint to see if segment is inside or outside
                        Point3d pnt3dMid = dblPntBeg.getMidPoint3d(dblPntEnd);

                        //boolAddEnt = (pnt3dMid.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? true : false;
                        boolAddEnt = pnt3dMid.isInside(varPnts3dBndry0zForInt);

                        if (boolAddEnt)
                        {
                            intCase5_1 = intCase2_1 + 1;
                        }
                        //Case 2-2
                    }
                    else if (boolBegOnSeg == true & boolEndIn == true)
                    {
                        boolAddEnt = true;
                        intCase2_2 = intCase2_2 + 1;
                        //Case 2-3 ???????????????????????????????????
                    }
                    else if (boolBegOnSeg == true & boolEndIn == false)
                    {
                        if (dblPntInts[0].isOn2dSegment(varPnts3dBndry0zForInt) != -1)
                        {
                            dblPntEnd = dblPntInts[0];
                            double elev = EW_Utility2.getElev(dblPntEnd, id3dBndry);
                            if (elev == 0 && strSurfaceName == "SG")
                            {
                                elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y);
                            }
                            dblPntEnd = dblPntEnd.addElevation(elev);

                            boolAddEnt = true;
                        }
                        else
                        {
                            boolAddEnt = false;
                            intCase2_3 = intCase2_3 + 1;
                        }
                        //Case 2-4
                    }
                    else if (boolEndOnSeg == true & boolBegIn == true)
                    {
                        boolAddEnt = true;
                        intCase2_4 = intCase2_4 + 1;
                        //Case 2-5
                    }
                    else if (boolEndOnSeg == true & boolBegIn == false)
                    {
                        if (dblPntInts[0].isOn2dSegment(varPnts3dBndry0zForInt) != -1)
                        {
                            dblPntBeg = dblPntInts[0];
                            double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry);
                            if (elev == 0 && strSurfaceName == "SG")
                            {
                                elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y);
                            }
                            dblPntBeg  = dblPntBeg.addElevation(elev);
                            boolAddEnt = true;
                        }
                        else
                        {
                            boolAddEnt = false;
                            intCase2_5 = intCase2_5 + 1;
                        }
                        //Case 2-6
                    }
                    else if (boolBegIn == true & boolEndIn == false)
                    {
                        dblPntEnd = dblPntInts[0];
                        double elev = EW_Utility2.getElev(dblPntEnd, id3dBndry);
                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y);
                        }
                        dblPntEnd = dblPntEnd.addElevation(elev);

                        boolAddEnt = true;
                        intCase2_6 = intCase2_6 + 1;
                        //Case 2-7
                    }
                    else if (boolBegIn == false & boolEndIn == true)
                    {
                        dblPntBeg = dblPntInts[0];
                        double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry);
                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y);
                        }
                        dblPntBeg = dblPntBeg.addElevation(elev);

                        boolAddEnt = true;
                        intCase2_7 = intCase2_7 + 1;
                        //Case2-8
                    }
                    else if (boolBegIn == true & boolEndIn == true)
                    {
                        boolAddEnt = true;
                        intCase2_8 = intCase2_8 + 1;
                    }

                    break;

                case 2:

                    //Case 5-1
                    if (boolBegOnSeg == true & boolEndOnSeg == true)
                    {
                        //both ends on the line
                        //test miPoint3d to see if segment is inside or outside
                        Point3d pnt3dMid = dblPntBeg.getMidPoint3d(dblPntEnd);
                        boolAddEnt = pnt3dMid.isInside(varPnts3dBndry0zForInt);

                        if (boolAddEnt)
                        {
                            intCase5_1 = intCase5_1 + 1;
                        }
                        //Case 5-2
                    }
                    else if (boolBegIn == false & boolEndIn == false)
                    {
                        dblPntBeg = dblPntInts[0];
                        double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry);

                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y);
                        }
                        dblPntBeg = dblPntBeg.addElevation(elev);

                        dblPntEnd = dblPntInts[1];
                        elev      = EW_Utility2.getElev(dblPntEnd, id3dBndry);
                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y);
                        }
                        dblPntEnd = dblPntEnd.addElevation(elev);

                        boolAddEnt = true;
                        intCase5_2 = intCase5_2 + 1;
                        //Case 5-3
                    }
                    else if (boolBegOnSeg == true & boolEndIn == false)
                    {
                        dblPntBeg = dblPntInts[0];
                        double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry);

                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y);
                        }
                        dblPntBeg = dblPntBeg.addElevation(elev);

                        dblPntEnd = dblPntInts[1];
                        elev      = EW_Utility2.getElev(dblPntEnd, id3dBndry);
                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y);
                        }
                        dblPntEnd = dblPntEnd.addElevation(elev);

                        boolAddEnt = true;
                        intCase5_3 = intCase5_3 + 1;
                        //Case 5-4
                    }
                    else if (boolEndOnSeg == true & boolBegIn == false)
                    {
                        dblPntBeg = dblPntInts[0];
                        double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry);

                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y);
                        }
                        dblPntBeg = dblPntBeg.addElevation(elev);

                        dblPntEnd = dblPntInts[1];
                        elev      = EW_Utility2.getElev(dblPntEnd, id3dBndry);
                        if (elev == 0 && strSurfaceName == "SG")
                        {
                            elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y);
                        }
                        dblPntEnd  = dblPntEnd.addElevation(elev);
                        boolAddEnt = true;
                        intCase5_4 = intCase5_4 + 1;
                        //Case 5-5
                    }
                    else if (boolBegIn == true & boolEndIn == true)
                    {
                        boolAddEnt = true;
                        intCase5_5 = intCase5_5 + 1;
                    }

                    break;

                case 3:
                    //Case 8
                    List <Point3d> dblPntInts_New = new List <Point3d>();
                    for (int s = dblPntInts.Count; s > 0; s--)
                    {
                        if (System.Math.Round(dblPntBeg.X, 3) == System.Math.Round(dblPntInts[s - 1].X, 3) &&
                            System.Math.Round(dblPntBeg.Y, 3) == System.Math.Round(dblPntInts[s - 1].Y, 3))
                        {
                            dblPntInts.RemoveAt(s - 1);
                        }
                    }

                    for (int s = dblPntInts.Count; s > 0; s--)
                    {
                        if (System.Math.Round(dblPntEnd.X, 3) == System.Math.Round(dblPntInts[s - 1].X, 3) &&
                            System.Math.Round(dblPntEnd.Y, 3) == System.Math.Round(dblPntInts[s - 1].Y, 3))
                        {
                            dblPntInts.RemoveAt(s - 1);
                        }
                    }

                    switch (dblPntInts.Count)
                    {
                    case 2:

                        double dblDist1 = dblPntBeg.getDistance(dblPntInts[0]);
                        double dblDist2 = dblPntBeg.getDistance(dblPntInts[1]);

                        if (dblDist1 > dblDist2)
                        {
                            Point3d pnt3dTmp = dblPntInts[0];
                            dblPntInts[0] = dblPntInts[1];
                            dblPntInts[1] = pnt3dTmp;
                        }

                        Point3d dblPntMid = dblPntBeg + (dblPntInts[0] - dblPntBeg) / 2;

                        if (dblPntMid.isInside(varPnts3dBndry0zForInt))
                        {
                            Point3d        dblPntInt    = dblPntInts[0];
                            List <Point3d> dblPnts3dBrk = new List <Point3d>();
                            dblPnts3dBrk.Add(dblPntBeg);
                            double elev = EW_Utility2.getElev(dblPntInt, id3dBndry);

                            if (elev == 0.0 && strSurfaceName == "SG")
                            {
                                elev = objSurfaceSG.FindElevationAtXY(dblPntInt.X, dblPntInt.Y);
                            }
                            dblPntInt.addElevation(elev);
                            dblPnts3dBrk.Add(dblPntInt);

                            ObjectId id3dBrkXNew = Draw.addPoly3d(dblPnts3dBrk, strSurfaceNameX + "-BRKLINE");
                            id3dBrkXNew.changeProp(LineWeight.ByLayer, Color.FromColorIndex(ColorMethod.ByAci, 0));
                            id3dBrkXNew.setXData(tvs, "makeBOT");

                            intCase5_1 = intCase5_1 + 1;

                            id3dBrkX.delete();
                        }

                        dblPntMid = dblPntInts[1] + (dblPntEnd - dblPntInts[1]) / 2;
                        if (dblPntMid.isInside(varPnts3dBndry0zForInt))
                        {
                            Point3d        dblPntInt    = dblPntInts[1];
                            List <Point3d> dblPnts3dBrk = new List <Point3d>();
                            double         elev         = EW_Utility2.getElev(dblPntInt, id3dBndry);

                            if (elev == 0.0 && strSurfaceName == "SG")
                            {
                                elev = objSurfaceSG.FindElevationAtXY(dblPntInt.X, dblPntInt.Y);
                            }
                            dblPntInt.addElevation(elev);
                            dblPnts3dBrk.Add(dblPntInt);
                            dblPnts3dBrk.Add(dblPntEnd);

                            ObjectId id3dBrkXNew = Draw.addPoly3d(dblPnts3dBrk, strSurfaceNameX + "-BRKLINE");
                            id3dBrkXNew.changeProp(LineWeight.ByLayer, Color.FromColorIndex(ColorMethod.ByAci, 0));
                            id3dBrkXNew.setXData(tvs, "makeBOT");

                            intCase8_5 = intCase8_5 + 1;

                            id3dBrkX.delete();
                        }

                        break;

                    case 3:

                        break;
                    }

                    break;

                case 4:
                    //Case 11

                    intCase11 = intCase11 + 1;

                    break;

                case -9:

                    boolAddEnt = false;

                    break;
                }

                if (boolAddEnt == true)
                {
                    id3dBrkX.delete();
                    id3dBrkP = Draw.addPoly3d(dblPntBeg, dblPntEnd, strLayer);
                    id3dBrkP.setXData(tvs, "makeBOT");

                    if (pub.boolDebug)
                    {
                        id3dBrkX.changeProp(LineWeight.LineWeight200, clr.byl);
                        id3dBrkP = id3dBrkX;
                    }
                }
                else
                {
                    //      obj3dBrkX.Delete
                }

                if (pub.boolDebug)
                {
                    idTextB.delete();
                    idTextE.delete();

                    ss = EW_Utility1.buildSSet7();
                    ss.eraseSelectedItems();
                }
            }

            //Debug.Print "Case -1 " & intCase1
            //Debug.Print "Case 2-1 " & intCase2_1
            //Debug.Print "Case 2-2 " & intCase2_2
            //Debug.Print "Case 2-3 " & intCase2_3
            //Debug.Print "Case 2-4 " & intCase2_4
            //Debug.Print "Case 2-5 " & intCase2_5
            //Debug.Print "Case 2-6 " & intCase2_6
            //Debug.Print "Case 2-7 " & intCase2_7
            //Debug.Print "Case 2-8 " & intCase2_8
            //Debug.Print "Case 5-1 " & intCase5_1
            //Debug.Print "Case 5-2 " & intCase5_2
            //Debug.Print "Case 5-3 " & intCase5_3
            //Debug.Print "Case 5-4 " & intCase5_4
            //Debug.Print "Case 5-5 " & intCase5_5
            //Debug.Print "Case 8-5 " & intCase8_5
            //Debug.Print "Case 8-8 " & intCase8_8
            //Debug.Print "Case 11 " & intCase11
            //Debug.Print "Total=" & intCase1 + intCase2_1 + intCase2_2 + intCase2_3 + intCase2_4 + intCase2_5 + intCase2_6 + _
            //'            intCase2_7 + intCase2_8 + intCase5_1 + intCase5_2 + intCase5_3 + intCase5_4 + intCase5_5 + _
            //'            intCase8_5 + intCase8_8 + intCase11

            return(true);
        }
예제 #3
0
        getBldgOX2(ObjectId idLWPline_LIM, int intBldgNo, string strOption, string strLayer)
        {
            bool       exists;
            TinSurface surf = Surf.getTinSurface("CPNT-ON", out exists);

            TypedValue[] tvs = new TypedValue[3] {
                new TypedValue(1001, "OX"),
                new TypedValue(1000, intBldgNo),
                new TypedValue(1000, "OX0")
            };

            Layer.manageLayers("OX-LIM-OUTER");
            Layer.manageLayers("OX-AREAS-BLDG");
            Layer.manageLayers("OX-AREAS-2d");

            if (!idLWPline_LIM.isRightHand())
            {
                idLWPline_LIM.reversePolyX();
            }


            //BLDGOX0
            Color    color     = Misc.getColorByBlock(7);
            ObjectId idBldgOX0 = ObjectId.Null;

            if (strOption == "MAKE")
            {
                Polyline objBldgOX0 = (Polyline)Misc.getBldgLimitsEW(idLWPline_LIM);                 //returns BldgOX0 2dPolyline
                idBldgOX0 = objBldgOX0.ObjectId;
                //outer limit of building footprint
                idBldgOX0.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

                idBldgOX0.checkIfClosed();

                if (!idBldgOX0.isRightHand())
                {
                    idBldgOX0.reversePolyX();
                }
                idBldgOX0.setXData(tvs, "OX");
            }
            else if (strOption == "MADE")
            {
                idBldgOX0 = idLWPline_LIM.copy("OX-AREAS-BLDG");                 //limit of building footprint already made

                idBldgOX0.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

                idBldgOX0.checkIfClosed();

                if (!idBldgOX0.isRightHand())
                {
                    idBldgOX0.reversePolyX();
                }
                idBldgOX0.setXData(tvs, "OX");
            }
            //BLDGOX1
            color = Misc.getColorByBlock(1);
            ObjectId idBldgOX1 = idBldgOX0.offset(EW_Pub.OX_LIMIT_H);               //BldgOX1 2dPolyline

            idBldgOX1.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

            //BLDGOX2
            color = Misc.getColorByBlock(2);
            ObjectId idBldgOX2 = idBldgOX0.offset(EW_Pub.OX_LIMIT_H + 2);            //BldgOX2 2dPolyline

            idBldgOX2.changeProp(color, "OX-LIM-OUTER", LineWeight.LineWeight020);

            SelectionSet objSSet      = EW_Utility1.buildSSetGradingLim();          //GRADING LIMIT
            ObjectId     idGradingLim = objSSet.GetObjectIds()[0];
            int          intSide      = 0;

            if (idBldgOX1.isOutsideGradingLimit(idGradingLim))
            {
                if (!idGradingLim.isRightHand())
                {
                    intSide = 1;
                }
                else
                {
                    intSide = -1;
                }

                ObjectId idGradingLimOffset = idGradingLim.offset(0.2 * intSide);
                color = Misc.getColorByBlock(4);
                idGradingLimOffset.changeProp(LineWeight.LineWeight020, color);

                idBldgOX1 = EW_ModAdjacentAreas.modAdjacentOX_Intersect(idBldgOX1, idGradingLimOffset);
                //modified OX1 - portion was outside GRADING LIMIT

                color = Misc.getColorByBlock(1);
                idBldgOX1.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

                tvs[2] = new TypedValue(1000, "OX1");
                idBldgOX1.setXData(tvs, "OX");

                idGradingLimOffset = idGradingLim.offset(0.1 * intSide);
                color = Misc.getColorByBlock(5);
                idGradingLimOffset.changeProp(LineWeight.LineWeight020, color);

                idBldgOX2 = EW_ModAdjacentAreas.modAdjacentOX_Intersect(idBldgOX2, idGradingLimOffset);
                //modified OX2 - portion was outside GRADING LIMIT
                color = Misc.getColorByBlock(2);
                idBldgOX2.changeProp(color, "OX-LIM-OUTER", LineWeight.LineWeight020);

                tvs[2] = new TypedValue(1000, "OX2");
                idBldgOX2.setXData(tvs, "OX");
            }
            else if (idBldgOX2.isOutsideGradingLimit(idGradingLim))
            {
                if (!idGradingLim.isRightHand())
                {
                    intSide = 1;
                }
                else
                {
                    intSide = -1;
                }

                ObjectId idGradingLimOffset = idGradingLim.offset(0.1 * intSide);
                color = Misc.getColorByBlock(4);
                idGradingLimOffset.changeProp(LineWeight.LineWeight020, color);

                idBldgOX2 = EW_ModAdjacentAreas.modAdjacentOX_Intersect(idBldgOX2, idGradingLimOffset);
                //modified OX2 - portion was outside GRADING LIMIT
                color = Misc.getColorByBlock(1);
                idBldgOX2.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

                tvs[2] = new TypedValue(1000, "OX1");
                idBldgOX1.setXData(tvs, "OX");

                tvs[2] = new TypedValue(1000, "OX2");
                idBldgOX2.setXData(tvs, "OX");
            }
            else
            {
                tvs[2] = new TypedValue(1000, "OX1");
                idBldgOX1.setXData(tvs, "OX");

                tvs[2] = new TypedValue(1000, "OX2");
                idBldgOX2.setXData(tvs, "OX");
            }

            //BLDGOX3
            ObjectId idBldgOX3 = ObjectId.Null;

            if (strOption == "MAKE")
            {
                ObjectId idBldgOXT = getOX_PadLim(idLWPline_LIM, idBldgOX0);
                //building footprint and outer limit of building footprint
                idBldgOX3 = idBldgOXT.offset(-EW_Pub.FOOTING_LIMIT_IN_H);
                color     = Misc.getColorByBlock(3);
                idBldgOX3.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);
                idBldgOXT.delete();

                tvs[2] = new TypedValue(1000, "OX3");
                idBldgOX3.setXData(tvs, "OX");
            }
            else if (strOption == "MADE")
            {
                idBldgOX3 = idBldgOX0.offset(-EW_Pub.FOOTING_LIMIT_IN_H);
                color     = Misc.getColorByBlock(3);
                idBldgOX3.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

                tvs[2] = new TypedValue(1000, "OX3");
                idBldgOX3.setXData(tvs, "OX");
            }

            //BLDGOX4
            ObjectId idBldgOX4 = idBldgOX3.offset(-2);

            //BldgOX4 2dPolyline
            color = Misc.getColorByBlock(4);
            idBldgOX4.changeProp(color, "OX-AREAS-BLDG", LineWeight.LineWeight020);

            tvs[2] = new TypedValue(1000, "OX4");
            idBldgOX4.setXData(tvs, "OX");
            ObjectId idLine = ObjectId.Null;

            Handle  h2d, h3d;
            double  dblSlope, dblAngBase, dblAngTest;
            Point3d pnt3dCEN = Pub.pnt3dO, pnt3dTAR = Pub.pnt3dO, pnt3dX = Pub.pnt3dO;

            ObjectId idDict = Dict.getNamedDictionary("GRADEDOCK", out exists);

            if (!exists)
            {
                Point3d varPntCen = idLWPline_LIM.getCentroid();
                //  objLWPline_LIM.getXdata "BldgSlab", varXDataType, varXData
                //
                //  Dim objBldgSlab As Polyline
                //  Set objBldgSlab = clsdwg.thisdrawing.HandleToObject(varXData(1))
                //  Dim varPntsLWPline As Variant
                //  varPntsLWPline = objBldgSlab.getCoordinates3d
                //  Dim varPnts3dPoly As Variant
                //  varPnts3dPoly = convert2dCoordsTo3dCoords(varPntsLWPline)
                //
                //
                //  Dim varVector As Vector
                //  varVector = getClosetAdjacentSegment(dPntCen, objBldgSlab)
                //  MsgBox ("Direction to nearest segment is: " & varVector.Dir & _
                //'           vbCr & _
                //'           "Distance to nearest segment is: " & varVector.Dist)
                //
                //  If isInside(varPntCen, varPnts3dPoly) = False Then
                //    MsgBox "Calculated centroid location is outside limits of Building footprint"
                //    Exit Function
                //  End If

                double elevCen = surf.FindElevationAtXY(varPntCen.X, varPntCen.Y);
                //SURFACE = "CPNT-ON"
                double dblAngTar = 0; int intMark = 0;

                Geom.getEastWestBaseLineDir(idLWPline_LIM, ref dblAngTar, ref intMark);

                Point3d dPntTAR = varPntCen.traverse(dblAngTar, 20);
                double  elevTar = surf.FindElevationAtXY(dPntTAR.X, dPntTAR.Y);
                dblSlope = System.Math.Round((elevTar - varPntCen.Z) / 20, 4);

                if (dblSlope == 0)
                {
                    dPntTAR  = varPntCen.traverse(dblAngTar + pi / 2, 20);
                    elevTar  = surf.FindElevationAtXY(dPntTAR.X, dPntTAR.Y);
                    dblSlope = System.Math.Round((elevTar - varPntCen.Z) / 20, 4);


                    if (System.Math.Round(dblSlope, 3) == 0)
                    {
                        dPntTAR = varPntCen.traverse(dblAngTar - pi / 2, 20);                         //back to original orientation
                        elevTar = surf.FindElevationAtXY(dPntTAR.X, dPntTAR.Y);
                    }
                }
                else if (dblSlope < 0)
                {
                    dblAngTar = dblAngTar + pi;
                }

                dblAngBase = varPntCen.getDirection(dPntTAR);

                idLine = Draw.addLine(varPntCen, dPntTAR);

                EW_Dict.updateDictGRADEDOCK(idLWPline_LIM.getHandle(), "0".stringToHandle(), dblSlope, varPntCen, dPntTAR);                 //obj3dPoly.handle not pertinent at earthwork stage
            }
            else
            {
                EW_Dict.retrieveDictGRADEDOCK(out h2d, out h3d, out dblSlope, out pnt3dCEN, out pnt3dTAR);

                dblAngBase = pnt3dCEN.getDirection(pnt3dTAR);
                double dblLenBase = pnt3dCEN.getDistance(pnt3dTAR);

                Point3d varPntPolar = pnt3dCEN.traverse(dblAngBase, dblLenBase);
                idLine = Draw.addLine(pnt3dCEN, varPntPolar);
            }

            List <Point3d> varPntInt = idLine.intersectWith(idBldgOX0, extend.source);

            if (varPntInt.Count > 0)
            {
                for (int i = 0; i < varPntInt.Count; i++)
                {
                    pnt3dX     = varPntInt[i];
                    dblAngTest = pnt3dCEN.getDirection(pnt3dX);


                    if (System.Math.Round(dblAngTest, 4) == System.Math.Round(dblAngBase, 4))
                    {
                        idLine   = Draw.addLine(pnt3dCEN, pnt3dX);
                        pnt3dTAR = new Point3d(pnt3dX.X, pnt3dX.Y, pnt3dCEN.Z + pnt3dCEN.getDistance(pnt3dTAR) * dblSlope);
                    }
                }
            }

            double elev = surf.FindElevationAtXY(pnt3dCEN.X, pnt3dCEN.Y);

            pnt3dCEN = new Point3d(pnt3dCEN.X, pnt3dCEN.Y, elev);

            double dblOffOX = EW_Pub.OUTER_FOOTINGS_V + EW_Utility1.getDepth(strLayer, "OX");

            color = Misc.getColorByLayer();
            //OX1
            ObjectId id3dPoly = EW_Build3dPoly.build3dPoly(idBldgOX1, pnt3dCEN, pnt3dTAR, dblSlope, "OX", "OX-BRKLINE", "OX1", dblOffOX, 20);

            id3dPoly.changeProp(LineWeight.LineWeight050, color);

            varPntInt = idLine.intersectWith(idBldgOX2, extend.source);
            idLine.delete();


            if (varPntInt.Count > 2)
            {
                for (int i = 0; i < varPntInt.Count; i++)
                {
                    pnt3dX     = varPntInt[i];
                    dblAngTest = pnt3dCEN.getDirection(pnt3dX);

                    if (System.Math.Round(dblAngTest, 4) == System.Math.Round(dblAngBase, 4))
                    {
                        idLine = Draw.addLine(pnt3dCEN, pnt3dX);

                        pnt3dTAR = pnt3dTAR.addElevation(pnt3dCEN.Z + pnt3dCEN.getDistance(pnt3dX) * dblSlope);
                        idLine.delete();
                        break;
                    }
                }
            }

            dblOffOX = EW_Pub.OUTER_FOOTINGS_V + EW_Utility1.getDepth(strLayer, "OX");

            //OX3
            id3dPoly = EW_Build3dPoly.build3dPoly(idBldgOX3, pnt3dCEN, pnt3dTAR, dblSlope, "OX", "OX-BRKLINE", "OX3", dblOffOX);
            id3dPoly.changeProp(LineWeight.LineWeight050, color);

            dblOffOX = EW_Pub.COLUMN_FOOTINGS_V + EW_Utility1.getDepth(strLayer, "OX");

            //OX4
            id3dPoly = EW_Build3dPoly.build3dPoly(idBldgOX4, pnt3dCEN, pnt3dTAR, dblSlope, "OX", "OX-BRKLINE", "OX4", dblOffOX);
            id3dPoly.changeProp(LineWeight.LineWeight050, color);

            Point3dCollection pnts3d = idBldgOX0.poly_pnt3dColl();

            objSSet = EW_Utility1.buildSSet17(pnts3d);             //get K BRACE areas

            ObjectId[] ids = objSSet.GetObjectIds();

            color = Misc.getColorByBlock(7);
            //BEGIN K BRACE
            for (int i = 0; i < ids.Length; i++)
            {
                ObjectId idBrace = ids[i];
                idBrace = idBrace.offset(5.0);
                idBrace.changeProp(LineWeight.LineWeight030, color);

                dblOffOX = EW_Pub.K_BRACE_V + EW_Utility1.getDepth(strLayer, "OX");

                id3dPoly = EW_Build3dPoly.build3dPoly(idBrace, pnt3dCEN, pnt3dTAR, dblSlope, "OX", "OX-BRKLINE", "OTHER", dblOffOX);
                id3dPoly.changeProp(color, "OX-BRKLINE");
                //bottom of K-Brace overexcavation

                dblOffOX = EW_Pub.COLUMN_FOOTINGS_V + EW_Utility1.getDepth(strLayer, "OX");
                color    = Misc.getColorByBlock(5);
                idBrace  = idBrace.offset(0.2);
                idBrace.changeProp(color);

                List <Point3d> pnts3dBrace = idBrace.getCoordinates3dList();
                List <Point3d> pnts3dNew   = new List <Point3d>();

                for (int j = 0; j < pnts3dBrace.Count; j++)
                {
                    Point3d pnt3dBEG = pnts3dBrace[i + 0];
                    Point3d pnt3dEND = pnts3dBrace[i + 1];

                    double dblAng = pnt3dBEG.getDirection(pnt3dEND);
                    //angle of each segment

                    double angDiff = System.Math.Round(dblAngBase - dblAng, 2);

                    if (angDiff == 0)
                    {
                        pnt3dX = pnt3dBEG.traverse(dblAng - pi / 2, (EW_Pub.K_BRACE_V - dblOffOX) * 5.0);
                        pnts3dNew.Add(pnt3dX);
                    }
                    else if (angDiff == System.Math.Round(pi / 2, 2) || angDiff == System.Math.Round(3 * pi / 2, 2))
                    {
                        pnt3dX = pnt3dBEG.traverse(dblAng + pi, (EW_Pub.K_BRACE_V - dblOffOX) * 5.0);
                        pnts3dNew.Add(pnt3dX);
                    }
                    else if (angDiff == System.Math.Round(-1 * pi / 2, 2) || angDiff == System.Math.Round(-3 * pi / 2, 2))
                    {
                        pnt3dX = pnt3dBEG.traverse(dblAng - pi, (EW_Pub.K_BRACE_V - dblOffOX) * 5.0);
                        pnts3dNew.Add(pnt3dX);
                    }
                    else if (angDiff == System.Math.Round(1 * pi, 2) || angDiff == System.Math.Round(3 * pi, 2))
                    {
                        pnt3dX = pnt3dBEG.traverse(dblAng + pi / 2, (EW_Pub.K_BRACE_V - dblOffOX) * 5.0);
                        pnts3dNew.Add(pnt3dX);
                    }
                    else if (angDiff == System.Math.Round(-1 * pi, 2) || angDiff == System.Math.Round(-3 * pi, 2))
                    {
                        pnt3dX = pnt3dBEG.traverse(dblAng - pi / 2, (EW_Pub.K_BRACE_V - dblOffOX) * 5.0);
                        pnts3dNew.Add(pnt3dX);
                    }

                    //Call addCircle(dPntPolar, 2, 1)
                }

                pnts3dNew.Add(pnts3dNew[0]);
                ObjectId idPoly = Draw.addPoly(pnts3dNew);
                idPoly.checkIfClosed3d();

                id3dPoly = EW_Build3dPoly.build3dPoly(id3dPoly, pnt3dCEN, pnt3dTAR, dblSlope, "OX", "OX-BRKLINE", "OTHER", dblOffOX);
                id3dPoly.changeProp(color, "OX-BRKLINE");

                idPoly.delete();
            }

            //END K BRACE

            return(idBldgOX2);
        }