Ejemplo n.º 1
0
 addPntRawDescToGroup(string namePnt, string nameGroup)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 if (_pointGroups.Contains(nameGroup))
                 {
                     ObjectId   grpId              = _pointGroups[nameGroup];
                     PointGroup pntGrp             = (PointGroup)tr.GetObject(grpId, OpenMode.ForWrite);
                     StandardPointGroupQuery query = new StandardPointGroupQuery();
                     query.IncludeRawDescriptions = string.Format("{0}*", nameGroup);
                     pntGrp.SetQuery(query);
                     pntGrp.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 243", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 250", ex.Message));
     }
 }
        private void customizePointGroup(ObjectId id)
        {
            PointGroup            group = id.GetObject(OpenMode.ForWrite) as PointGroup;
            CustomPointGroupQuery query = new CustomPointGroupQuery();

            query.QueryString = "RawDescription='WELL*'";
            group.SetQuery(query);
            group.UseCustomClassification(_classification);
        }
        private void createPointGroup(string name, PointGroupQuery query)
        {
            if (_pointGroups.Contains(name))
            {
                return;
            }
            ObjectId   groupId = _pointGroups.Add(name);
            PointGroup group   = groupId.GetObject(OpenMode.ForRead)
                                 as PointGroup;

            group.SetQuery(query);
        }
Ejemplo n.º 4
0
        checkPntGroup(string pntDesc)
        {
            ObjectId   idPntGrp      = ObjectId.Null;
            ObjectId   idPntLblStyle = Pnt_Style.getPntLabelStyle(pntDesc);
            ObjectId   idPntStyle    = Pnt_Style.getPntStyle(pntDesc);
            PointGroup pntGrp        = null;

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                try
                {
                    if (_pointGroups.Contains(pntDesc))
                    {
                        idPntGrp = _pointGroups[pntDesc];
                        pntGrp   = (PointGroup)tr.GetObject(idPntGrp, OpenMode.ForWrite);
                    }
                    else
                    {
                        idPntGrp = _pointGroups.Add(pntDesc);
                        pntGrp   = (PointGroup)tr.GetObject(idPntGrp, OpenMode.ForWrite);
                    }

                    if (pntGrp != null)
                    {
                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = string.Format("{0}", pntDesc);
                        pntGrp.SetQuery(query);
                        pntGrp.PointLabelStyleId = idPntLblStyle;
                        pntGrp.PointStyleId      = idPntStyle;
                        pntGrp.Update();
                    }
                    else
                    {
                        return(ObjectId.Null);
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 289", ex.Message));
                }
                tr.Commit();
            }
            return(idPntGrp);
        }
        private void createPointGroup(string name,
                                      string includeRawDescription)
        {
            if (_pointGroups.Contains(name))
            {
                return;
            }
            ObjectId groupId = _pointGroups.Add(name);
            StandardPointGroupQuery query = new StandardPointGroupQuery();

            query.IncludeRawDescriptions = includeRawDescription;
            PointGroup group = groupId.GetObject(OpenMode.ForWrite)
                               as PointGroup;

            group.SetQuery(query);
            // NOTE:    Setting a description throws an exception. The
            //          issue is being researched by the API team.
            // group.Description = "Set a description";
        }
