コード例 #1
0
ファイル: ABL.cs プロジェクト: 15831944/EM
        addBreaklines2Surface(ObjectId[] ids = null, string nameSurface = null)
        {
            SelectionSet ss = null;

            if (ids == null)
            {
                TypedValue[] tvs = new TypedValue[1];
                tvs[0] = new TypedValue((int)DxfCode.Start, "POLYLINE");

                ss = Select.buildSSetBase(tvs, false);

                if (ss.Count > 0)
                {
                    ids = ss.GetObjectIds();
                }

                ObjectId idTinSurf = ObjectId.Null;
                bool     exists;
                if (nameSurface == null)
                {
                    string nameDwg = BaseObjs.docName;
                    if (nameDwg.Contains("CGP"))
                    {
                        idTinSurf   = Surf.getSurface("CPNT-ON", out exists);
                        nameSurface = "CPNT-ON";
                    }
                    else if (nameDwg.Contains("GCAL"))
                    {
                        idTinSurf   = Surf.getSurface("CPNT-ON", out exists);
                        nameSurface = "CPNT-ON";
                    }
                    else if (nameDwg.Contains("MASS"))
                    {
                        idTinSurf   = Surf.getSurface("CPNT-ON", out exists);
                        nameSurface = "CPNT-ON";
                    }
                    else if (nameDwg.Contains("CONT"))
                    {
                        idTinSurf   = Surf.getSurface("EXIST", out exists);
                        nameSurface = "EXIST";
                    }
                }
                else
                {
                    idTinSurf = Surf.getSurface(nameSurface, out exists);
                }

                ObjectIdCollection idColl = new ObjectIdCollection();
                foreach (ObjectId id in ids)
                {
                    idColl.Add(id);
                }

                TinSurface tinSurf = (TinSurface)idTinSurf.getEnt();
                tinSurf.BreaklinesDefinition.AddStandardBreaklines(idColl, 1.0, 0, 0, 0);
            }
        }
コード例 #2
0
ファイル: EW_Spreadsheet.cs プロジェクト: 15831944/EM
        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);
        }
コード例 #3
0
ファイル: cmdSG.cs プロジェクト: 15831944/EM
        private static Point3d getSlopeIntercept(string surfaceTAR, Point3d pnt3dX, double slope, bool exists, Vector3d v3d)
        {
            Point3d    pnt3d0 = Pub.pnt3dO;
            ObjectId   idSurf = Surf.getSurface(surfaceTAR, out exists);
            TinSurface surf   = idSurf.getEnt() as TinSurface;

            try
            {
                pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
            }
            catch (System.Exception)
            {
                v3d    = new Vector3d(v3d.X, v3d.Y, -slope);
                pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
            }
            return(pnt3d0);
        }
コード例 #4
0
        getAverageElev(ObjectId idPoly, bool boolShowPoints, string strSurface)
        {
            double dblZ_Total = 0;
            double dblZ_AVG   = 0;

            bool       exists         = false;
            ObjectId   idSurfaceEXIST = Surf.getSurface(strSurface, out exists);
            TinSurface surfaceEXIST   = (TinSurface)idSurfaceEXIST.getEnt();

            if (surfaceEXIST.GetGeneralProperties().MinimumElevation <= 0.0)
            {
                Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog(string.Format("Check Surface EXIST elevations: Minimum elevation: {0}", surfaceEXIST.GetGeneralProperties().MinimumElevation));
                return(0);
            }

            using (BaseObjs._acadDoc.LockDocument())
            {
                if (!idPoly.isRightHand())
                {
                    idPoly.reversePolyX();
                }
                idPoly.checkIfClosed();
            }

            Point3dCollection pntsGrid     = Misc.getBldgLimitsAVG(idPoly, 20);
            Point3dCollection pntsGridElev = new Point3dCollection();

            foreach (Point3d pnt3d in pntsGrid)
            {
                try
                {
                    double dblZ = surfaceEXIST.FindElevationAtXY(pnt3d.X, pnt3d.Y);
                    dblZ_Total = dblZ_Total + dblZ;

                    if (boolShowPoints)
                    {
                        pntsGridElev.Add(new Point3d(pnt3d.X, pnt3d.Y, dblZ));
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " Grading_Floor.cs: line: 115");
                }
            }

            if (boolShowPoints)
            {
                uint pntNum;

                using (BaseObjs._acadDoc.LockDocument())
                {
                    foreach (Point3d pnt3d in pntsGridElev)
                    {
                        pnt3d.setPoint(out pntNum, "CPNT-ON");
                    }
                }
            }

            dblZ_AVG = dblZ_Total / (pntsGrid.Count);

            return(dblZ_AVG);
        }
