コード例 #1
0
ファイル: Wall_DesignProfileView.cs プロジェクト: 15831944/EM
        CreateProfileViewPrelim(Alignment objAlign)
        {
            ObjectId id = ObjectId.Null;

            ProfileView objProfileView      = null;
            ObjectId    idPViewStyle        = ObjectId.Null;
            ObjectId    idPViewBandSetStyle = ObjectId.Null;

            Debug.Print("CreateProfileViewPrelim - Line 28");


            try {
                idPViewStyle        = Prof_Style.getProfileViewStyle("WALL");
                idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("WALL");
            } catch (Autodesk.AutoCAD.Runtime.Exception) {
                idPViewStyle        = Prof_Style.getProfileViewStyle("Standard");
                idPViewBandSetStyle = Prof_Style.getProfileViewBandSetStyle("Standard");
            }

            PromptStatus ps       = default(PromptStatus);
            Point3d      pnt3dIns = default(Point3d);

            try {
                BaseObjs.acadActivate();
                pnt3dIns = UserInput.getPoint("Select insertion point for Profile View", out ps, osMode: 0);
            } catch (Autodesk.AutoCAD.Runtime.Exception) {
                objAlign.Erase();
                return(ObjectId.Null);
            }

            string strLayer = string.Format("{0}-PROFILEVIEW", objAlign.Name);

            Layer.manageLayers(strLayer);

            Debug.Print("CreateProfileViewPrelim - Line 74");


            try {
                objProfileView = Prof.addProfileView(objAlign.ObjectId, pnt3dIns, idPViewBandSetStyle, idPViewStyle);
            } catch (Autodesk.AutoCAD.Runtime.Exception ex) {
                Application.ShowAlertDialog(ex.ToString());
            }

            TypedValue[] tvs = new TypedValue[2] {
                new TypedValue(1001, "WALLDESIGN"),
                new TypedValue(1005, objProfileView.Handle)
            };

            objProfileView.ObjectId.setXData(tvs, "WALLDESIGN");

            tvs = new TypedValue[2] {
                new TypedValue(1001, "BRKLINE"),
                new TypedValue(1005, 0)
            };

            objProfileView.ObjectId.setXData(tvs, "BRKLINE");

            return(objProfileView.ObjectId);
        }
コード例 #2
0
 private void cmdResetOX_Click(object sender, RoutedEventArgs e)
 {
     using (BaseObjs._acadDoc.LockDocument())
     {
         resetOX();
         BaseObjs.updateGraphics();
     }
 }
コード例 #3
0
ファイル: AlignEnts.cs プロジェクト: 15831944/EM
 /// <summary>
 ///
 /// </summary>
 /// <param name="align"></param>
 private void enumerateEntsById(Alignment align)
 {
     foreach (AlignmentEntity ent in align.Entities)
     {
         BaseObjs.write(string.Format("\n.. Entity ID: {0}", ent.EntityId));
         writeAlignData(ent);
     }
 }
コード例 #4
0
        updateSTAKE_PNTS(ObjectId idDictSTAKE_PNTS)
        {
            List <uint>   lngPntNums     = new List <uint>();
            List <Handle> strAlignHandle = new List <Handle>();
            int           k = 0;

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                DBDictionary objDictSTAKE_PNTS = (DBDictionary)idDictSTAKE_PNTS.GetObject(OpenMode.ForRead);

                if (objDictSTAKE_PNTS.Count == 0)
                {
                    return;
                }

                k = objDictSTAKE_PNTS.Count;

                for (int i = 0; i < k; i++)
                {
                    List <DBDictionaryEntry> entries = Dict.getEntries(idDictSTAKE_PNTS);
                    foreach (DBDictionaryEntry entry in entries)
                    {
                        ResultBuffer rb = Dict.getXRec(idDictSTAKE_PNTS, entry.Key);
                        if (rb == null)
                        {
                            continue;
                        }
                        TypedValue[] tvs = rb.AsArray();
                        lngPntNums.Add(uint.Parse(tvs[0].Value.ToString()));
                        strAlignHandle.Add(tvs[1].Value.ToString().stringToHandle());
                    }
                }
                idDictSTAKE_PNTS.delete();
                tr.Commit();
            }

            bool exists = false;

            idDictSTAKE_PNTS = Dict.getNamedDictionary("STAKE_PNTS", out exists);  //returns id of new dictionary

            Autodesk.Civil.ApplicationServices.CivilDocument civDoc =
                (Autodesk.Civil.ApplicationServices.CivilDocument)Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;

            for (int i = 0; i < k; i++)
            {
                ObjectId idCgPnt = civDoc.CogoPoints.GetPointByPointNumber((uint)lngPntNums[i]);
                if (!idCgPnt.IsValid)
                {
                    continue;
                }

                TypedValue[] tv = new TypedValue[2];
                tv.SetValue(new TypedValue((int)DxfCode.Int32, lngPntNums[i]), 0);
                tv.SetValue(new TypedValue(1005, strAlignHandle[i]), 1);

                Dict.addXRec(idDictSTAKE_PNTS, idCgPnt.ToString(), tv);
            }
        }
