Exemplo n.º 1
0
        setOffsetPointMISC(Point3d dblPntX, string strLayer, string strDesc)
        {
            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1005, "0000"),
                new TypedValue(1070, -1),
                new TypedValue(1000, "MISC")
            };
            uint     pntNum  = 0;
            double   elev    = System.Math.Round(dblPntX.Z, 3);
            Point3d  pnt3d   = new Point3d(dblPntX.X, dblPntX.Y, elev);
            ObjectId idCgPnt = pnt3d.setPoint("SPNT");

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                CogoPoint CgPnt = (CogoPoint)tr.GetObject(idCgPnt, OpenMode.ForWrite);
                CgPnt.LabelStyleId   = Pnt_Style.getPntLabelStyle("SPNT");
                pntNum               = fStake.NextPntNum;
                CgPnt.PointName      = string.Format("SPNT{0}", pntNum);
                CgPnt.RawDescription = strDesc;
                CgPnt.PointNumber    = fStake.NextPntNum;
                fStake.NextPntNum++;

                tr.Commit();
            }

            idCgPnt.setXData(tvs, "STAKE");
        }
Exemplo n.º 2
0
        setPointLabelStyleBOT()
        {
            ObjectId idPntLabelStyle = Pnt_Style.getPntLabelStyle("BOT");

            Layer.manageLayers("BOT-POINT-LABEL");

            using (var tr = BaseObjs.startTransactionDb()){
                LabelStyle labelStyle = (LabelStyle)tr.GetObject(idPntLabelStyle, OpenMode.ForWrite);
                labelStyle.Properties.Label.Layer.Value      = "BOT-POINT-LABEL";
                labelStyle.Properties.Label.Visibility.Value = false;
                tr.Commit();
            }
        }
Exemplo n.º 3
0
        public EM_Commands()
        {
            Grading_CommandDefaults.initializeCommandDefaults();

            Pnt_Style.checkPntLabelStyles();
            foreach (CgPnt_Group.pntGroupParams pntGrpParams in CgPnt_Group.pntGroups)
            {
                if (pntGrpParams.name != "SPNT")
                {
                    CgPnt_Group.checkPntGroup(pntGrpParams.name);
                }

                Layer.manageLayer(pntGrpParams.name, pntGrpParams.color);
                Layer.manageLayer(pntGrpParams.nameLayerLabel, 7, pntGrpParams.layerOff, pntGrpParams.layerFrozen);
            }

            using (BaseObjs._acadDoc.LockDocument())
            {
                Layer.manageLayers("ARROW", 7);
                Layer.manageLayers("GRADES", 2);
            }

            Pub.Slope = 0.005;
        }