コード例 #5
0
ファイル: winBalanceSite.xaml.cs プロジェクト: 15831944/EM
        balanceSite()
        {
            double dblSiteAdjust = 0;

            Point3d pnt3dMove0 = Point3d.Origin;

            TinSurface objSurfaceSG = Surf.getTinSurface("SG", out exists);
            TinSurface objSurfaceOX = Surf.getTinSurface("OX", out exists);

            dblSiteAdjust = double.Parse(this.tboxAdjSurface.Text);

            varDataCurrent.SITE_ADJUST = dblSiteAdjust;
            updateDictionary(varDataCurrent);

            Point3d pnt3dMoveX = new Point3d(0, 0, dblSiteAdjust);

            Matrix3d mtx3d = Matrix3d.Displacement(pnt3dMoveX - pnt3dMove0);

            objSurfaceSG.TransformBy(mtx3d);
            objSurfaceOX.TransformBy(mtx3d);

            ewtbe.reTest();
            ewmsv.updateVolSurface("EXIST", "BOT");
            ewmsv.updateVolSurface("BOT", "SG");

            // ERROR: Not supported in C#: OnErrorStatement


            ObjectId idSurfaceCUT = Surf.getSurface("VOL_EXIST_BOT", out exists);

            if (idSurfaceCUT.IsNull)
            {
                ewmsv.updateVolSurface("EXIST", "BOT");
            }

            ObjectId idSurfaceFILL = Surf.getSurface("VOL_BOT_SG", out exists);

            if (idSurfaceFILL.IsNull)
            {
                ewmsv.updateVolSurface("BOT", "SG");
            }

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

            dblVOL_EXIST_BOT_CUT  = objSurfaceCUT.GetVolumeProperties().UnadjustedCutVolume / 27;
            dblVOL_EXIST_BOT_FILL = objSurfaceCUT.GetVolumeProperties().UnadjustedFillVolume / 27;

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

            dblVOL_BOT_SG_CUT  = objSurfaceFILL.GetVolumeProperties().UnadjustedCutVolume / 27;
            dblVOL_BOT_SG_FILL = objSurfaceFILL.GetVolumeProperties().UnadjustedFillVolume / 27;

            dblVOL_CUT_TOT = dblVOL_EXIST_BOT_CUT + dblVOL_BOT_SG_CUT;
            //Gross Cut put in spreadsheet
            dblVOL_FILL_TOT = dblVOL_EXIST_BOT_FILL + dblVOL_BOT_SG_FILL;
            //Gross Fill put in spreadsheet

            dblVOL_CUT_SHRINK = (dblVOL_CUT_TOT * dblSHRINKAGE_FACTOR * -1);

            dblVOL_CUT_NET  = dblVOL_CUT_ADJ_NET + dblVOL_CUT_TOT + dblVOL_CUT_SHRINK;
            dblVOL_FILL_NET = dblVOL_FILL_ADJ_NET + dblVOL_FILL_TOT;

            dblSG_MEAN_ELEV = objSurfaceSG.GetGeneralProperties().MeanElevation;

            dblVOL_NET = (dblVOL_CUT_NET - dblVOL_FILL_NET);

            dblSITE_ADJUST = dblVOL_NET * 27 / dblAREA_SITE;

            this.AdjustSurfaceSG.Text = string.Format("{0:#0.00", dblSG_MEAN_ELEV - dblSG_MEAN_ELEV0);

            varDataCurrent.ITERATION        = "C";
            varDataCurrent.DATE             = strDATE;
            varDataCurrent.USER             = strUSER;
            varDataCurrent.AREA_SITE        = dblAREA_SITE;
            varDataCurrent.SG_MEAN_ELEV     = dblSG_MEAN_ELEV;
            varDataCurrent.VOL_CUT_TOT      = dblVOL_CUT_TOT;
            varDataCurrent.VOL_CUT_ADJ_NET  = dblVOL_CUT_ADJ_NET;
            varDataCurrent.VOL_CUT_SHRINK   = dblVOL_CUT_SHRINK;
            varDataCurrent.VOL_CUT_NET      = dblVOL_CUT_NET;
            varDataCurrent.VOL_FILL_TOT     = dblVOL_FILL_TOT;
            varDataCurrent.VOL_FILL_ADJ_NET = dblVOL_FILL_ADJ_NET;
            varDataCurrent.VOL_FILL_NET     = dblVOL_FILL_NET;
            varDataCurrent.VOL_NET          = dblVOL_NET;
            varDataCurrent.SITE_ADJUST      = dblSITE_ADJUST;

            ewData = getDictData();
            ewData.Add(varDataCurrent);
            this.DG1.DataContext = ewData;

            return;
        }