コード例 #5
0
ファイル: cmdGD_old.cs プロジェクト: 15831944/EM
        getDockLimits()
        {
            List <Point3d> pnts3d = new List <Point3d>();

            Point3d pnt3dPick;

            Entity ent = Select.selectEntity(typeof(Polyline3d), "\nSelect Finish Floor 3d Polyline: ",
                                             "3d Polyline selection failed.  Exiting...", out pnt3dPick);

            Polyline3d poly3d = (Polyline3d)ent;

            ResultBuffer rb = poly3d.ObjectId.getXData("AVG");

            if (rb == null)
            {
                return(pnts3d);
            }
            TypedValue[] tvs = rb.AsArray();
            bldgNum = tvs[2].Value.ToString();

            using (BaseObjs._acadDoc.LockDocument())
            {
                Object selectCycling = Application.GetSystemVariable("SELECTIONCYCLING");
                Application.SetSystemVariable("SELECTIONCYCLING", 0);
                Object osMode = SnapMode.getOSnap();
                SnapMode.setOSnap((int)osModes.END);
                PromptStatus ps;

                try
                {
                    bool    escape   = false;
                    Point3d pnt3dRet = UserInput.getPoint("\nSelect Dock Begin point (CCW orientation)", Pub.pnt3dO, out escape, out ps, osMode: 1);
                    if (escape)
                    {
                        return(pnts3d);
                    }
                    pnts3d.Add(pnt3dRet);

                    pnt3dRet = UserInput.getPoint("\nSelect Dock End point (CCW orientation)", pnt3dRet, out escape, out ps, osMode: 1);
                    if (escape)
                    {
                        return(pnts3d);
                    }
                    pnts3d.Add(pnt3dRet);
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " cmdGD_old.cs: line: 284");
                }
                finally
                {
                    Application.SetSystemVariable("SELECTIONCYCLING", selectCycling);
                    SnapMode.setOSnap((int)osMode);
                }
            }
            return(pnts3d);
        }
コード例 #6
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);
        }
コード例 #7
0
        getPoints(string prompt1, string prompt2)
        {
            List <ObjectId> idCgPnts = new List <ObjectId>();

            try
            {
                int          n = 0;
                PromptStatus ps;
                bool         done = false;
                Point3d      pnt3d;
                bool         escape  = true;
                ObjectId     idCgPnt = ObjectId.Null;
                do
                {
                    switch (n)
                    {
                    case 0:
                        idCgPnt = CgPnt.selectCogoPointByNode(prompt1, ref Pub.pnt3dO, out escape, out ps, osMode: 8);
                        n++;
                        break;

                    default:
                        pnt3d   = idCgPnt.getCogoPntCoordinates();
                        idCgPnt = CgPnt.selectCogoPointByNode(prompt2, ref pnt3d, out escape, out ps, osMode: 8);

                        break;
                    }

                    switch (ps)
                    {
                    case PromptStatus.Cancel:
                        return(idCgPnts);

                    case PromptStatus.None:
                        if (idCgPnts.Count < 2)
                        {
                            return(idCgPnts);
                        }
                        done = true;
                        break;

                    case PromptStatus.OK:
                        idCgPnts.Add(idCgPnt);
                        break;
                    }
                }while (!done);
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdBC1.cs: line: 240");
            }
            finally
            {
            }
            return(idCgPnts);
        }
