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(); }
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; }