コード例 #6
0
ファイル: EW_Spreadsheet.cs プロジェクト: 15831944/EM
        setupSpreadSheetMS(double dblVolCut = 0, double dblVolFill = 0)
        {
            bool boolIsOpen = false;

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

            string strPath     = BaseObjs.docFullName;
            string strJN       = BaseObjs.jobNumber();
            string strFN       = string.Format("{0}EW.xlsx", strJN);
            string strFullPath = strPath + "\\" + strFN;

            SelectionSet objSSet = EW_Utility1.buildSSet8();

            objSSet.eraseSelectedItems();

            objSSet = EW_Utility1.buildSSetTable();
            Table objTable = (Table)objSSet.GetObjectIds()[0].getEnt();

            Point3d varPntIns = objTable.Position;

            double dblWidth  = objTable.Width;
            double dblHeight = objTable.Height;

            double dblPntX = varPntIns.X + dblWidth + 10;
            double dblPntY = varPntIns.Y - 8;

            string strPntX = System.Math.Round(dblPntX, 2).ToString();
            string strPntY = System.Math.Round(dblPntY, 2).ToString();

            string strPntIns = string.Format("{0},{1}", strPntX, strPntY);

            Excel._Application objExcelApp = (Excel._Application)Microsoft.VisualBasic.Interaction.GetObject(null, "Excel.Application");
            Excel.Workbook     objWB       = null;
            Excel_ext          excl        = null;

            if (objExcelApp == null)
            {
                excl        = new Excel_ext();
                objExcelApp = excl.excelAPP;
            }
            else
            {
                for (int i = 1; i < objExcelApp.Workbooks.Count; i++)
                {
                    objWB = objExcelApp.Workbooks[i];
                    if (objWB.Name == strFN)
                    {
                        boolIsOpen = true;
                        break;
                    }
                }
            }

            objExcelApp.Visible = true;


            if (!boolIsOpen)
            {
                if (FileSystem.FileExists(strFullPath))
                {
                    objWB = objExcelApp.Workbooks.Open(strFullPath);
                }
                else
                {
                    FileSystem.CopyFile("R:\\TSet\\Template\\EARTHWORK\\0000EW.xlsx", strFullPath);
                    objWB = objExcelApp.Workbooks.Open(strFullPath);
                    string mess = string.Format("{0} not found.  A copy of the template has been created in {1}\nExiting...", strFN, strPath);
                    MessageBox.Show(mess);
                }
            }

            Excel.Worksheet objWS = objWB.Worksheets["SUMMARY"];
            objWS.Activate();
            objWS.Visible = Microsoft.Office.Interop.Excel.XlSheetVisibility.xlSheetVisible;

            objWS.Range["SUMMARY!volCUT"].Value     = dblVolCut;
            objWS.Range["SUMMARY!volFILL"].Value    = dblVolFill;
            objWS.Range["SUMMARY!JOB_NUMBER"].Value = BaseObjs.docName.Substring(1, 4);
            objWS.Range["EW_SUMMARY"].Copy();
            objExcelApp.Visible = true;

            BaseObjs._editor.Regen();

            BaseObjs._acadDoc.SendStringToExecute(string.Format("_pasteclip {0}\r", strPntIns), true, false, false);

            objSSet = EW_Utility1.buildSSet8();

            Autodesk.AutoCAD.DatabaseServices.Ole2Frame objAcadOle = null;
            if (objSSet == null || objSSet.Count == 0)
            {
                SelectionSet ss = BaseObjs._editor.SelectAll().Value;
                int          k  = ss.Count;
                ObjectId     id = ss.GetObjectIds()[k - 1];
                using (var tr = BaseObjs.startTransactionDb())
                {
                    objAcadOle            = (Ole2Frame)tr.GetObject(id, OpenMode.ForWrite);
                    objAcadOle.LockAspect = false;
                    objAcadOle.WcsHeight  = dblHeight;
                    objAcadOle.WcsWidth   = dblHeight / 2;
                    objAcadOle.Layer      = "ZZ_ZZ-SPREADSHEET";
                    tr.Commit();
                }
            }
            else
            {
                using (var tr = BaseObjs.startTransactionDb()){
                    objAcadOle            = (Ole2Frame)tr.GetObject(objSSet.GetObjectIds()[0], OpenMode.ForWrite);
                    objAcadOle.LockAspect = false;
                    objAcadOle.WcsHeight  = dblHeight;
                    objAcadOle.WcsWidth   = dblHeight / 2;
                    objAcadOle.Layer      = "ZZ_ZZ-SPREADSHEET";
                }
            }

            BaseObjs.acadActivate();
        }