コード例 #8
0
ファイル: GradeSlope.xaml.cs プロジェクト: 15831944/EM
        private void btnBuildSlope_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Boolean boolOK      = false;
            string  surfTAR     = string.Empty;
            string  surfDES     = string.Empty;
            int     intInterval = Convert.ToInt32(tbxInterval.Text.ToString());

            if (optSurface.IsChecked == true)
            {
                try
                {
                    surfTAR = cbxSurfaceTar.SelectedItem.ToString();
                }
                catch (Exception)
                {
                    BaseObjs.write("Select Target Surface (surface to daylight)");
                    return;
                }
            }

            double slope = double.Parse(tbxSlopeV.Text) / double.Parse(tbxSlopeH.Text);

            try
            {
                surfDES = cbxSurfaceDes.SelectedItem.ToString();
            }
            catch (Exception)
            {
                BaseObjs.write("Select Design Surface (where the results are to be placed)");
                return;
            }
            double elev = 0.0;

            if (optElevation.IsChecked == true)
            {
                surfTAR = "";
                elev    = double.Parse(tbxElev.Text);
            }
            double B1Width = double.Parse(strB1Width);
            double B2Width = double.Parse(strB2Width);
            double B1Slope = double.Parse(strB1Slope);
            double B2Slope = double.Parse(strB2Slope);

            int interval = int.Parse(strInterval);

            switch (nameCmd)
            {
            case "cmdBD":
                boolOK = Grading.Cmds.cmdBD.BD(B1Width, B1Slope, B2Width, B2Slope, slope, interval, surfTAR, surfDES, elev: elev);
                break;

            case "cmdSG":
                boolOK = Grading.Cmds.cmdSG.SG(B1Width, B1Slope, B2Width, B2Slope, slope, interval, surfTAR, surfDES, elev: elev);
                break;
            }
        }
コード例 #9
0
 public EM_ApplicationEvents()
 {
     try
     {
         Application.SystemVariableChanged += callback_SystemVariableChanged;
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " EM_ApplicationEvents.cs: line: 20");
     }
 }
コード例 #10
0
        getSurfaceBoundaries(this ObjectId idSurf)
        {
            Entity[] ents = null;
            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                TinSurface surf = (TinSurface)tr.GetObject(idSurf, OpenMode.ForRead);
            }

            return(ents);
        }
コード例 #11
0
ファイル: Surf_Styles.cs プロジェクト: 15831944/EM
        getSurfaceStyle(ObjectId idStyle)
        {
            SurfaceStyle style = null;

            using (Transaction tr = BaseObjs.startTransactionDb()){
                style = (SurfaceStyle)tr.GetObject(idStyle, OpenMode.ForRead);
            }

            return(style);
        }
コード例 #12
0
ファイル: cmdSG.cs プロジェクト: 15831944/EM
        doMidDelta(int intSide, Point3d pnt3dA, Point3d pnt3dB, Point3d pnt3dC,
                   bool doB1, double B1Width, double B1Slope, bool doB2, double B2Width, double B2Slope,
                   string surfaceTAR, double elev, double slope,
                   ref Point3d pnt3dB1_M, ref Point3d pnt3dB2_M, ref Point3d pnt3dDL_M)
        {
            using (BaseObjs._acadDoc.LockDocument())
            {
                double   dblAngBC  = pnt3dB.getDirection(pnt3dC);
                Vector3d v3d1      = pnt3dB - pnt3dA;
                Vector3d v3d2      = pnt3dC - pnt3dB;
                double   dblAngABC = v3d1.getAngle2Vectors(v3d2);

                uint   pntNum  = 0;
                double dblAngV = dblAngBC + intSide * dblAngABC / 2;
                if (doB1 == true)
                {
                    pnt3dB1_M = pnt3dB.traverse(dblAngV, B1Width, B1Slope);
                    pnt3dB1_M.setPoint(out pntNum, "CPNT-ON");
                    BaseObjs.updateGraphics();
                }
                if (doB2 == true)
                {
                    pnt3dB2_M = pnt3dB.traverse(dblAngV, B2Width, B2Slope);  //temporary point
                    pnt3dB2_M.setPoint(out pntNum, "CPNT-ON");
                    BaseObjs.updateGraphics();
                }

                if (surfaceTAR != "")
                {
                    pnt3dDL_M = getTargetElevation(elev, pnt3dB, dblAngV, slope);
                    pnt3dDL_M.setPoint(out pntNum, "CPNT-ON");
                    BaseObjs.updateGraphics();
                }
                else
                {
                    try
                    {
                        pnt3dDL_M = getTargetElevation(elev, pnt3dB, dblAngV, slope);
                        pnt3dDL_M.setPoint(out pntNum, "CPNT-ON");
                        BaseObjs.updateGraphics();
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdSG.cs: line: 337");
                    }
                }

                if (doB2 == true)
                {
                    pnt3dB2_M = pnt3dDL_M.traverse(dblAngV + PI, B2Width, -B2Slope);
                    pnt3dB2_M.setPoint(out pntNum, "CPNT-ON");
                    BaseObjs.updateGraphics();
                }
            }
        }