Exemplo n.º 4
0
        MCG()
        {
            object dynMode   = null;
            object dynPrompt = null;
            object osMode    = null;

            try
            {
                dynMode   = Application.GetSystemVariable("DYNMODE");
                dynPrompt = Application.GetSystemVariable("DYNPROMPT");

                Application.SetSystemVariable("DYNMODE", 3);
                Application.SetSystemVariable("DYNPROMPT", 1);

                osMode = SnapMode.getOSnap();
                SnapMode.setOSnap((int)osModes.NOD);

                string       descVal = "", descKey = "";
                Point3d      pnt3dPick;
                PromptStatus ps;
                CogoPoint    cgPnt;
                Entity       ent    = Select.selectEntity(typeof(CogoPoint), "\nSelect a point on the desired group or <CR> for Menu: ", "", out pnt3dPick, out ps);
                short        color  = 256;
                string       prompt = "";
                TypedValue[] tvs;

                switch (ps)
                {
                case PromptStatus.OK:
                    cgPnt   = (CogoPoint)ent;
                    descVal = cgPnt.RawDescription;
                    break;

                case PromptStatus.Cancel:
                    return;

                case PromptStatus.None:
                    bool     exists;
                    ObjectId idDict = Dict.getNamedDictionary("cmdMCG", out exists);
                    if (exists)
                    {
                        ResultBuffer rb = Dict.getXRec(idDict, "defaultCmd");
                        if (rb == null)
                        {
                            descVal = "CPNT-ON";
                        }
                        else
                        {
                            tvs     = rb.AsArray();
                            descVal = tvs[0].Value.ToString();
                        }
                    }
                    else
                    {
                        descVal = "CPNT-ON";
                    }
                    descKey = "O";
                    foreach (CgPnt_Group.pntGroupParams pntGrp in CgPnt_Group.pntGroups)
                    {
                        if (pntGrp.name == descVal)
                        {
                            descKey = pntGrp.key;
                            break;
                        }
                    }

                    bool escape;
                    prompt = string.Format("\nSelect [cpntJoin/cpntOn/cpntSt/cpntTrans/cpntMisc/utlSEw/utlSD/utlWat/utlMIsc/Cp/SPnt/Exist/eXit] <{0}> [J/O/S/T/M/SE/SD/W/MI/C/SP/E/X]", descVal);
                    escape = UserInput.getUserInputKeyword(descKey, out descKey, prompt, "J O S T M SE SD W MI C SP E X");
                    if (escape)
                    {
                        return;
                    }

                    if (descKey.ToUpper() == "X")
                    {
                        return;
                    }

                    exists = false;
                    foreach (CgPnt_Group.pntGroupParams pntGrp in CgPnt_Group.pntGroups)
                    {
                        if (pntGrp.key == descKey)
                        {
                            descVal = pntGrp.name;
                            color   = pntGrp.color;
                            exists  = true;
                            break;
                        }
                    }

                    if (!exists)
                    {
                        Application.ShowAlertDialog("Value entered is out of range. Exiting...");
                        return;
                    }

                    break;
                }
                Layer.manageLayers(descVal);
                ObjectId idPntLblStyle = Pnt_Style.getPntLabelStyle(descVal);
                ObjectId idPntStyle    = Pnt_Style.getPntStyle(descVal);

                Layer.manageLayer(descVal, color);

                prompt = string.Format("\nSelect Point(s) to be moved to group {0}\r", descVal);

                Editor ed = BaseObjs._editor;

                tvs = new TypedValue[1];
                Type type = typeof(CogoPoint);
                tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 0);

                SelectionFilter        filter = new SelectionFilter(tvs);
                PromptSelectionOptions pso    = new PromptSelectionOptions();
                pso.MessageForAdding            = prompt;
                pso.MessageForRemoval           = "\nRemove Items";
                pso.RejectObjectsOnLockedLayers = true;

                PromptSelectionResult psr = null;
                BaseObjs.acadActivate();

                psr = BaseObjs._editor.GetSelection(pso, filter);
                SelectionSet ss = psr.Value;

                if (ss != null && ss.Count > 0)
                {
                    ObjectId[] ids = ss.GetObjectIds();
                    try
                    {
                        using (Transaction tr = BaseObjs.startTransactionDb())
                        {
                            foreach (ObjectId id in ids)
                            {
                                CogoPoint cogoPnt = (CogoPoint)tr.GetObject(id, OpenMode.ForWrite);
                                cogoPnt.RawDescription = descVal;
                                cogoPnt.Layer          = descVal;
                                cogoPnt.LabelStyleId   = idPntLblStyle;
                                cogoPnt.StyleId        = idPntStyle;
                            }
                            tr.Commit();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdMCG.cs: line: 155");
                    }
                    CgPnt_Group.updatePntGroups();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdMCG.cs: line: 162");
            }
            finally
            {
                SnapMode.setOSnap((int)osMode);
                Application.SetSystemVariable("DYNMODE", (Int16)dynMode);
                Application.SetSystemVariable("DYNPROMPT", (Int16)dynPrompt);
            }
        }
Exemplo n.º 5
0
Arquivo: cmdRL.cs Projeto: 15831944/EM
        RL(string nameApp, string nameCmd)
        {
            ObjectId idPoly = ObjectId.Null;
            bool     escape = false;

            List <ObjectId> idPnts        = new List <ObjectId>();
            ObjectId        idCogoPntBASE = CgPnt.selectCogoPointByNode("\nSelect Base Point: ", osMode: 8);

            if (idCogoPntBASE == ObjectId.Null)
            {
                Application.ShowAlertDialog("CogoPoint not found.  Exiting......");
                return;
            }

            BaseObjs.updateGraphics();
            Point3d pnt3dBASE = idCogoPntBASE.getCogoPntCoordinates();

            idPnts.Add(idCogoPntBASE);

            string pntDesc = idCogoPntBASE.getCogoPntDesc();

            if (pntDesc == "")
            {
                pntDesc = "CPNT-ON";
            }

            string       prompt = "\nLocate New Point: ";
            PromptStatus ps;
            Point3d      pnt3dTAR = UserInput.getPoint(prompt, pnt3dBASE, out escape, out ps, osMode: 641);

            if (escape || pnt3dTAR == Pub.pnt3dO)
            {
                return;
            }

            double distance = 0.0;
            double DeltaZ   = 0.0;
            double grade    = 0.0;

            resultsRL resRL;

            getRLpromptresults(out resRL, out escape);
            if (escape)
            {
                return;
            }

            switch (resRL.opt)
            {
            case "R":
                grade    = resRL.val;
                distance = pnt3dBASE.getDistance(pnt3dTAR);
                pnt3dTAR = new Point3d(pnt3dTAR.X, pnt3dTAR.Y, pnt3dBASE.Z + (grade * distance));
                break;

            case "Z":
                DeltaZ   = resRL.val;
                pnt3dTAR = new Point3d(pnt3dTAR.X, pnt3dTAR.Y, pnt3dBASE.Z + DeltaZ);
                break;
            }

            uint     pntNum;
            ObjectId idCogoPntTAR = pnt3dTAR.setPoint(out pntNum, pntDesc);
            ObjectId idPoly3d     = ObjectId.Null;

            if (nameCmd == "cmdRL")
            {
                idPnts.Add(idCogoPntTAR);

                List <Handle> hPnts = new List <Handle>();
                hPnts.Add(idPnts[0].getHandle());
                hPnts.Add(idPnts[1].getHandle());

                using (BaseObjs._acadDoc.LockDocument())
                {
                    idPoly3d = BrkLine.makeBreakline(nameApp, nameCmd, out idPoly, idPnts);
                }
            }

            Grading_Palette.gPalette.pGrading.cmdRL_Default = resRL.opt;
            Grading_Palette.gPalette.pGrading.cmdRL_GRADE   = grade.ToString();
            Grading_Palette.gPalette.pGrading.cmdRL_DELTAZ  = DeltaZ.ToString();

            Dict.setCmdDefault("cmdRL", "cmdDefault", resRL.opt);
            Dict.setCmdDefault("cmdRL", "GRADE", grade.ToString());
            Dict.setCmdDefault("cmdRL", "DELTAZ", DeltaZ.ToString());

            bool       exists          = false;
            PointGroup pntGroup        = CgPnt_Group.addPntGroup(pntDesc, out exists);
            ObjectId   idPntLabelStyle = Pnt_Style.getPntLabelStyle(CgPnts.setup(pntDesc));

            if (!exists)
            {
                try
                {
                    using (Transaction tr = BaseObjs.startTransactionDb())
                    {
                        pntGroup.UpgradeOpen();
                        pntGroup.PointLabelStyleId = idPntLabelStyle;

                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = pntDesc;
                        pntGroup.SetQuery(query);
                        tr.Commit();
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " cmdRL.cs: line: 167");
                }
            }
        }
Exemplo n.º 6
0
        setOffsetPoint(Point3d pnt3dX, string strOffset, string strName, string strDesc, ObjectId idAlign, double dblStation, object varXAlignDesc = null)
        {
            string nameAlign = Align.getAlignName(idAlign);

            Debug.Print(dblStation + " setOffsetPoint - Station In");

            double dblElevCPNT   = 0;
            double dblElevSTAKE  = 0;
            int    intCurbHeight = 0;

            string strLayer  = fStake.STAKE_LAYER;
            string descCgPnt = "";

            double offset = double.Parse(strOffset) * fStake.Side;

            TypedValue[] tvs = new TypedValue[4];
            tvs.SetValue(new TypedValue(1001, "STAKE"), 0);
            tvs.SetValue(new TypedValue(1005, idAlign.getHandle()), 1);
            tvs.SetValue(new TypedValue(1004, dblStation), 2);
            tvs.SetValue(new TypedValue(1040, offset), 3);

            pnt3dX = pnt3dX.addElevation(System.Math.Round(pnt3dX.Z, 3));

            //uint pntNum = 0;
            //ObjectId idCgPnt = pnt3dX.setPoint(out pntNum, "SPNT");
            //CogoPoint cgPnt = (CogoPoint)idCgPnt.getEnt();

            POI varPoi = new POI();

            varPoi.Station   = dblStation;
            varPoi.Elevation = pnt3dX.Z;
            //varPoi.PntNum = cgPnt .PointNumber.ToString();

            if (varPoi.Elevation == 0)
            {
                if (fStake.ClassObj != "WALL")
                {
                    varPoi.Elevation = System.Math.Round(Prof.getProfileElev(idAlign, "CPNT", dblStation), 3);
                    varPoi.PntNum    = varPoi.PntNum + " RP";
                }
            }

            //fStake.POI_STAKED.Add(varPoi);

            string strFS = "";

            switch (fStake.ClassObj)
            {
            case "CURB":

                strFS       = " TC";
                dblElevCPNT = Prof.getProfileElev(idAlign, "FLOWLINE", dblStation);

                dblElevSTAKE  = Prof.getProfileElev(idAlign, "STAKE", dblStation);
                intCurbHeight = Convert.ToInt32((Math.roundUP3(dblElevSTAKE - dblElevCPNT) * 12));
                ASCIIEncoding ascii = new ASCIIEncoding();
                strName = string.Format("{0}{1}{2}{3}", intCurbHeight, ascii.GetString((new Byte[] { 34 })), ascii.GetString((new Byte[] { 32 })), strName);

                break;

            case "WTR":

                strFS = " FS";

                break;

            case "ALIGN":

                switch (strDesc)
                {
                case "TG":
                    strFS = "";
                    break;

                case "HC":
                case "HE":
                case "H0":
                    strDesc = "";
                    strFS   = " INV";
                    break;

                default:
                    strFS = " INV";
                    break;
                }

                break;

            case "FL":

                strFS = " FS";

                break;

            case "BLDG":

                if (fGrid.optPBC.Checked)
                {
                    strFS = " FF";
                }
                else if (fGrid.optRBC.Checked)
                {
                    strFS = " PAD";
                }

                strLayer = string.Format("{0}-OS-{1}", fGrid.tbxOffsetH.Text, nameAlign);

                Alignment objAlign = (Alignment)idAlign.getEnt();

                double easting = 0, northing = 0;

                idAlign.getAlignPointLoc(dblStation, 0.0, ref easting, ref northing);
                Point3d pnt3d0 = new Point3d(easting, northing, 0);

                ObjectId idLine = Draw.addLine(pnt3d0, pnt3dX, strLayer, 9);

                break;
            }

            if ((varXAlignDesc == null))
            {
                if (strDesc.Substring(0, 2) == "RP")
                {
                    descCgPnt = string.Format("{0} {1}", strName, strDesc);

                    if (fStake.optYes.Checked)
                    {
                        descCgPnt = string.Format("{0} {1} {2}", strName, strDesc, string.Format("{0:###+00.00}", varPoi.Station));
                        descCgPnt = descCgPnt.Replace("  ", " ");
                    }
                }
                else
                {
                    if (fStake.ClassObj == "BLDG")
                    {
                        descCgPnt = string.Format("{0}'O/S {1} {2}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim());
                        descCgPnt = descCgPnt.Replace("  ", " ");
                    }
                    else
                    {
                        descCgPnt = string.Format("{0}'O/S {1}@{2}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim());
                        descCgPnt = descCgPnt.Replace("  ", " ");

                        if (fStake.optYes.Checked)
                        {
                            descCgPnt = string.Format("{0}'O/S {1}@{2} {3}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim(), string.Format("{0:###+00.00}", varPoi.Station));
                            descCgPnt = descCgPnt.Replace("  ", " ");
                        }
                    }
                }
            }
            else
            {
                descCgPnt = string.Format("{0}'O/S {1}@{2}", strOffset, strName, string.Format("{0} {1}", strDesc, varXAlignDesc).Trim());
                descCgPnt = descCgPnt.Replace("  ", " ");
            }

            uint     pntNum  = 0;
            ObjectId idCgPnt = pnt3dX.setPoint("SPNT");

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                CogoPoint CgPnt = (CogoPoint)tr.GetObject(idCgPnt, OpenMode.ForWrite);
                CgPnt.LabelStyleId   = Pnt_Style.getPntLabelStyle("SPNT");
                CgPnt.RawDescription = descCgPnt;
                pntNum            = fStake.NextPntNum;
                CgPnt.PointNumber = pntNum;
                fStake.NextPntNum++;
                CgPnt.PointName = string.Format("SPNT{0}", pntNum);

                tr.Commit();
            }

            varPoi.PntNum = pntNum.ToString();
            fStake.POI_STAKED.Add(varPoi);

            Debug.Print(varPoi.Station + " setOffsetPoint");

            idCgPnt.setXData(tvs, "STAKE");
        }
Exemplo n.º 7
0
        RTD(string nameApp)
        {
            resultsRTd resRTd = new resultsRTd {
                opt1 = "D", opt2 = "R", valD = 0.0, valE = 0.0, valZ = 0.0, valS = 0.0
            };

            bool escape = false;

            List <ObjectId> idPnts        = new List <ObjectId>();
            ObjectId        idCogoPntBASE = CgPnt.selectCogoPointByNode("\nSelect Base Point: ", osMode: 8);

            if (idCogoPntBASE == ObjectId.Null)
            {
                Application.ShowAlertDialog("CogoPoint not found.  Exiting......");
                return;
            }

            BaseObjs.updateGraphics();
            Point3d pnt3dBASE = idCogoPntBASE.getCogoPntCoordinates();

            idPnts.Add(idCogoPntBASE);

            string pntDesc = idCogoPntBASE.getCogoPntDesc();

            if (pntDesc == "")
            {
                pntDesc = "CPNT-ON";
            }

            string prompt = "\nPick Point for Direction: ";

            PromptStatus ps;
            Point3d      pnt3dTAR = UserInput.getPoint(prompt, pnt3dBASE, out escape, out ps, osMode: 641);

            if (escape || pnt3dTAR == Pub.pnt3dO)
            {
                return;
            }

            double angle = 0;

            resRTd.opt1 = Dict.getCmdDefault("cmdRTd", "cmdDefault");

            if (resRTd.opt1 == string.Empty)
            {
                resRTd.opt1 = "D";
            }

            angle = Measure.getAzRadians(pnt3dBASE, pnt3dTAR);

            try
            {
                prompt = string.Format("\nDistance / target Elevation / Z value difference <{0}>: [D/E/Z]: ", resRTd.opt1);
                escape = UserInput.getUserInputKeyword(resRTd.opt1, out resRTd.opt1, prompt, "D E Z");
                if (escape)
                {
                    return;
                }
                if (resRTd.opt1 != "D" && resRTd.opt1 != "E" && resRTd.opt1 != "Z")
                {
                    return;
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdRTD.cs: line: 88");
            }

            if (resRTd.opt1 == string.Empty)
            {
                return;
            }
            bool tryParse = false;

            switch (resRTd.opt1)
            {
            case "D":
                resRTd.valD = Pub.Dist;
                if (resRTd.valD == 0)
                {
                    tryParse = double.TryParse(Dict.getCmdDefault("cmdRTD", "Distance"), out resRTd.valD);
                }

                if (!tryParse)
                {
                    resRTd.valD = 0.0;
                }
                ;

                try
                {
                    escape = UserInput.getUserInput("\nEnter Distance [pos(+) value = target direction, neg(-) value = target direction + 180 degrees:", out resRTd.valD, resRTd.valD);
                    if (escape)
                    {
                        return;
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " cmdRTD.cs: line: 112");
                }

                Pub.Dist = resRTd.valD;

                resRTd.valS = Pub.Slope;
                if (resRTd.valS == 0.0)
                {
                    tryParse = double.TryParse(Dict.getCmdDefault("cmdRTd", "Slope"), out resRTd.valS);
                }

                escape = UserInput.getUserInput("\nRate of Grade: ", out resRTd.valS, resRTd.valS);
                if (escape)
                {
                    return;
                }

                Pub.Slope = resRTd.valS;

                break;

            case "E":
                resRTd.valE = Pub.Elev;
                if (resRTd.valE == 0)
                {
                    resRTd.valE = double.Parse(Dict.getCmdDefault("cmdRTd", "Elevation"));
                }

                PromptDoubleOptions pdo = new PromptDoubleOptions("\nEnter Target Elevation / ESC to select point for Elevation: ");

                pdo.AllowArbitraryInput = true;
                pdo.AllowNone           = true;
                pdo.UseDefaultValue     = true;
                pdo.DefaultValue        = resRTd.valE;

                PromptDoubleResult pdr = BaseObjs._editor.GetDouble(pdo);

                switch (pdr.Status)
                {
                case PromptStatus.Cancel:
                    ObjectId idCgPnt = ObjectId.Null;
                    Point3d  pnt3d   = Pub.pnt3dO;
                    tryParse = double.TryParse(UserInput.getPoint("\nSelect Cogo Point with desired elevation: ",
                                                                  out idCgPnt, out pnt3d, pnt3d, osMode: 8, round: false), out resRTd.valE);
                    if (!tryParse)
                    {
                        break;
                    }
                    break;

                case PromptStatus.Error:
                    break;

                case PromptStatus.Other:
                    break;

                case PromptStatus.OK:
                    resRTd.valE = pdr.Value;
                    break;

                case PromptStatus.None:
                    break;
                }

                Pub.Elev = resRTd.valE;

                prompt = string.Format("\nDistance / Rate of grade <{0}>: [D/R]: ", resRTd.opt2);
                escape = UserInput.getUserInputKeyword(resRTd.opt2, out resRTd.opt2, prompt, "D R");
                if (escape)
                {
                    return;
                }

                switch (resRTd.opt2)
                {
                case "D":
                    resRTd.valD = Pub.Dist;
                    if (resRTd.valD == 0)
                    {
                        tryParse = double.TryParse(Dict.getCmdDefault("cmdRTD", "Distance"), out resRTd.valD);
                    }

                    if (!tryParse)
                    {
                        resRTd.valD = 0.0;
                    }
                    ;

                    try
                    {
                        escape = UserInput.getUserInput("\nEnter Distance [pos(+) value = target direction, neg(-) value = target direction + 180 degrees:", out resRTd.valD, resRTd.valD);
                        if (escape)
                        {
                            return;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdRTD.cs: line: 189");
                    }
                    Pub.Dist = resRTd.valD;

                    break;

                case "R":
                    resRTd.valS = Pub.Slope;
                    if (resRTd.valS == 0.0)
                    {
                        tryParse = double.TryParse(Dict.getCmdDefault("cmdRTd", "Slope"), out resRTd.valS);
                    }

                    escape = UserInput.getUserInput("\nRate of Grade: ", out resRTd.valS, resRTd.valS);
                    if (escape)
                    {
                        return;
                    }

                    Pub.Slope = resRTd.valS;
                    break;
                }

                break;

            case "Z":
                resRTd.valZ = Pub.dZ;

                escape = UserInput.getUserInput("\nZ Value Difference", out resRTd.valZ, resRTd.valZ);

                if (escape)
                {
                    return;
                }

                prompt = string.Format("\nDistance / Rate of grade <{0}>: [D/R]: ", resRTd.opt2);
                escape = UserInput.getUserInputKeyword(resRTd.opt2, out resRTd.opt2, prompt, "D R");
                if (escape)
                {
                    return;
                }

                switch (resRTd.opt2)
                {
                case "D":
                    resRTd.valD = Pub.Dist;
                    if (resRTd.valD == 00)
                    {
                        tryParse = double.TryParse(Dict.getCmdDefault("cmdRTD", "Distance"), out resRTd.valD);
                    }
                    if (!tryParse)
                    {
                        resRTd.valD = 0.0;
                    }
                    try
                    {
                        escape = UserInput.getUserInput("\nEnter Distance [pos(+) value = target direction, neg(-) value = target direction + 180 degrees:", out resRTd.valD, resRTd.valD);
                        if (escape)
                        {
                            return;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdRTD.cs: line: 236");
                    }
                    Pub.Dist = resRTd.valD;

                    break;

                case "R":
                    resRTd.valS = Pub.Slope;
                    if (resRTd.valS == 0.0)
                    {
                        tryParse = double.TryParse(Dict.getCmdDefault("cmdRTd", "Slope"), out resRTd.valS);
                    }

                    escape = UserInput.getUserInput("\nRate of Grade: ", out resRTd.valS, resRTd.valS);
                    if (escape)
                    {
                        return;
                    }
                    Pub.Slope = resRTd.valS;
                    break;
                }
                break;
            }


            switch (resRTd.opt1)
            {
            case "D":
                pnt3dTAR = new Point3d(pnt3dBASE.X + System.Math.Cos(angle) * resRTd.valD,
                                       pnt3dBASE.Y + System.Math.Sin(angle) * resRTd.valD,
                                       pnt3dBASE.Z + resRTd.valS * System.Math.Abs(resRTd.valD));
                break;

            case "E":

                switch (resRTd.opt2)
                {
                case "D":
                    pnt3dTAR = pnt3dBASE.traverse(angle, resRTd.valD, 0);
                    pnt3dTAR = new Point3d(pnt3dTAR.X, pnt3dTAR.Y, resRTd.valE);
                    break;

                case "R":
                    double distance = System.Math.Abs((resRTd.valE - pnt3dBASE.Z) / resRTd.valS);
                    pnt3dTAR = new Point3d(pnt3dBASE.X + System.Math.Cos(angle) * distance,
                                           pnt3dBASE.Y + System.Math.Sin(angle) * distance,
                                           resRTd.valE);
                    break;
                }
                break;

            case "Z":
                switch (resRTd.opt2)
                {
                case "D":
                    pnt3dTAR = new Point3d(pnt3dBASE.X + System.Math.Cos(angle) * resRTd.valD,
                                           pnt3dBASE.Y + System.Math.Sin(angle) * resRTd.valD,
                                           pnt3dBASE.Z + resRTd.valZ);
                    break;

                case "R":
                    double distance = System.Math.Abs(resRTd.valZ / resRTd.valS);
                    pnt3dTAR = new Point3d(pnt3dBASE.X + System.Math.Cos(angle) * distance,
                                           pnt3dBASE.Y + System.Math.Sin(angle) * distance,
                                           pnt3dBASE.Z + resRTd.valZ);
                    break;
                }
                break;
            }

            uint     pntNum;
            ObjectId idCogoPntTAR = pnt3dTAR.setPoint(out pntNum, pntDesc);
            ObjectId idPoly3d     = ObjectId.Null;

            idPnts.Add(idCogoPntTAR);

            List <Handle> hPnts = new List <Handle>();

            hPnts.Add(idPnts[0].getHandle());
            hPnts.Add(idPnts[1].getHandle());

            ObjectId idPoly = ObjectId.Null;

            using (BaseObjs._acadDoc.LockDocument())
            {
                idPoly3d = BrkLine.makeBreakline(nameApp, "cmdRTd", out idPoly, idPnts);
            }

            Grading_Palette.gPalette.pGrading.cmdRTd_Default   = resRTd.opt1;
            Grading_Palette.gPalette.pGrading.cmdRTd_Distance  = resRTd.valD.ToString();
            Grading_Palette.gPalette.pGrading.cmdRTd_Elevation = resRTd.valE.ToString();
            Grading_Palette.gPalette.pGrading.cmdRTd_Slope     = resRTd.valS.ToString();

            Dict.setCmdDefault("cmdRTd", "cmdDefault", resRTd.opt1);
            Dict.setCmdDefault("cmdRTd", "Distance", resRTd.valD.ToString());
            Dict.setCmdDefault("cmdRTd", "Elevation", resRTd.valE.ToString());
            Dict.setCmdDefault("cmdRTD", "Slope", resRTd.valS.ToString());

            bool       exists          = false;
            PointGroup pntGroup        = CgPnt_Group.addPntGroup(pntDesc, out exists);
            ObjectId   idPntLabelStyle = Pnt_Style.getPntLabelStyle(CgPnts.setup(pntDesc));

            if (!exists)
            {
                try
                {
                    using (Transaction tr = BaseObjs.startTransactionDb())
                    {
                        pntGroup.UpgradeOpen();
                        pntGroup.PointLabelStyleId = idPntLabelStyle;

                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = pntDesc;
                        pntGroup.SetQuery(query);
                        tr.Commit();
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " cmdRTD.cs: line: 343");
                }
            }
        }