コード例 #7
0
ファイル: SG_cmdSG.cs プロジェクト: 15831944/EM
        setupSlope(int intSide,
                   Point3d pnt3dA,
                   Point3d pnt3dB,
                   Point3d pnt3dC,
                   double slope,
                   ref Boolean doFirst,
                   string surfTar,
                   string surfDES,
                   ref List <Point3d> pnts3dB1,
                   ref List <Point3d> pnts3dB2,
                   ref List <Point3d> pnts3dD,
                   ref List <Point3d> pnts3dR)
        {
            double dblB1Width = Convert.ToDouble(fmain.strB1Width.ToString());
            double dblB2Width = Convert.ToDouble(fmain.strB2Width.ToString());
            double dblB1Slope = Convert.ToDouble(fmain.strB1Slope.ToString());
            double dblB2Slope = Convert.ToDouble(fmain.strB2Slope.ToString());

            Boolean boolB1 = fmain.boolB1;
            Boolean boolB2 = fmain.boolB1;

            Boolean success = false;

            double dblAngAB  = pnt3dA.getDirection(pnt3dB);
            double dblAngBC  = pnt3dB.getDirection(pnt3dC);
            double dblAngABC = Geom.getAngle3Points(pnt3dA, pnt3dB, pnt3dC);

            Point3d pnt3dX;
            bool    exists = false;

            List <Point3d> pnts3dT = new List <Point3d>();
            ObjectId       idSurf  = Surf.getSurface(surfTar, out exists);
            TinSurface     surf    = idSurf.getEnt() as TinSurface;

            double   dblAng = dblAngAB + PI / 2 * intSide;
            Vector3d v3d    = new Vector3d(System.Math.Cos(dblAng), System.Math.Sin(dblAng), -slope);

            pnts3dT = getIntermediates(pnt3dA, pnt3dB, dblAngAB);

            for (int i = 0; i < pnts3dT.Count; i++)
            {
                pnts3dR.Add(pnts3dT.ElementAt(i));
            }

            if (doFirst == true)
            {
                pnt3dX = pnts3dT.ElementAt(0);
                if (boolB1 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB1Width, dblB1Slope);
                    pnts3dB1.Add(pnt3dX);
                }
                if (boolB2 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB2Width, dblB2Slope);
                }

                Point3d pnt3d00 = surf.GetIntersectionPoint(pnt3dX, v3d);

                pnts3dD.Add(pnt3d00);

                if (boolB2 == true)
                {
                    pnt3dX = pnt3d00.traverse(dblAng + PI, dblB2Width, -dblB2Slope);
                    pnts3dB2.Add(pnt3dX);
                }
            }

            for (int i = 1; i < pnts3dT.Count; i++)
            {
                pnt3dX = pnts3dT.ElementAt(i);
                if (boolB1 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB1Width, dblB1Slope);
                    pnts3dB1.Add(pnt3dX);
                }
                if (boolB2 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB2Width, dblB2Slope);
                }

                Point3d pnt3d01 = surf.GetIntersectionPoint(pnt3dX, v3d);
                pnts3dD.Add(pnt3d01);

                if (boolB2 == true)
                {
                    pnt3dX = pnt3d01.traverse(dblAng + PI, dblB2Width, -dblB2Slope);
                    pnts3dB2.Add(pnt3dX);
                }
            }

            //do mid delta
            double dblAngV = intSide * dblAngBC + (2 * PI - dblAngABC) / 2;

            pnt3dX = pnts3dT.ElementAt(pnts3dT.Count - 1);
            if (boolB1 == true)
            {
                pnt3dX = pnt3dX.traverse(dblAngV, dblB1Width, dblB1Slope);
                pnts3dB1.Add(pnt3dX);
            }
            if (boolB2 == true)
            {
                pnt3dX = pnt3dX.traverse(dblAngV, dblB2Width, dblB2Slope);
            }

            Point3d pnt3d02 = surf.GetIntersectionPoint(pnt3dX, v3d);

            pnts3dD.Add(pnt3d02);

            if (boolB2 == true)
            {
                pnt3dX = pnt3d02.traverse(dblAngV + PI, dblB2Width, -dblB2Slope);
                pnts3dB2.Add(pnt3dX);
            }

            return(success);
        } // end setupSlope