Ejemplo n.º 6
0
        addPntGroup(string nameGroup, out bool exists)
        {
            exists = false;
            PointGroup pntGrp = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    try
                    {
                        if (_pointGroups.Contains(nameGroup))
                        {
                            ObjectId grpId = _pointGroups[nameGroup];
                            pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                            exists = true;
                        }
                        else
                        {
                            exists = false;
                            ObjectId grpId = _pointGroups.Add(nameGroup);
                            pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                        }
                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = string.Format("{0}*", nameGroup);
                        pntGrp.SetQuery(query);
                        pntGrp.Update();
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 210", ex.Message));
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 217", ex.Message));
            }
            return(pntGrp);
        }
        public static void ImportJobPoints()
        {
            var      doc = AcApp.DocumentManager.MdiActiveDocument;
            Editor   ed  = doc.Editor;
            Database db  = doc.Database;

            var           jobNumber = Functions.GetJobNumber(doc);
            SelectionForm form      = new SelectionForm(jobNumber);
            var           ret       = AcApp.ShowModalDialog(form);

            if (ret == DialogResult.Cancel)
            {
                ed.WriteMessage("Job import canceled by user.");
                return;
            }
            else
            {
                ed.WriteMessage($"Import Job list: Count - {form.SelectedFiles.Count} | Filtered - {form.FilterPoints} | X-ref attach - {form.AttachXref}" + Environment.NewLine);
                List <List <C3DPoint> > pointList = IntFunctions.ProcessFiles(form.SelectedFiles);

                //Actually do the things
                using (Transaction trans = ed.Document.Database.TransactionManager.StartTransaction())
                {
                    List <CogoPoint> existingPoints = new List <CogoPoint> {
                    };
                    CogoPointCollection cogoPoints  = CivilApplication.ActiveDocument.CogoPoints;
                    foreach (var cogoPointObj in cogoPoints)
                    {
                        CogoPoint cogoPointItem = cogoPointObj.GetObject(OpenMode.ForWrite) as CogoPoint;
                        existingPoints.Add(cogoPointItem);
                    }

                    string confirmed = "";

                    for (int i = 0; i < pointList.Count; i++)
                    {
                        var points     = pointList[i];
                        int pointcount = 0;
                        foreach (var newPoint in points)
                        {
                            if (existingPoints.Where(pn => pn.PointNumber == newPoint.PointNumber).Count() == 0)
                            {
                                Point3d   point   = newPoint.Coordinate;
                                ObjectId  pointId = cogoPoints.Add(point, false);
                                CogoPoint cogop   = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
                                cogop.PointNumber    = newPoint.PointNumber;
                                cogop.RawDescription = newPoint.Decsription;
                                cogop.StyleId        = ObjectId.Null;
                                cogop.LabelStyleId   = ObjectId.Null;
                                existingPoints.Add(cogop);
                                confirmed += $"{newPoint.PointNumber}, ";
                                pointcount++;
                            }
                            else
                            {
                                /*if (points.Where(pn => pn.RawDescription == (string)newPoint[4]).Count() == 0)
                                 * {
                                 *  MessageBox.Show("A point with a conflicting point number was detected. You can renumber this.");
                                 * }
                                 * else
                                 * {
                                 *  MessageBox.Show("A point with a conflicting point number and description was detected. Ingoring a duplicate point");
                                 * }*/
                            }
                        }
                        //TODO: Add more fuctionality to point group.

                        string filename = Path.GetFileNameWithoutExtension(form.SelectedFiles[i]);
                        ed.WriteMessage($"Successfully imported {pointcount} points." + Environment.NewLine);
                        if (form.AttachXref)
                        {
                            string folder  = Path.GetDirectoryName(form.SelectedFiles[i]);
                            string CADFile = Path.Combine(folder, filename + ".dwg");
                            if (File.Exists(Path.Combine(folder, filename + ".dwg")))
                            {
                                //Getting the layer object
                                LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite);
                                if (!lt.Has("G-HH-XREF"))
                                {
                                    LayerTableRecord ltr = new LayerTableRecord
                                    {
                                        Name     = "G-HH-XREF",
                                        Color    = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 7),
                                        IsFrozen = false,
                                        ViewportVisibilityDefault = true
                                    };

                                    ObjectId ltId = lt.Add(ltr);
                                    trans.AddNewlyCreatedDBObject(ltr, true);
                                }

                                var xId = db.AttachXref(CADFile, filename);
                                if (xId.IsValid)
                                {
                                    var btr = (BlockTableRecord)trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                                    var br  = new BlockReference(Point3d.Origin, xId)
                                    {
                                        Layer = "G-HH-XREF"
                                    };
                                    btr.AppendEntity(br);
                                    trans.AddNewlyCreatedDBObject(br, true);
                                }
                            }
                            ed.WriteMessage($"Successfully attached {filename} CAD file." + Environment.NewLine);
                        }
                    }

                    PointGroupCollection pointGroups = CivilApplication.ActiveDocument.PointGroups;
                    string groupName = "Group Import " + DateTime.Now.ToString("MM-dd-yy");
                    if (!pointGroups.Contains(groupName))
                    {
                        ObjectId pointGroup           = pointGroups.Add(groupName);
                        StandardPointGroupQuery query = new StandardPointGroupQuery
                        {
                            IncludeNumbers = confirmed
                        };
                        PointGroup group = (PointGroup)pointGroup.GetObject(OpenMode.ForWrite);
                        group.SetQuery(query);
                    }

                    /*foreach (var newPoint in newPoints)
                     * {
                     *  if (points.Where(pn => pn.PointNumber == (uint)newPoint[0]).Count() == 0)
                     *  {
                     *      Point3d point = new Point3d((double)newPoint[2], (double)newPoint[1], (double)newPoint[3]);
                     *      ObjectId pointId = cogoPoints.Add(point, false);
                     *      CogoPoint cogop = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
                     *      cogop.PointNumber = (uint)newPoint[0];
                     *      cogop.RawDescription = (string)newPoint[4];
                     *      points.Add(cogop);
                     *  }
                     *  else
                     *  {
                     *      if (points.Where(pn => pn.RawDescription == (string)newPoint[4]).Count() == 0)
                     *      {
                     *          MessageBox.Show("A point with a conflicting point number was detected. You can renumber this.");
                     *      }
                     *      else
                     *      {
                     *          MessageBox.Show("A point with a conflicting point number and description was detected. Ingoring a duplicate point");
                     *      }
                     *  }
                     * }*/
                    object acad = AcApp.AcadApplication;
                    acad.GetType().InvokeMember("ZoomExtents", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, acad, null);
                    trans.Commit();
                }
            }

            Logging.LogEntry(jobNumber, "POINT IMPORT", "Points were added to drawing.");

            form.Dispose();
            ed.Regen();
        }
