Exemplo n.º 1
0
        public static void makeSurfaceBOT()
        {
            string strSurfaceName = "BOT";

            EW_CheckSurfaceStyles.checkSurfaceStyles(strSurfaceName);

            Surf.removeSurface("BOT");
            TinSurface objSurfaceBOT = Surf.addTinSurface("BOT", out exists);

            ObjectId idCivilPntGrp = CgPnt_Group.checkPntGroup("BOT");

            objSurfaceBOT.PointGroupsDefinition.AddPointGroup(idCivilPntGrp);

            SelectionSet objSSet = EW_Utility1.buildSSet13();

            ObjectId[]         idsBrksArray = objSSet.GetObjectIds();
            ObjectIdCollection idsBrks      = new ObjectIdCollection();

            foreach (ObjectId id in idsBrksArray)
            {
                idsBrks.Add(id);
            }

            objSurfaceBOT.BreaklinesDefinition.AddStandardBreaklines(idsBrks, 1.0, 0, 0, 0);

            ObjectId idLWPline = EW_Utility1.buildSSetGradingLim().GetObjectIds()[0];

            if (idLWPline != ObjectId.Null)
            {
                ObjectIdCollection ids = new ObjectIdCollection();
                ids.Add(idLWPline);
                objSurfaceBOT.BoundariesDefinition.AddBoundaries(ids, 1, Autodesk.Civil.SurfaceBoundaryType.Outer, true);
                objSurfaceBOT.Rebuild();
            }
            else
            {
                MessageBox.Show("GRADING LIMIT not found - OUTER BOUNDARY not added.");
            }
        }