コード例 #8
0
ファイル: SG_cmdSG.cs プロジェクト: 15831944/EM
        setupSlope(int intSide,
                   Point3d pnt3dA,
                   Point3d pnt3dB,
                   double slope,
                   ref Boolean boolDoFirst,
                   string strSurfaceTAR,
                   string strSurfaceDES,
                   ref List <Point3d> pnts3dB1,
                   ref List <Point3d> pnts3dB2,
                   ref List <Point3d> pnts3dD,
                   ref List <Point3d> pnts3dR)
        {
            double dblB1Width = Convert.ToDouble(fmain.strB1Width.ToString());
            double dblB2Width = Convert.ToDouble(fmain.strB2Width.ToString());
            double dblB1Slope = Convert.ToDouble(fmain.strB1Slope.ToString());
            double dblB2Slope = Convert.ToDouble(fmain.strB2Slope.ToString());

            Boolean boolB1 = fmain.boolB1;
            Boolean boolB2 = fmain.boolB1;

            Boolean boolSuccess = false;

            double dblAngAB = pnt3dA.getDirection(pnt3dB);
            //double[] dblPnts = new double[] { };

            Point3d pnt3dX;
            bool    exists = false;

            List <Point3d> pnts3dT = new List <Point3d>();

            double dblAng = dblAngAB + PI / 2 * intSide;

            pnts3dT = getIntermediates(pnt3dA, pnt3dB, dblAngAB);
            for (int i = 0; i < pnts3dT.Count; i++)
            {
                pnts3dR.Add(pnts3dT.ElementAt(i));
            }

            for (int i = 0; i < pnts3dT.Count; i++)
            {
                pnt3dX = pnts3dT.ElementAt(i);
                if (boolB1 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB1Width, dblB1Slope);
                    pnts3dB1.Add(pnt3dX);
                }
                if (boolB2 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, dblB2Width, dblB2Slope);
                }

                ObjectId   idSurf = Surf.getSurface(strSurfaceTAR, out exists);
                TinSurface surf   = idSurf.getEnt() as TinSurface;

                Vector3d v3d    = new Vector3d(System.Math.Cos(dblAng), System.Math.Sin(dblAng), -slope);
                Point3d  pnt3d0 = Pub.pnt3dO;
                try
                {
                    pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
                }
                catch (System.Exception)
                {
                    v3d    = new Vector3d(v3d.X, v3d.Y, slope);
                    pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
                }

                pnts3dD.Add(pnt3d0);

                if (boolB2 == true)
                {
                    pnt3dX = pnt3d0.traverse(dblAng + PI, dblB2Width, -dblB2Slope);
                    pnts3dB2.Add(pnt3dX);
                }
            }

            return(boolSuccess);
        } // end setupSlope
