Ejemplo n.º 1
0
        public static void makeSurfaceSG()
        {
            //Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Command("_ucs", "w", "");
            BaseObjs.sendCommand("_ucs\rw\r");
            TinSurface objSurfaceCPNT = Surf.getTinSurface("CPNT-ON", out exists);

            SelectionSet objSSet = null;

            if (pub.boolDebug)
            {
                objSSet = EW_Utility1.buildSSet1();                 //SelectOnScreen _XX-*
            }
            else
            {
                objSSet = EW_Utility1.buildSSet0();                 //get _XX-*
            }
            if (objSSet == null || objSSet.Count == 0)
            {
                return;
            }

            ObjectId[] ids = objSSet.GetObjectIds();

            timeBeg = DateTime.Now;

            ObjectId idPolyT = ObjectId.Null;

            for (int i = 0; i < ids.Length; i++)
            {
                Polyline objLWPline = (Polyline)ids[i].getEnt();

                ObjectId idLWPlineT = objLWPline.copy();
                if (idLWPlineT.IsNull)
                {
                    MessageBox.Show("Null Id @ line 131 EW_Main");
                    continue;
                }

                idLWPlineT.changeProp(LineWeight.LineWeight050, clr.yel);

                if (objLWPline.HasBulges)
                {
                    idPolyT = Conv.processBndry(idLWPlineT);                        //boundary with arcs converted to line segments
                    idLWPlineT.delete();
                }
                else
                {
                    Entity ent = idLWPlineT.getEnt();
                    idPolyT = ent.ObjectId;
                }

                //Entity entx = idPolyT.getEnt();
                //MessageBox.Show(entx.GetType().ToString());

                switch (objLWPline.Layer)
                {
                case "_XX-FLOOR SLAB_A":
                case "_XX-FLOOR SLAB_B":
                case "_XX-FLOOR SLAB_C":
                case "_XX-DOCK APRON":
                    color = clr.yel;
                    break;

                default:
                    color = clr.grn;
                    break;
                }

                ObjectId idLWPlineX = ObjectId.Null;
                if (!objLWPline.Layer.Contains("_XX-FLOOR"))
                {
                    idLWPlineX = idPolyT.offset(-0.05);
                    idPolyT.delete();
                }
                else
                {
                    idLWPlineX = idPolyT;
                }

                if (idLWPlineX.IsNull)
                {
                    MessageBox.Show("Null Id @ line 162 EW_Main" + idPolyT.getHandle().ToString());
                    continue;
                }

                idLWPlineX.changeProp(LineWeight.LineWeight060, color);


                if (!offsetSegments("CPNT-ON", "SG", idLWPlineX, objLWPline.Layer))
                {
                    return;
                }
            }

            viewResults("SG", true);
        }
Ejemplo n.º 2
0
        modAdjacentAreas_Subtract(ObjectId idBldgOX2, bool boolFirstPass)
        {
            if (pub.boolDebug)
            {
                BaseObjs.write("Select _XX- Area");
                objSSet = EW_Utility1.buildSSet20();   //select on screen

                boolFirstPass = true;
            }
            else
            {
                if (boolFirstPass)
                {
                    objSSet = EW_Utility1.buildSSet0();                                //get _XX-*
                }
                else
                {
                    objSSet = EW_Utility1.buildSSet19();                                //get OX-AREAS-2d - select all
                }
            }

            ObjectId[] ids = objSSet.GetObjectIds();

            ObjectId idAreaCopy = ObjectId.Null;

            List <ObjectId> idsElemOX2  = new List <ObjectId>();
            List <ObjectId> idsElemArea = new List <ObjectId>();

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

                Polyline objArea = (Polyline)id.getEnt();
                objArea.checkIfClosed();

                string strLayer = objArea.Layer;

                switch (strLayer)
                {
                case "_XX-FLOOR SLAB_A":
                case "_XX-FLOOR SLAB_B":
                case "_XX-FLOOR SLAB_C":
                case "_XX-OFFICE SLAB AND SAND":
                    //, "_XX-BUILDING ADJACENT LANDSCAPING"

                    break;

                default:

                    if (boolFirstPass)
                    {
                        idAreaCopy = Conv.processBndry(objArea.copy());
                        idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");
                    }
                    else
                    {
                        idAreaCopy = id;
                    }

                    if (pub.boolDebug)
                    {
                        idAreaCopy.changeProp(LineWeight.LineWeight050, clr.yel);
                    }

                    List <Point3d> varPntsInt = idBldgOX2.intersectWith(idAreaCopy, extend.none);

                    if (varPntsInt.Count == 0)
                    {
                        TypedValue[] tvs = new TypedValue[2] {
                            new TypedValue(1001, "OX-Layer"),
                            new TypedValue(1000, strLayer)
                        };

                        idAreaCopy.setXData(tvs, "OX-Layer");
                    }
                    else
                    {
                        idsElemOX2.Add(idBldgOX2);

                        ObjectId idRegionOX2 = idBldgOX2.addRegion();
                        idRegionOX2.changeProp(LineWeight.LineWeight050, clr.c180);
                        idAreaCopy.checkIfClosed();
                        idAreaCopy.changeProp(LineWeight.LineWeight200, clr.cyn);

                        ObjectId idRegionArea = idAreaCopy.addRegion();
                        idRegionArea.changeProp(LineWeight.LineWeight050, clr.blu);

                        Region objRegionOX2  = (Region)idBldgOX2.getEnt();
                        Region objRegionArea = (Region)idRegionArea.getEnt();

                        objRegionArea.BooleanOperation(BooleanOperationType.BoolSubtract, objRegionOX2);

                        if (objRegionArea.Area > 0)
                        {
                            DBObjectCollection varExplodeObjs = new DBObjectCollection();
                            objRegionArea.Explode(varExplodeObjs);

                            Entity objEnt = (Entity)varExplodeObjs[0];

                            if (objEnt is Region)
                            {
                                idRegionArea.delete();

                                for (int j = 0; j < varExplodeObjs.Count; j++)
                                {
                                    Region             objRegion = (Region)varExplodeObjs[j];
                                    DBObjectCollection varEnts   = new DBObjectCollection();
                                    objRegion.Explode(varEnts);
                                    objRegion.ObjectId.delete();
                                    idAreaCopy = varEnts.rebuildPoly();
                                    idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");

                                    TypedValue[] tvs = new TypedValue[3] {
                                        new TypedValue(1001, "OX-Layer"),
                                        new TypedValue(1000, strLayer),
                                        new TypedValue(1000, "remaining after subtraction of OX")
                                    };

                                    idAreaCopy.setXData(tvs, "OX-Layer");
                                }
                            }
                            else
                            {
                                idRegionArea.delete();
                                idAreaCopy = varExplodeObjs.rebuildPoly();
                                idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");

                                TypedValue[] tvs = new TypedValue[3] {
                                    new TypedValue(1001, "OX-Layer"),
                                    new TypedValue(1000, strLayer),
                                    new TypedValue(1000, "remaining after subtraction of OX")
                                };

                                idAreaCopy.setXData(tvs, "OX-Layer");
                            }
                        }
                        else
                        {
                        }
                    }
                    break;
                }
            }
            return;
        }