コード例 #13
0
        private void cmdGridDelete_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            BaseObjs.acadActivate();

            Point3d pnt3d = Pub.pnt3dO;
            Entity  ent   = Base_Tools45.Select.selectEntity(typeof(Line), "Select Grid LINE to delete:", "", out pnt3d);

            if (ent == null)
            {
                return;
            }

            Line objLineX = (Line)ent;

            int    n       = objLineX.Layer.IndexOf("GRID");
            string strName = objLineX.Layer.Substring(n);

            ResultBuffer rb = objLineX.ObjectId.getXData("GRID");

            TypedValue[] tvs = rb.AsArray();

            string strType = "";
            string strVal  = tvs[1].Value.ToString();
            int    res     = 0;

            if (strVal.isInteger(out res))
            {
                strType = "NUMERIC";

                for (int i = 1; i <= GRIDNUMERIC.Count; i++)
                {
                    if (objLineX.Handle == GRIDNUMERIC[i])
                    {
                        GRIDNUMERIC.RemoveAt(i);
                    }
                }
            }
            else
            {
                strType = "ALPHA";

                for (int i = 1; i <= GRIDALPHA.Count; i++)
                {
                    if (objLineX.Handle == GRIDALPHA[i])
                    {
                        GRIDALPHA.RemoveAt(i);
                    }
                }
            }

            Stake_Dict.updateDictGRIDs(strName, strType, "DELETE", objLineX.ObjectId, objLineX.Handle.ToString());

            objLineX.ObjectId.delete();
        }
コード例 #14
0
 deletePntGroup(string name)
 {
     try
     {
         BaseObjs._civDoc.PointGroups.Remove(name);
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 317", ex.Message));
     }
 }
コード例 #15
0
ファイル: AlignEnts.cs プロジェクト: 15831944/EM
        /// <summary>
        ///
        /// </summary>
        /// <param name="align"></param>
        private void enumerateEntsByOrder(Alignment align)
        {
            AlignmentEntityCollection ents = align.Entities;

            for (int i = 0; i < ents.Count; i++)
            {
                AlignmentEntity ent = ents.GetEntityByOrder(i);
                BaseObjs.write(string.Format("\n.. Entity Sequence: {0}", i));
                writeAlignData(ent);
            }
        }
コード例 #16
0
 public void RTr()
 {
     try {
         cmdRTx.SetPointBySlopeFromRef3dPoly();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 111");
     }
     finally {
     }
 }
コード例 #17
0
 private void WriteLine(object obj)
 {
     try
     {
         string str = "\nAPP Events: " + obj.ToString();
         EW_Helper.StreamMessage(str);
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " EW_ApplicationEvents.cs: line: 137");
     }
 }       // end of WriteLine function
コード例 #18
0
 public void UBP()
 {
     try {
         cmdUBP.updateBrkLines_Pnts();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 159");
     }
     finally {
     }
 }