コード例 #9
0
        cmdSections(ObjectId idAlign, double dblOffR, double dblOffL)
        {
            ObjectId idSectionStyleEXIST   = default(ObjectId);
            ObjectId idSectionStyleEXIST90 = default(ObjectId);
            ObjectId idSectionStyleCPNT    = default(ObjectId);
            ObjectId idSectionStyleSG      = default(ObjectId);
            ObjectId idSectionStyleOX      = default(ObjectId);
            ObjectId idSectionStyleOXg     = default(ObjectId);
            ObjectId idSectionStyleBOT     = default(ObjectId);
            ObjectId idSectionStyleMID     = default(ObjectId);

            ObjectIdCollection idsSurface = new ObjectIdCollection();

            bool     exists         = false;
            ObjectId idSurfaceEXIST = Surf.getSurface("EXIST", out exists);

            if (!exists)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Surface EXIST is missing - exiting!");
                return;
            }
            else
            {
                idsSurface.Add(idSurfaceEXIST);
                idSectionStyleEXIST = Sect_Style.getSectionStyleId("EXIST");
            }

            ObjectId idSurfaceEXIST90 = Surf.getSurface("EXIST90", out exists);

            if (!exists)
            {
                //  MsgBox "Surface EXIST is missing - exiting!"
                //  Exit Sub
            }
            else
            {
                idsSurface.Add(idSurfaceEXIST90);
                idSectionStyleEXIST90 = Sect_Style.getSectionStyleId("EXIST90");
            }

            ObjectId idSurfaceCPNT = Surf.getSurface("CPNT-ON", out exists);

            if (!exists)
            {
                //  MsgBox "Surface CPNT-ON is missing - exiting!"
                //  Exit Sub
            }
            else
            {
                idsSurface.Add(idSurfaceCPNT);
                idSectionStyleCPNT = Sect_Style.getSectionStyleId("CPNT");
            }

            ObjectId idSurfaceSG = Surf.getSurface("SG", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceSG);
                idSectionStyleSG = Sect_Style.getSectionStyleId("SG");
            }

            ObjectId idSurfaceOX = Surf.getSurface("OX", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceOX);
                idSectionStyleOX = Sect_Style.getSectionStyleId("OX");
            }

            ObjectId idSurfaceOXg = Surf.getSurface("OXg", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceOXg);
                idSectionStyleOXg = Sect_Style.getSectionStyleId("OXg");
            }

            ObjectId idSurfaceBOT = Surf.getSurface("BOT", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceBOT);
                idSectionStyleBOT = Sect_Style.getSectionStyleId("BOT");
            }

            if (idSectionStyleBOT == ObjectId.Null)
            {
                EW_Utility1.copyEWstyles();
            }

            ObjectId idSurfaceMID = Surf.getSurface("MIDGRADE", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceMID);
                idSectionStyleMID = Sect_Style.getSectionStyleId("EXIST90");
            }

            idAlign.removeSampleLineGroups();
            ObjectId idSLG = idAlign.addSampleLineGroupAndSampleLines("EW");

            idSLG.removeSampledSurfaces();

            idSLG.addSurfaceToSample(idsSurface);

            idAlign.addSections(idSLG, dblOffL, dblOffR);

            ObjectId idGroupPlotStyle             = ObjectId.Null;
            GroupPlotStyleCollection grpPltStyles = BaseObjs._civDoc.Styles.GroupPlotStyles;

            if (!grpPltStyles.Contains("EW"))
            {
                EW_Utility1.copyEWstyles();
                idGroupPlotStyle = BaseObjs._civDoc.Styles.GroupPlotStyles["EW"];
            }

            SampleLineStyleCollection sampleLineStyles = BaseObjs._civDoc.Styles.SampleLineStyles;
            ObjectId idSampleLineStyle = sampleLineStyles["Standard"];

            SectionLabelSetStyleCollection sectionLabelSetStyles = BaseObjs._civDoc.Styles.LabelSetStyles.SectionLabelSetStyles;

            double dblWidth  = 0;
            double dblHeight = 0;

            Autodesk.AutoCAD.DatabaseServices.Table objTable = default(Autodesk.AutoCAD.DatabaseServices.Table);

            SelectionSet objSSet = default(SelectionSet);

            objSSet  = EW_Utility1.buildSSetTable();
            objTable = (Autodesk.AutoCAD.DatabaseServices.Table)objSSet.GetObjectIds()[0].getEnt();

            Point3d varPntIns = objTable.Position;

            dblWidth  = objTable.Width;
            dblHeight = objTable.Height;

            Point3d dblPntBase = new Point3d(varPntIns.X + dblWidth + 600, varPntIns.Y - dblHeight, 0);

            SectionViewStyle objSectionViewStyle = Sect_Style.getSectionViewStyle("EW");

            if (objSectionViewStyle == null)
            {
                EW_Utility1.copyEWstyles();
                objSectionViewStyle = objSectionViewStyle = Sect_Style.getSectionViewStyle("EW");
            }

            SectionViewBandSetStyle objSectionViewBandSetStyle = Sect_Style.getSectionViewBandSetStyle("Standard");

            double dblOffX = 0;
            double dblOffY = 0;

            bool boolFirstPass = false;

            boolFirstPass = true;

            dblOffX = 0;
            dblOffY = 0;

            Point3d dblPntIns = Pub.pnt3dO;

            int j = 0;
            ObjectIdCollection idsSampleLine = idSLG.getSampleLineIDs();

            using (var tr = BaseObjs.startTransactionDb()) {
                for (int i = 0; i < idsSampleLine.Count; i += 5)
                {
                    SampleLine sl = (SampleLine)tr.GetObject(idsSampleLine[i], OpenMode.ForRead);

                    dblPntIns = new Point3d(dblPntBase.X + i / 5 * dblOffX, dblPntBase.Y, 0);
                    int k = -1;

                    while (j < idsSampleLine.Count)
                    {
                        k = k + 1;

                        ObjectId    idSectionView  = SectionView.Create(string.Format("SV-{0}", j), sl.ObjectId, dblPntIns);
                        SectionView objSectionView = (SectionView)tr.GetObject(idSectionView, OpenMode.ForWrite);
                        if (boolFirstPass)
                        {
                            dblOffX       = System.Math.Abs(objSectionView.OffsetLeft) + objSectionView.OffsetRight + 30;
                            boolFirstPass = false;
                        }

                        Extents3d ext3d = (Extents3d)objSectionView.Bounds;

                        dblOffY = ext3d.MaxPoint.Y - ext3d.MinPoint.Y + 30;

                        dblPntIns      = new Point3d(dblPntIns.X, dblPntIns.Y + dblOffY, 0);//increment Y after placing first section in column
                        objSectionView = null;

                        j = j + 1;

                        if (k == 4)
                        {
                            break;
                        }
                    }
                }

                tr.Commit();
            }

            BaseObjs.acadActivate();

            return;
        }