Ejemplo n.º 8
0
        public static void GroupCalcPoints()
        {
            Document      acDoc = AcApp.DocumentManager.MdiActiveDocument;
            Database      acDb  = acDoc.Database;
            Editor        adEd  = acDoc.Editor;
            CivilDocument cApp  = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;

            List <string> points  = new List <string> {
            };
            string pointStr       = "";
            string descriptionStr = "";

            // Get the purpose of the points
            PromptStringOptions pStrOpts = new PromptStringOptions("\nEnter the purpose: ")
            {
                AllowSpaces = true
            };
            PromptResult pRlt = adEd.GetString(pStrOpts);

            // If the string was empty (or null somehow)
            if (string.IsNullOrEmpty(pRlt.StringResult))
            {
                adEd.WriteMessage("\nThe string entered was empty, please try again."); return;
            }
            string purpose = pRlt.StringResult;

            //Selection method
            PromptKeywordOptions pKeyOpts = new PromptKeywordOptions("\nPlease select a method of point selection: ");

            pKeyOpts.Keywords.Add("List");
            pKeyOpts.Keywords.Add("Selection");
            pKeyOpts.Keywords.Add("Descriptions");
            pKeyOpts.Keywords.Default = "List";
            pKeyOpts.AllowNone        = true;

            pRlt = adEd.GetKeywords(pKeyOpts);
            string selType = pRlt.StringResult;

            switch (selType)
            {
            case "List":
            {
                pStrOpts = new PromptStringOptions("\nEnter the point range using dashes (-) and commas (,): ")
                {
                    AllowSpaces = true
                };
                pRlt = adEd.GetString(pStrOpts);
                if (string.IsNullOrEmpty(pRlt.StringResult))
                {
                    adEd.WriteMessage("\nThe string entered was empty, please try again."); return;
                }
                pointStr = pRlt.StringResult;

                break;
            }

            case "Selection":
            {
                TypedValue[] tvs = new TypedValue[]
                {
                    new TypedValue((int)DxfCode.Start, "AECC_COGO_POINT")
                };
                SelectionFilter       selFltr = new SelectionFilter(tvs);
                PromptSelectionResult acSSPrompt;
                acSSPrompt = adEd.GetSelection(selFltr);
                if (acSSPrompt.Status == PromptStatus.Cancel)
                {
                    adEd.WriteMessage("\nAction aborted."); return;
                }
                if (acSSPrompt.Value.Count < 1)
                {
                    adEd.WriteMessage("\nThe selectiond was empty, please try again."); return;
                }
                using (Transaction tr = acDb.TransactionManager.StartTransaction())
                {
                    foreach (var obj in acSSPrompt.Value.GetObjectIds())
                    {
                        CogoPoint pnt = (CogoPoint)obj.GetObject(OpenMode.ForRead);
                        points.Add(pnt.PointNumber.ToString());
                    }
                    points.Sort();
                }
                pointStr = BeautifyPointList(points);
                break;
            }

            case "Descriptions":
            {
                pStrOpts = new PromptStringOptions("\nEnter the raw descriptions including wildcards (*) and commas (,): ")
                {
                    AllowSpaces = true
                };
                pRlt = adEd.GetString(pStrOpts);
                if (string.IsNullOrEmpty(pRlt.StringResult))
                {
                    adEd.WriteMessage("\nThe string entered was empty, please try again."); return;
                }
                descriptionStr = pRlt.StringResult;

                break;
            }

            default:
            {
                MessageBox.Show($"The selected input for GroupCalc Command was not valid: {pRlt.StringResult}");
                return;
            }
            }
            if (string.IsNullOrEmpty(pointStr) && string.IsNullOrEmpty(descriptionStr))
            {
                adEd.WriteMessage("\nNo points were detected"); return;
            }
            using (Transaction tr = acDb.TransactionManager.StartTransaction())
            {
                //Establish points
                string groupName = $"[{DateTime.Now:MM-dd-yyyy}] {purpose.ToUpper()}";

                StandardPointGroupQuery query = new StandardPointGroupQuery();
                if (selType == "Descriptions")
                {
                    query.IncludeRawDescriptions = descriptionStr;
                }
                else
                {
                    query.IncludeNumbers = pointStr;
                }

                PointGroupCollection pointGroups = cApp.PointGroups;
                if (pointGroups.Contains(groupName))
                {
                    adEd.WriteMessage("\nThe point group already exists, edit the existing group or come up with another name...");
                    return;
                }
                ObjectId   groupId = pointGroups.Add(groupName);
                PointGroup group   = (PointGroup)groupId.GetObject(OpenMode.ForRead);
                group.SetQuery(query);
                tr.Commit();
            }
            adEd.WriteMessage("\nPoint group created successfully!");
        }
Ejemplo n.º 9
0
Archivo: cmdRL.cs Proyecto: 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");
                }
            }
        }
Ejemplo n.º 10
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");
                }
            }
        }