checkAreaLimits(SelectionSet objSSetAreas) { SelectionSet objSSet = EW_Utility1.buildSSetGradingLim(); if (objSSet.Count == 0) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("GRADING LIMIT missing - exiting.........."); return; } ObjectId idGradingLim = objSSet.GetObjectIds()[0]; objSSet = EW_Utility1.buildSSetBLDG_LIM(); if (objSSet.Count == 0) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("BUILDING LIMIT missing - exiting......."); return; } if (checkAreaLimit(objSSetAreas, idGradingLim)) { return; } List <Point3d> varPnts3dBndry0z = getGradingLimitCoords(); limitIsOutside(objSSetAreas, varPnts3dBndry0z); }
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(); }
addExcelWorkbook() { string strPath = BaseObjs.docFullName; string strJN = BaseObjs.jobNumber(); string strFN = string.Format("{0}EW.xlsx", strJN); string strFullPath = string.Format("{0}\\{1}", Path.GetDirectoryName(strPath), strFN); string mess = string.Format("{0} exists. Overwrite existing file? Y/N", strFN); if (FileSystem.FileExists(strFullPath)) { DialogResult varResponse = MessageBox.Show(mess, "File exists!", MessageBoxButtons.YesNo); switch (varResponse) { case DialogResult.Yes: try { FileSystem.DeleteFile(strFullPath); } catch (Exception) { MessageBox.Show("Error deleting existing file - good luck"); return; } FileSystem.CopyFile("R:\\TSet\\Template\\EARTHWORK\\0000EW.xlsx", strFullPath); mess = string.Format("{0} created in {1} folder.", strFN, strPath); MessageBox.Show(mess); break; case DialogResult.No: break; //do nothing } } else { FileSystem.CopyFile("R:\\TSet\\Template\\EARTHWORK\\0000EW.xlsx", strFullPath); mess = string.Format("{0} created in {1} folder.", strFN, strPath); MessageBox.Show(mess); } Excel_ext excl = new Excel_ext(true); excl.OpenFile(strFullPath, ""); excl.FindExcelWorksheet("SUMMARY"); Excel._Worksheet objWS = excl.excelWrkSht; ProjectData varProjectData = Misc.getProjectData(strJN); if (varProjectData.Name.ToString() != string.Empty) { objWS.Range["SUMMARY!SITE_NAME"].Value = varProjectData.Name; objWS.Range["SUMMARY!LOCATION"].Value = varProjectData.Location; objWS.Range["SUMMARY!CLIENT"].Value = varProjectData.Client; objWS.Range["SUMMARY!JOB_NUMBER"].Value = varProjectData.Number; objWS.Range["SUMMARY!COORDINATOR"].Value = varProjectData.Coordinator; objWS.Range["SUMMARY!SOURCE"].Value = BaseObjs.docName; } double dblAreaPad = 0; int intCount = 0; SelectionSet objSSet = EW_Utility1.buildSSetTable(); Table objTable = (Table)objSSet.GetObjectIds()[0].getEnt(); if (EW_Pub.OX_LIMIT_H == 0) { EW_Pub.OX_LIMIT_H = double.Parse(objTable.Cells[20, 1].Value.ToString()); } objSSet = EW_Utility1.buildSSetBLDG_LIM(); foreach (ObjectId idBldgLim in objSSet.GetObjectIds()) { ObjectId idBldgLimOffset = idBldgLim.offset(EW_Pub.OX_LIMIT_H); if ((idBldgLimOffset.IsNull)) { intCount++; } else { dblAreaPad = dblAreaPad + idBldgLimOffset.getArea(); idBldgLimOffset.delete(); } } if (intCount > 0) { MessageBox.Show(string.Format("{0} Building Limit Area(s) failed. Requires manual calculation.", intCount)); } objWS.Range["SUMMARY!AREA_PAD"].Value = (int)dblAreaPad; double dblAreaSite = 0; Polyline objGradingLim = default(Polyline); objSSet = EW_Utility1.buildSSetGradingLim(); objGradingLim = (Polyline)objSSet.GetObjectIds()[0].getEnt(); dblAreaSite = objGradingLim.Area; objWS.Range["SUMMARY!AREA_SITE"].Value = (int)dblAreaSite; excl.CloseFile(true, strFullPath, false); }