コード例 #10
0
        internal void setupSlope()
        {
            double dblAngAB = _pnt3dA.getDirection(_pnt3dB);

            Point3d pnt3dX;
            bool    exists = false;

            List <Point3d> pnts3dT = new List <Point3d>();

            double dblAng = dblAngAB + pi / 2 * _intSide;

            pnts3dT = getIntermediates(_pnt3dA, _pnt3dB, dblAngAB, _interval);
            for (int i = 0; i < pnts3dT.Count; i++)
            {
                _pnts3dR.Add(pnts3dT[i]);
            }

            for (int i = 0; i < pnts3dT.Count; i++)
            {
                pnt3dX = pnts3dT[i];
                if (_doB1 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, _B1Width, _B1Slope);
                    _pnts3dB1.Add(pnt3dX);
                }
                if (_doB2 == true)
                {
                    pnt3dX = pnt3dX.traverse(dblAng, _B2Width, _B2Slope);
                }

                Vector3d v3d    = new Vector3d(System.Math.Cos(dblAng), System.Math.Sin(dblAng), _slope);
                Point3d  pnt3d0 = Pub.pnt3dO;

                if (_strSurfaceTAR != "")
                {
                    ObjectId   idSurf = Surf.getSurface(_strSurfaceTAR, out exists);
                    TinSurface surf   = idSurf.getEnt() as TinSurface;
                    try
                    {
                        pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
                    }
                    catch (System.Exception)
                    {
                        v3d    = new Vector3d(v3d.X, v3d.Y, -_slope);
                        pnt3d0 = surf.GetIntersectionPoint(pnt3dX, v3d);
                    }
                }
                else
                {
                    try
                    {
                        double elevDiff = _elev - pnt3dX.Z;
                        if (elevDiff > 0)
                        {
                            pnt3d0 = pnt3dX.traverse(dblAng, elevDiff / _slope, _slope);
                        }
                        else
                        {
                            pnt3d0 = pnt3dX.traverse(dblAng, System.Math.Abs(elevDiff) / _slope, -_slope);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " Grading_SetupSlope.cs: line: 122");
                    }
                }

                _pnts3dD.Add(pnt3d0);

                if (_doB2 == true)
                {
                    pnt3dX = pnt3d0.traverse(dblAng + pi, _B2Width, -_B2Slope);
                    _pnts3dB2.Add(pnt3dX);
                }
            }
        }