コード例 #19
0
 public void RB()
 {
     try {
         cmdRB.rebuildCPNT_ON();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 171");
     }
     finally {
     }
 }
コード例 #20
0
 public void MBL()
 {
     try {
         cmdMB.makeBreakline("lnkBrks", "MBL");
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 87");
     }
     finally {
     }
 }
コード例 #21
0
 public void CBL()
 {
     try {
         cmdABL.resetBreaklines();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 195");
     }
     finally {
     }
 }
コード例 #22
0
 public void RB0()
 {
     try {
         cmdABL.removeBreaklinewWith0vertices();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 183");
     }
     finally {
     }
 }
コード例 #23
0
 public void UC()
 {
     try {
         cmdUC.updateControl();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 207");
     }
     finally {
     }
 }
コード例 #24
0
 public void CPXD()
 {
     try {
         cmdCPXD.checkPntXData();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 219");
     }
     finally {
     }
 }
コード例 #25
0
 public void BG()
 {
     try {
         cmdBC.buildBench(true);
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 39");
     }
     finally {
     }
 }
コード例 #26
0
ファイル: cmdBC.cs プロジェクト: 15831944/EM
        buildTCandBench(double offH, double offV, ObjectId idPoly3dFL, ObjectId idPoly3dRF, bool addPoints, ref List <Handle> handles)
        {
            ObjectId idPoly3dNew = ObjectId.Null;

            try
            {
                ObjectId idPoly    = idPoly3dRF.addPoly();
                ObjectId idPolyOff = idPoly.offset(offH);

                Point3dCollection pnts3d    = idPoly3dRF.getCoordinates3d();
                Point3dCollection pnts3dOff = idPolyOff.getCoordinates3d();
                Point3dCollection pnts3dNew = new Point3dCollection();

                List <ObjectId> idsCgPnts = new List <ObjectId>();

                idPoly.delete();
                idPolyOff.delete();

                if (pnts3d.Count == pnts3dOff.Count)
                {
                    uint pntNum;
                    for (int i = 0; i < pnts3dOff.Count; i++)
                    {
                        Point3d pnt3d = new Point3d(pnts3dOff[i].X, pnts3dOff[i].Y, pnts3d[i].Z + offV);
                        pnts3dNew.Add(pnt3d);
                        if (addPoints)
                        {
                            ObjectId idCogoPnt = pnt3d.setPoint(out pntNum, "CPNT-ON");
                            handles.Add(idCogoPnt.getHandle());
                            idsCgPnts.Add(idCogoPnt);
                        }
                    }
                    if (addPoints)
                    {
                        idPoly3dNew = BrkLine.makeBreakline(apps.lnkBrks, "cmdBC", out idPoly, idsCgPnts);
                        foreach (ObjectId id in idsCgPnts)
                        {
                            id.setXData(idPoly3dNew.getHandle(), apps.lnkBrks3);
                        }
                    }
                    else
                    {
                        idPoly3dNew = Draw.addPoly3d(pnts3dNew, "CPNT-BRKLINE");
                    }
                    idPoly3dNew.setXData(idPoly3dFL.Handle, apps.lnkBrks3);
                    handles.Add(idPoly3dNew.Handle);
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdBC.cs: line: 182");
            }
            return(idPoly3dNew);
        }
コード例 #27
0
ファイル: Sect.cs プロジェクト: 15831944/EM
        getSampleLineIDs(this ObjectId idSLG)
        {
            ObjectIdCollection ids = new ObjectIdCollection();

            using (var tr = BaseObjs.startTransactionDb()){
                SampleLineGroup group = (SampleLineGroup)tr.GetObject(idSLG, OpenMode.ForWrite);
                ids = group.GetSampleLineIds();
                tr.Commit();
            }
            return(ids);
        }
コード例 #28
0
 public void RL()
 {
     try {
         cmdBL.SetPointBySlopeWithBrkline("lnkBrks", "RL");
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 99");
     }
     finally {
     }
 }
コード例 #29
0
 public void BV()
 {
     try {
         cmdBV.valleyGutter();
     }
     catch (System.Exception ex) {
         BaseObjs.writeDebug(ex.Message + " cmd.cs: line: 63");
     }
     finally {
     }
 }