Exemplo n.º 2
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.º 3
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.º 4
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.º 5
0
Arquivo: PF.cs Projeto: 15831944/EM
        doProcessFigures()
        {
            bool     exists     = false;
            ObjectId idDictHist = Dict.getNamedDictionary("HISTORY", out exists);

            if (exists)
            {
                bool         def    = true;
                bool         answer = false;
                PromptStatus ps     = UserInput.getUserInputYesNo("Command PF has been executed on this drawing - Continue?", def, out answer);
                if (ps == PromptStatus.OK)
                {
                    if (answer == false)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (BaseObjs._acadDocs.Count > 4)
            {
                bool         def    = false;
                bool         answer = false;
                PromptStatus ps     = UserInput.getUserInputYesNo(string.Format("There are {0} drawings open on this machine.  Do you wish to continue?", BaseObjs._acadDocs.Count.ToString()), def, out answer);
                if (ps == PromptStatus.OK)
                {
                    if (answer == false)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            string       JN          = string.Empty;
            string       TOP         = string.Empty;
            string       nameFile    = string.Empty;
            string       nameFileMod = string.Empty;
            ResultBuffer rb          = null;

            ObjectId idDictPPF2 = Dict.getNamedDictionary("PPF2", out exists);

            if (!exists)
            {
                Application.ShowAlertDialog("Dictionary PPF2 is missing - Breaklines will be named \'TEMP\'");

                string nameFull = BaseObjs.docFullName;
                JN  = BaseObjs.docName.Substring(0, 4);
                TOP = "TEMP";
            }
            else
            {
                using (BaseObjs._acadDoc.LockDocument())
                {
                    rb = Dict.getXRec(idDictPPF2, "strTOP");
                }

                TypedValue[] tvs = rb.AsArray();

                if (tvs.Length > 0)
                {
                    JN          = tvs[0].Value.ToString();
                    TOP         = tvs[1].Value.ToString();
                    nameFile    = tvs[2].Value.ToString();
                    nameFileMod = tvs[3].Value.ToString();
                }
            }

            AeccSurveyDocument survDoc   = BaseObjsCom.aeccSurvDoc;
            AeccSurveyProjects survProjs = survDoc.Projects;
            AeccSurveyProject  survProj  = null;

            try
            {
                foreach (AeccSurveyProject sProj in survProjs)
                {
                    if (sProj.Name == JN)
                    {
                        survProj = sProj;
                        survProj.Open();
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                //Application.ShowAlertDialog(ex.Message + " PF.cs: line: 146");
                BaseObjs.writeDebug(ex.Message + " PF.cs: line: 146");
            }

            AeccSurveyFigures survFigures = survProj.Figures;
            List <ObjectId>   idPolys3d   = new List <ObjectId>();
            List <Node3d>     nodes3d     = new List <Node3d>();

            foreach (AeccSurveyFigure figure in survFigures)
            {
                AeccSurveyFigureNodes nodes = figure.FigureNodes;

                foreach (AeccSurveyFigureNode node in nodes)
                {
                    Node3d node3d = new Node3d(node.X, node.Y, node.Z, node.Bulge);
                    nodes3d.Add(node3d);
                }

                ObjectId idPoly3d = buildPoly3dFromNodes(nodes3d);
                Layer.setLayer(idPoly3d, figure.Layer);
                idPolys3d.Add(idPoly3d);
            }

            survProj.Close();

            TransferObjs.transferObjects(idPolys3d, TemplateCONT, nameFileMod);
            TransferObjs.transferObjects(idPolys3d, TemplateTOPO, nameFile);

            string handleLastEnt = string.Empty;

            try
            {
                handleLastEnt = idPolys3d[idPolys3d.Count - 1].getHandle().ToString();
            }
            catch (System.Exception ex)
            {
                //Application.ShowAlertDialog(ex.Message + " PF.cs: line: 176");
                BaseObjs.writeDebug(ex.Message + " PF.cs: line: 176");
            }

            CgPnt_Group.deletePntGroup(Path.GetFileName(nameFileMod));

            rb = new ResultBuffer(new TypedValue(1005, handleLastEnt));

            Dict.addXRec(idDictHist, "lastENT", rb);
        }
Exemplo n.º 6
0
        stakePoints(object varStaBeg = null, object varStaEnd = null, object varSide = null, object varBegNum = null)
        {
            string    strClass = fStake.ClassObj;
            Alignment objAlign = null;

            try
            {
                objAlign = fStake.ACTIVEALIGN;
            }
            catch (System.Exception)
            {
                if (Stake_Algn.selectAlignment(ObjectId.Null))
                {
                    objAlign = fStake.ACTIVEALIGN;
                }
                else
                {
                    return;
                }
            }

            ObjectId idAlign = objAlign.ObjectId;

            fStake.STAKE_LAYER = fStake.cboOffset.Text + "-OS-" + objAlign.Name;

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            List <POI> varpoi = Stake_Table.resetPOI(idTable);

            fStake.POI_CALC = varpoi;

            fStake.objectID = objAlign.ObjectId;
            int intSide = 0;

            double dblStation = 0, dblOffset = 0;

            if ((varSide == null))
            {
                if (double.Parse(fStake.cboOffset.Text) != 0)
                {
                    PromptStatus ps;
                    Point3d      varPntPick = Pub.pnt3dO;
                    try
                    {
                        varPntPick = UserInput.getPoint("\nSelect side to place stake points: <ESC to Cancel>", out ps, osMode: 0);
                    }
                    catch (System.Exception)
                    {
                        return;

                        ;
                    }

                    idAlign.getAlignStaOffset(varPntPick, ref dblStation, ref dblOffset);
                    if (System.Math.Abs(dblOffset) > 10.0)
                    {
                        string       message     = string.Format("Point selected is more than 10' from Alignment: {0} Continue", objAlign.Name);
                        DialogResult varResponse = MessageBox.Show(message, "Confirm stakng target.", MessageBoxButtons.YesNo);

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                        else
                        {
                            if (dblOffset < 0)
                            {
                                intSide = -1;
                            }
                            else
                            {
                                intSide = 1;
                            }

                            fStake.Side = intSide;
                        }
                    }
                    else
                    {
                        if (dblOffset < 0)
                        {
                            intSide = -1;
                        }
                        else
                        {
                            intSide = 1;
                        }

                        fStake.Side = intSide;
                    }
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                intSide = int.Parse(varSide.ToString());
            }

            dblOffset = double.Parse(fStake.cboOffset.Text);
            string strName = fStake.NameStakeObject;

            var sortSta = from p in varpoi                              //sort stations
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            List <POI> varPOI_TOF = null;
            List <POI> varPOI_TOW = null;

            Profile objProfile = null;

            switch (strClass)
            {
            case "WTR":

                objProfile = Prof.getProfile(idAlign, "CPNT");

                break;

            case "WALL":
                for (int i = 0; i < varpoi.Count; i++)
                {
                    if (varpoi[i].Desc0 == "TOF")
                    {
                        varPOI_TOF.Add(varpoi[i]);
                    }
                    else if (varpoi[i].Desc0 == "TOW")
                    {
                        varPOI_TOW.Add(varpoi[i]);
                    }
                }
                break;

            default:

                objProfile = Prof.getProfile(idAlign, "STAKE");

                break;
            }

            List <POI> varPOI_TMP = new List <POI>();

            if (strClass == "WALL")
            {
                Stake_GetStationing.getStationing(ref varPOI_TOF, dblStaBeg, dblStaEnd);
                Stake_GetStationing.getStationing(ref varPOI_TOW, dblStaBeg, dblStaEnd);
                for (int i = 0; i < varPOI_TOF.Count; i++)
                {
                    varPOI_TMP.Add(varPOI_TOF[i]);
                }

                for (int j = 0; j < varPOI_TOW.Count; j++)
                {
                    varPOI_TMP.Add(varPOI_TOW[j]);
                }

                varpoi = varPOI_TMP;
            }
            else
            {
                Stake_GetCardinals.checkBegAndEndDesc(idAlign, ref varpoi);
                Stake_GetStationing.getStationing(ref varpoi, dblStaBeg, dblStaEnd);
            }

            poiTmp = new List <POI>();
            foreach (var p in sortSta)             //sort stations
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.POI_STAKED = new List <POI>();
            List <POI> varPOI_STAKE = new List <POI>();

            if (strClass == "BLDG")
            {
                varPOI_STAKE = fStake.POI_STAKE;
            }
            else
            {
                if ((varStaBeg == null))
                {
                    varPOI_STAKE = varpoi;
                }
                else
                {
                    for (int i = 0; i < varpoi.Count; i++)
                    {
                        if (varpoi[i].Station >= double.Parse(varStaBeg.ToString()) && varpoi[i].Station <= double.Parse(varStaEnd.ToString()))
                        {
                            varPOI_STAKE.Add(varpoi[i]);
                        }
                    }
                }
            }

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {
                Debug.Print(varPOI_STAKE[i].Station + " " + varPOI_STAKE[i].Desc0);
            }
            POI     poi = new POI();
            double  dblElev = 0, dblEasting = 0, dblNorthing = 0;
            string  strDesc = "", strOffset = "";
            Point3d dblPnt = Pub.pnt3dO;

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {             //**********PROCESS varPOI_STAKE*********************
                if (varPOI_STAKE[i].DescX == "")
                {
                    poi             = varPOI_STAKE[i];
                    poi.DescX       = varPOI_STAKE[i].Desc0;
                    varPOI_STAKE[i] = poi;
                }

                switch (varPOI_STAKE[i].ClassObj)
                {
                case "WALL":

                    if (varPOI_STAKE[i].Desc0 == "TOW")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOW;
                    }
                    else if (varPOI_STAKE[i].Desc0 == "TOF")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOF;
                    }

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        if (string.IsNullOrEmpty(strDesc))
                        {
                            strDesc = varPOI_STAKE[i].Desc0;
                        }

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }

                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "WTR":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0.Substring(0, 2))
                    {
                    case "TE":

                        if (varPOI_STAKE[i].Side == intSide)
                        {
                            set5x5(idAlign, dblElev, varPOI_STAKE[i].Station, dblOffset, intSide, strName, varPOI_STAKE[i].DescX);
                        }
                        else
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);

                            dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                            strOffset = dblOffset.ToString();

                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);
                        }

                        break;

                    case "AP":

                        switch (intSide)
                        {
                        case 1:
                            //right side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;

                        case -1:
                            //left side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;
                        }

                        break;

                    default:

                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();

                        double dblCrossingInv = 0;
                        string strCrossingInv = "";
                        if (varPOI_STAKE[i].CrossAlign != "")
                        {
                            if (varPOI_STAKE[i].CrossAlignInv != 0)
                            {
                                dblCrossingInv = System.Math.Round(varPOI_STAKE[i].CrossAlignInv, 2);
                                strCrossingInv = string.Format("{0} INV.", dblCrossingInv);
                            }
                            else
                            {
                                strCrossingInv = "";
                            }

                            ASCIIEncoding ascii = new ASCIIEncoding();

                            string strAlignDesc = string.Format("{0}{1}%%C PIPE {2}", varPOI_STAKE[i].CrossAlignSize, ascii.GetString(new Byte[] { (Byte)34 }), strCrossingInv);

                            setOffsetPoint(dblPnt, strOffset, strName, strAlignDesc, idAlign, varPOI_STAKE[i].Station);
                        }
                        else
                        {
                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);

                            if (varPOI_STAKE[i].Type != "")
                            {
                                setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Type, idAlign, varPOI_STAKE[i].Station, " INV=");
                            }
                        }

                        break;
                    }

                    break;

                case "CURB":
                case "FL":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        //          If strDesc = "" Then
                        //            strDesc = varPOI_Stake[i].Desc0
                        //          End If

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "ALIGN":
                case "SEWER":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    if (varPOI_STAKE[i].Desc0 == "BC")
                    {
                        setRadiusPoint(idAlign, varPOI_STAKE[i], varPOI_STAKE[i].Radius, strName);
                    }

                    try
                    {
                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                    }
                    catch (System.Exception)
                    {
                    }

                    dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                    strOffset = dblOffset.ToString();
                    setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Desc0, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        intUBnd       = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[intUBnd].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts   = new List <Point3d>();
            Point3d        pnt3d     = Pub.pnt3dO;
            uint           lngPntNum = 0;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                string varPntNum = varPOI_STAKED[p].PntNum;

                int intPos = varPntNum.IndexOf(" ");

                if (intPos != 0)
                {
                    lngPntNum = uint.Parse(varPntNum.Substring(0, intPos - 1));
                }
                else
                {
                    lngPntNum = uint.Parse(varPntNum);
                }

                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }
Exemplo n.º 7
0
        stakeGridPoints(ObjectId idAlign, List <POI> varPOI_STAKE, double staBeg = 0, double staEnd = 0, int side = 0, long begNum = 30000)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();
            double    dblStation = 0, dblOffset = 0;

            if ((side == 0))
            {
                if (double.Parse(fGrid.tbxOffsetH.Text) != 0)
                {
                    PromptStatus ps;
                    bool         escape = true;

                    Point3d varPntPick = UserInput.getPoint("Select side to place stake points: <ESC to Cancel>", Pub.pnt3dO, out escape, out ps, osMode: 8);
                    if (escape)
                    {
                        return;
                    }

                    objAlign.StationOffset(varPntPick.X, varPntPick.Y, ref dblStation, ref dblOffset);

                    if (System.Math.Abs(dblOffset) > 20.0)
                    {
                        DialogResult varResponse = MessageBox.Show(string.Format("\nPoint selected is more than 20' from Alignment: {0} \nContinue?", objAlign.Name, MessageBoxButtons.YesNo));

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                    }
                    if (dblOffset < 0)
                    {
                        side = -1;
                    }
                    else
                    {
                        side = 1;
                    }
                    fStake.Side = side;
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                fStake.Side = side;
            }

            fStake.STAKE_LAYER = fGrid.tbxOffsetH.Text + "-OS-" + objAlign.Name;

            dblOffset = double.Parse(fGrid.tbxOffsetH.Text);
            string strName = fStake.NameStakeObject;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.NextPntNum = lngPntNumBeg;

            CogoPointCollection cgPnts = CivilApplication.ActiveDocument.CogoPoints;

            fStake.POI_STAKED = new List <POI>();

            //**********PROCESS varPOI_STAKE*********************
            for (int i = 0; i <= varPOI_STAKE.Count; i++)
            {
                if (varPOI_STAKE[i].DescX == "")
                {
                    POI vPOI_STAKE = varPOI_STAKE[i];
                    vPOI_STAKE.DescX = vPOI_STAKE.Desc0;
                    varPOI_STAKE[i]  = vPOI_STAKE;
                }

                if (i == varPOI_STAKE.Count - 1)
                {
                    break;
                }

                double dblElev = varPOI_STAKE[i].Elevation;

                switch (varPOI_STAKE[i].Desc0)
                {
                case "AP":

                    switch (side)
                    {
                    case 1:
                        //right side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            //clockwise
                        }
                        else
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                        }

                        break;

                    case -1:
                        //left side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            //clockwise
                        }
                        else
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                        }

                        break;
                    }

                    break;

                default:

                    string strDesc = varPOI_STAKE[i].DescX;
                    double dblEasting = 0, dblNorthing = 0;
                    try
                    {
                        objAlign.PointLocation(varPOI_STAKE[i].Station, dblOffset * side, ref dblEasting, ref dblNorthing);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        try
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station - 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                        catch (IndexOutOfRangeException)
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station + 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                    }

                    Point3d dblPnt = new Point3d(dblEasting, dblNorthing, varPOI_STAKE[i].Elevation);

                    string strOffset = dblOffset.ToString();
                    Stake_Calc.setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        k             = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[k].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts = new List <Point3d>();
            Point3d        pnt3d   = Pub.pnt3dO;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);
            Draw.addPoly(dblPnts, fStake.STAKE_LAYER, 9);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }
Exemplo n.º 8
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");
                }
            }
        }