예제 #1
0
        updateSpreadsheet(ref double dblVolFill, ref double dblVolCut)
        {
            string strPath     = BaseObjs.docFullName;
            string strJN       = BaseObjs.jobNumber();
            string strFN       = string.Format("{0}EW.xlsx", strJN);
            string strFullPath = strPath + "\\" + strFN;

            SelectionSet objSSet = EW_Utility1.buildSSet22();

            if ((dblVolFill == 0))
            {
                bool     exists;
                ObjectId idSurfaceCUT  = Surf.getSurface("VOL_EXIST_BOT", out exists);
                ObjectId idSurfaceFILL = Surf.getSurface("VOL_BOT_SG", out exists);

                TinVolumeSurface objSurfaceFILL = (TinVolumeSurface)idSurfaceFILL.getEnt();
                TinVolumeSurface objSurfaceCUT  = (TinVolumeSurface)idSurfaceCUT.getEnt();

                dblVolCut  = objSurfaceFILL.GetVolumeProperties().UnadjustedCutVolume / 27;
                dblVolFill = objSurfaceFILL.GetVolumeProperties().UnadjustedFillVolume / 27;
                dblVolCut  = dblVolCut + objSurfaceCUT.GetVolumeProperties().UnadjustedCutVolume / 27;
                dblVolFill = dblVolFill + objSurfaceCUT.GetVolumeProperties().UnadjustedFillVolume / 27;
            }

            if (spreadSheetExists(strFullPath, dblVolFill, dblVolCut))
            {
                Excel_ext excl = new Excel_ext(true);
                excl.OpenFile(strFullPath, "");
                excl.FindExcelWorksheet("SUMMARY");

                Excel._Worksheet objWS = excl.excelWrkSht;

                objWS.Range["SUMMARY!volCUT"].Value  = dblVolCut;
                objWS.Range["SUMMARY!volFILL"].Value = dblVolFill;

                //objWS.Range["SUMMARY!AREA_BLDG"].Value = 0;

                excl.CloseFile(true, strFullPath, false);
                excl.excelAPP.Quit();
            }
            else
            {
                MessageBox.Show("Error copying EW spreadsheet");
            }

            objSSet = EW_Utility1.buildSSet8();
            if (objSSet != null && objSSet.Count > 0)
            {
                ObjectId[] ids = objSSet.GetObjectIds();
                for (int i = 0; i < ids.Length; i++)
                {
                    ids[i].delete();
                }
            }

            setupSpreadSheetMS(dblVolFill, dblVolCut);
        }
예제 #2
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();
        }