Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idAlign"></param>
        private void displayAlignEnts(ObjectId idAlign)
        {
            Alignment align = (Alignment)idAlign.GetObject(OpenMode.ForRead);

            BaseObjs.write(string.Format("\nAlignment Name: {0}", align.Name));
            EnumerateEntities(align);
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="align"></param>
 private void enumerateEntsById(Alignment align)
 {
     foreach (AlignmentEntity ent in align.Entities)
     {
         BaseObjs.write(string.Format("\n.. Entity ID: {0}", ent.EntityId));
         writeAlignData(ent);
     }
 }
Exemplo n.º 3
0
        private void btnBuildSlope_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Boolean boolOK      = false;
            string  surfTAR     = string.Empty;
            string  surfDES     = string.Empty;
            int     intInterval = Convert.ToInt32(tbxInterval.Text.ToString());

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

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

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

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

            int interval = int.Parse(strInterval);

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

            case "cmdSG":
                boolOK = Grading.Cmds.cmdSG.SG(B1Width, B1Slope, B2Width, B2Slope, slope, interval, surfTAR, surfDES, elev: elev);
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="align"></param>
        private void enumerateEntsByOrder(Alignment align)
        {
            AlignmentEntityCollection ents = align.Entities;

            for (int i = 0; i < ents.Count; i++)
            {
                AlignmentEntity ent = ents.GetEntityByOrder(i);
                BaseObjs.write(string.Format("\n.. Entity Sequence: {0}", i));
                writeAlignData(ent);
            }
        }
Exemplo n.º 5
0
        SSP()
        {
            ObjectId     idLine   = ObjectId.Null;
            Point3d      pnt3dInt = Pub.pnt3dO;
            PromptStatus ps       = PromptStatus.Cancel;

            try
            {
                Point3d pnt3d1 = UserInput.getPoint("\nSelect FIRST point: ", out ps, osMode: 8);
                if (pnt3d1 == Pub.pnt3dO)
                {
                    return;
                }

                ObjectId idCgPnt = Select.selectCogoPntAtPoint3d(pnt3d1);
                string   descPnt = idCgPnt.getCogoPntDesc();

                Point3d pnt3d2 = UserInput.getPoint("\nSelect SECOND point: ", out ps, osMode: 8);
                if (pnt3d2 == Pub.pnt3dO)
                {
                    return;
                }

                double distH = pnt3d1.getDistance(pnt3d2);
                double distV = pnt3d2.Z - pnt3d1.Z;

                double slp0 = distV / distH;

                idLine = Draw.addLine(pnt3d1, pnt3d2);

                BaseObjs.write(string.Format("Slope between points is: {0:P2}", slp0));

                double m1 = Pub.slp1;
                double m2 = Pub.slp2;

                UserInput.getUserInput("\nEnter slope from FIRST POINT: ", out m1, m1);
                if (m1 == -99.99)
                {
                    return;
                }
                UserInput.getUserInput("\nEnter slope from SECOND POINT: ", out m2, m2);
                if (m2 == -99.99)
                {
                    return;
                }

                Pub.slp1 = m1;
                Pub.slp2 = m2;

                m2 = -m2;

                idLine.delete();

                pnt3dInt = getSlopeIntercept(pnt3d1, pnt3d2, m1, m2);
                if (pnt3dInt == Pub.pnt3dO)
                {
                    return;
                }
                uint pntNum;
                pnt3dInt.setPoint(out pntNum, descPnt);
                Application.ShowAlertDialog(string.Format("The elevation of the slope\nintercept is {0:F2}", pnt3dInt.Z));
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdSSP.cs: line: 73");
            }
            finally
            {
                idLine.delete();
            }
        }
Exemplo n.º 6
0
        CreateProfileBySurface(string strName, ObjectId idAlign, double dblAlignOffset)
        {
            string strAlignName = Align.getAlignName(idAlign);

            //Dim idProfileStyle As ObjectId = Prof_Style.getProfileStyle("WALL")
            //Dim idStyleLabelSet As ObjectId = Prof_Style.getProfileLabelSetStyle("WALL")

            ObjectId idProfileStyle  = Prof_Style.getProfileStyle("Standard");
            ObjectId idStyleLabelSet = Prof_Style.getProfileLabelSetStyle("Standard");

            string strLayerName = string.Format("PROFILE-{0}", strAlignName);

            Alignment objAlignOff = null;

            if (dblAlignOffset != 0)
            {
                ObjectId idPoly    = Align.getAlignmentPoly(idAlign);
                ObjectId idPolyOff = Base_Tools45.Draw.addPolyOffset(idPoly, dblAlignOffset);

                strAlignName = string.Format("{0}_{1}_OFF", strAlignName, dblAlignOffset);
                objAlignOff  = Align.addAlignmentFromPoly(strAlignName, strLayerName, idPolyOff, "Thienes_Proposed", "Thienes_Proposed", true);
            }

            string strSurface = "";

            if (strName == "CPNT")
            {
                strSurface = "CPNT-ON";
            }
            else
            {
                strSurface = strName;
            }

            TinSurface objSurface = null;

            try
            {
                bool exists = false;
                objSurface = Surf.getTinSurface(strSurface, out exists);
            }
            catch (Autodesk.AutoCAD.Runtime.Exception)
            {
                System.Windows.Forms.MessageBox.Show(strSurface + " is not available.");
            }

            Profile objProfile = null;


            if (dblAlignOffset != 0)
            {
                Prof.removeProfile(objAlignOff.ObjectId, strName);
            }
            else
            {
                Prof.removeProfile(idAlign, strName);
            }
            ObjectId idStyle = default(ObjectId);
            ObjectId idLabel = default(ObjectId);

            using (BaseObjs._acadDoc.LockDocument())
            {
                using (Transaction TR = BaseObjs.startTransactionDb())
                {
                    ObjectId idSurf  = objSurface.ObjectId;
                    ObjectId idLayer = Layer.manageLayers(strLayerName);
                    string   mess    = string.Format("WALL,{0},{1},{2},{3},{4}", idAlign, idSurf, idLayer, idStyle, idLabel);
                    BaseObjs.write(mess);

                    try
                    {
                        objProfile       = Prof.addProfileBySurface(strName, idAlign, idSurf, idLayer, idProfileStyle, idStyleLabelSet);
                        objProfile.Layer = strLayerName;
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception exp)
                    {
                        Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog(exp.Message);
                    }

                    TR.Commit();
                }
            }


            if (dblAlignOffset != 0)
            {
                ProfilePVI      objPvi      = null;
                List <PNT_DATA> varPnt_Data = new List <PNT_DATA>();
                PNT_DATA        vPnt_Data   = new PNT_DATA();

                for (int i = 0; i <= objProfile.PVIs.Count; i++)
                {
                    objPvi           = objProfile.PVIs[i];
                    vPnt_Data.STA    = objPvi.Station;
                    vPnt_Data.z      = objPvi.Elevation;
                    vPnt_Data.OFFSET = dblAlignOffset;
                    varPnt_Data.Add(vPnt_Data);
                }

                fWall1.PNTSDESIGN = varPnt_Data;
                return(objAlignOff.ObjectId);
            }
            return(idAlign);
        }
Exemplo n.º 7
0
        getPoints(string strFunction)
        {
            ObjectId  idPnt  = default(ObjectId);
            CogoPoint objPnt = default(CogoPoint);

            double dblStation = 0;
            double dblOffset  = 0;

            List <PNT_DATA> varPNT_DATA = new List <PNT_DATA>();
            PNT_DATA        vPNT_DATA   = new PNT_DATA();

            Alignment objAlign = fWall1.ACTIVEALIGN;

            BaseObjs.write(string.Format("\nSelect {0} Points adjacent to Alignment: ", strFunction));

            do
            {
                try {
                    idPnt = wne.getNestedPoint("Select Point <ESC to exit>: \n");
                } catch (Autodesk.AutoCAD.Runtime.Exception) {
                    break;
                }

                if ((idPnt == ObjectId.Null))
                {
                    return;
                }

                objPnt = (CogoPoint)idPnt.getEnt();
                try {
                    objAlign.StationOffset(objPnt.Easting, objPnt.Northing, ref dblStation, ref dblOffset);
                } catch (Autodesk.Civil.PointNotOnEntityException) {
                    dblStation = 0.0;
                }

                vPNT_DATA.DESC   = objPnt.RawDescription;
                vPNT_DATA.NUM    = objPnt.PointNumber;
                vPNT_DATA.x      = objPnt.Easting;
                vPNT_DATA.y      = objPnt.Northing;
                vPNT_DATA.z      = System.Math.Round(objPnt.Elevation, 3);
                vPNT_DATA.ALIGN  = objAlign.Name;
                vPNT_DATA.STA    = System.Math.Round(dblStation, 2);
                vPNT_DATA.OFFSET = System.Math.Round(dblOffset, 2);

                varPNT_DATA.Add(vPNT_DATA);
            } while (true);

            dynamic staPNT_DATA = from data in varPNT_DATA
                                  orderby data.STA
                                  select data;

            List <PNT_DATA> p = new List <PNT_DATA>();

            foreach (var d in staPNT_DATA)
            {
                p.Add(d);
            }

            if (strFunction == "EXIST")
            {
                fWall1.PNTSEXIST = varPNT_DATA;
            }
            else if (strFunction == "DESIGN")
            {
                fWall1.PNTSDESIGN = varPNT_DATA;
            }
        }
Exemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ent"></param>
 private void writeAlignData(AlignmentEntity ent)
 {
     BaseObjs.write(string.Format("\n.. Entity Class: {0}", ent.GetType()));
     BaseObjs.write(string.Format("\n.. Entity Type: {0}", ent.EntityType));
     BaseObjs.write(string.Format("\n.. Subentities: {0}", ent.SubEntityCount));
 }
Exemplo n.º 9
0
        MCE(List <ObjectId> idsPnts = null, string result = "")
        {
            double elev = 0.0;

            if (idsPnts == null)
            {
                idsPnts = new List <ObjectId>();
                Type         type;
                TypedValue[] tvs = new TypedValue[5];
                tvs.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"), 0);

                type = typeof(Polyline3d);
                tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 1);

                type = typeof(CogoPoint);
                tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 2);

                type = typeof(Polyline);
                tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 3);

                tvs.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"), 4);

                SelectionSet ss = Select.buildSSet(tvs, false);
                if (ss == null)
                {
                    return;
                }
                ObjectId[] ids = ss.GetObjectIds();

                List <string> descPnts = new List <string>();
                string        descPnt  = "";
                try
                {
                    if (ss.Count == 1)
                    {
                        string t = ids[0].getType().ToUpper();
                        if (t == "POLYLINE" || t == "POLYLINE2D" || t == "POLYLINE3D")
                        {
                            Point3dCollection pnts3d = ids[0].getCoordinates3d();
                            tvs = new TypedValue[1];
                            tvs.SetValue(new TypedValue((int)DxfCode.Start, "AECC_COGO_POINT"), 0);
                            SelectionFilter       filter = new SelectionFilter(tvs);
                            PromptSelectionResult psr    = BaseObjs._editor.SelectCrossingPolygon(pnts3d, filter);
                            if (psr.Status == PromptStatus.OK)
                            {
                                ids = psr.Value.GetObjectIds();
                                foreach (ObjectId id in ids)
                                {
                                    idsPnts.Add(id);
                                    descPnt = id.getCogoPntDesc();
                                    if (!descPnts.Contains(descPnt))
                                    {
                                        descPnts.Add(descPnt);
                                    }
                                }
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            idsPnts.Add(ids[0]);
                            string message = string.Format("\nElev = {0:F2}", ids[0].getCogoPntElevation());
                            BaseObjs._editor.WriteMessage(message);
                        }
                    }
                    else if (ss.Count > 1)
                    {
                        foreach (ObjectId id in ids)
                        {
                            if (id.getType().ToUpper() == "COGOPOINT")
                            {
                                idsPnts.Add(id);
                                descPnt = id.getCogoPntDesc();
                                if (!descPnts.Contains(descPnt))
                                {
                                    descPnts.Add(descPnt);
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " cmdMCE.cs: line: 98");
                }

                int  len    = descPnts.Count;
                bool escape = true;

                if (len > 1)
                {
                    string prompt    = "";
                    string keyWords1 = "";      // not used - couldn't
                    string keyWords2 = "";
                    string desWords  = "";
                    string desWords2 = "";

                    try
                    {
                        List <string> nameGrp = new List <string>();
                        List <CgPnt_Group.pntGroupParams> pntGroups = new List <CgPnt_Group.pntGroupParams>();
                        CgPnt_Group.pntGroupParams        pntGrpSymCol;
                        for (int i = 0; i < len; i++)
                        {
                            pntGroups.Add(CgPnt_Group.pntGroups.Find(s => s.name == descPnts[i]));
                        }

                        foreach (CgPnt_Group.pntGroupParams p in pntGroups)
                        {
                            keyWords1 = string.Format("{0}{1} ", keyWords1, p.key);
                            desWords  = string.Format("{0}{1} ", desWords, p.name);
                        }

                        keyWords1 = keyWords1.Trim();
                        keyWords2 = keyWords1.Replace(" ", "/");
                        desWords2 = desWords.Trim();

                        keyWords2 = string.Format("[{0}]", keyWords2);
                        desWords  = string.Format("[{0}]", desWords2);

                        prompt = string.Format("\n** WARNING ** Multiple Point Groups in Selection: {0} Found!", desWords);
                        BaseObjs.write(prompt);

                        desWords = desWords.Replace(" ", "/");

                        string resDesc = pntGroups[0].name;
                        string resKey  = pntGroups[0].key;

                        pntGrpSymCol = CgPnt_Group.pntGroups.Find(s => s.name == resDesc);

                        prompt = string.Format("\nSelect Target Point Group from List: {0} <{1}> {2}", desWords, pntGrpSymCol.name, desWords);

                        escape = UserInput.getUserInputKeyword(resDesc, out resDesc, prompt, desWords2);

                        pntGrpSymCol = CgPnt_Group.pntGroups.Find(s => s.name == resDesc);

                        List <ObjectId> idsT = new List <ObjectId>();
                        foreach (ObjectId id in idsPnts)
                        {
                            if (id.getCogoPntDesc() == pntGrpSymCol.name)
                            {
                                idsT.Add(id);
                            }
                        }
                        idsPnts = idsT;
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdMCE.cs: line: 161");
                    }
                }

                escape = UserInput.getUserInput("\nEnter new elevation (or +/- change) for points: ", out result, false);

                if (!escape)
                {
                    if (!double.TryParse(result.Substring(0, 1), out elev))
                    {
                        if (result.Substring(0, 1) != "+" && result.Substring(0, 1) != "-")
                        {
                            Application.ShowAlertDialog("Error in input.  Please try again...");
                            return;
                        }
                    }
                }
            }


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

            try
            {
                foreach (ObjectId id in idsPnts)
                {
                    double elev0 = id.getCogoPntElevation();
                    elev = id.setPointElevation(result);
                    ResultBuffer rb = id.getXData(null);
                    if (rb != null)
                    {
                        TypedValue[]        tvsAll   = rb.AsArray();
                        List <string>       nameApps = null;
                        List <TypedValue[]> lstTVs   = xData.parseXData(tvsAll, out nameApps);

                        foreach (TypedValue[] tvsPnt in lstTVs)
                        {
                            string nameApp = tvsPnt[0].Value.ToString();
                            switch (nameApp)
                            {
                            case apps.lnkBrks:
                            case apps.lnkBrks2:
                                Grading_Utility.objPnt_Modified(id, nameApp, ref idsPoly3dSLP);                   //update breaklines
                                break;

                            case apps.lnkCO:
                                Grading_Utility.updatePntCalloutElev(elev, tvsPnt);              //update callouts
                                break;

                            case apps.lnkDP:
                                if (tvsPnt[2].Value.ToString() == "Primary")
                                {
                                    Grading_Utility.updatePntCalloutElev(elev, tvsPnt);         //update callouts
                                }
                                break;

                            case apps.lnkGS:
                                System.Diagnostics.Debug.Print(id.getHandle().ToString());
                                Grading_Utility.updateGS(tvsPnt, "cmdMCE");                      //update GS0
                                break;

                            case apps.lnkMNP:
                                double dZ = elev - elev0;
                                PipeNetwork.updatePipes(dZ, elev0, id);

                                break;
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdMCE.cs: line: 233");
            }

            if (idsPoly3dSLP.Count > 0)
            {
                foreach (ObjectId idPoly3dSLP in idsPoly3dSLP)
                {
                    Grading_UpdateSG.updateSG(idPoly3dSLP);
                }
            }
        }
Exemplo n.º 10
0
        modAdjacentAreas_Subtract(ObjectId idBldgOX2, bool boolFirstPass)
        {
            if (pub.boolDebug)
            {
                BaseObjs.write("Select _XX- Area");
                objSSet = EW_Utility1.buildSSet20();   //select on screen

                boolFirstPass = true;
            }
            else
            {
                if (boolFirstPass)
                {
                    objSSet = EW_Utility1.buildSSet0();                                //get _XX-*
                }
                else
                {
                    objSSet = EW_Utility1.buildSSet19();                                //get OX-AREAS-2d - select all
                }
            }

            ObjectId[] ids = objSSet.GetObjectIds();

            ObjectId idAreaCopy = ObjectId.Null;

            List <ObjectId> idsElemOX2  = new List <ObjectId>();
            List <ObjectId> idsElemArea = new List <ObjectId>();

            for (int i = 0; i < ids.Length; i++)
            {
                ObjectId id = ids[i];

                Polyline objArea = (Polyline)id.getEnt();
                objArea.checkIfClosed();

                string strLayer = objArea.Layer;

                switch (strLayer)
                {
                case "_XX-FLOOR SLAB_A":
                case "_XX-FLOOR SLAB_B":
                case "_XX-FLOOR SLAB_C":
                case "_XX-OFFICE SLAB AND SAND":
                    //, "_XX-BUILDING ADJACENT LANDSCAPING"

                    break;

                default:

                    if (boolFirstPass)
                    {
                        idAreaCopy = Conv.processBndry(objArea.copy());
                        idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");
                    }
                    else
                    {
                        idAreaCopy = id;
                    }

                    if (pub.boolDebug)
                    {
                        idAreaCopy.changeProp(LineWeight.LineWeight050, clr.yel);
                    }

                    List <Point3d> varPntsInt = idBldgOX2.intersectWith(idAreaCopy, extend.none);

                    if (varPntsInt.Count == 0)
                    {
                        TypedValue[] tvs = new TypedValue[2] {
                            new TypedValue(1001, "OX-Layer"),
                            new TypedValue(1000, strLayer)
                        };

                        idAreaCopy.setXData(tvs, "OX-Layer");
                    }
                    else
                    {
                        idsElemOX2.Add(idBldgOX2);

                        ObjectId idRegionOX2 = idBldgOX2.addRegion();
                        idRegionOX2.changeProp(LineWeight.LineWeight050, clr.c180);
                        idAreaCopy.checkIfClosed();
                        idAreaCopy.changeProp(LineWeight.LineWeight200, clr.cyn);

                        ObjectId idRegionArea = idAreaCopy.addRegion();
                        idRegionArea.changeProp(LineWeight.LineWeight050, clr.blu);

                        Region objRegionOX2  = (Region)idBldgOX2.getEnt();
                        Region objRegionArea = (Region)idRegionArea.getEnt();

                        objRegionArea.BooleanOperation(BooleanOperationType.BoolSubtract, objRegionOX2);

                        if (objRegionArea.Area > 0)
                        {
                            DBObjectCollection varExplodeObjs = new DBObjectCollection();
                            objRegionArea.Explode(varExplodeObjs);

                            Entity objEnt = (Entity)varExplodeObjs[0];

                            if (objEnt is Region)
                            {
                                idRegionArea.delete();

                                for (int j = 0; j < varExplodeObjs.Count; j++)
                                {
                                    Region             objRegion = (Region)varExplodeObjs[j];
                                    DBObjectCollection varEnts   = new DBObjectCollection();
                                    objRegion.Explode(varEnts);
                                    objRegion.ObjectId.delete();
                                    idAreaCopy = varEnts.rebuildPoly();
                                    idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");

                                    TypedValue[] tvs = new TypedValue[3] {
                                        new TypedValue(1001, "OX-Layer"),
                                        new TypedValue(1000, strLayer),
                                        new TypedValue(1000, "remaining after subtraction of OX")
                                    };

                                    idAreaCopy.setXData(tvs, "OX-Layer");
                                }
                            }
                            else
                            {
                                idRegionArea.delete();
                                idAreaCopy = varExplodeObjs.rebuildPoly();
                                idAreaCopy.changeProp(clr.byl, "OX-AREAS-2d");

                                TypedValue[] tvs = new TypedValue[3] {
                                    new TypedValue(1001, "OX-Layer"),
                                    new TypedValue(1000, strLayer),
                                    new TypedValue(1000, "remaining after subtraction of OX")
                                };

                                idAreaCopy.setXData(tvs, "OX-Layer");
                            }
                        }
                        else
                        {
                        }
                    }
                    break;
                }
            }
            return;
        }
Exemplo n.º 11
0
        ProcessCmds(string nameCmd)
        {
            ObjectId idCgPnt1 = ObjectId.Null;
            ObjectId idCgPnt2 = ObjectId.Null;
            ObjectId idLDR    = ObjectId.Null;

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

            Point3d      pnt3d, pnt3d1, pnt3d2, pnt3dIns, pnt3dLdr1, pnt3dLdr2;
            string       prompt;
            const string prompt1 = "Pick the Arrow Starting Point: ";

            string resElev = string.Empty, resElev1, resElev2, resTop = string.Empty, resBot = string.Empty, resBot2 = string.Empty,
                   resSlab, resCurb, resPrefix, resSuffix, resDesc, resElevSuf = string.Empty;

            double       deltaZ = 0.0;
            double       pi     = System.Math.PI;
            bool         escape = true;
            PromptStatus ps     = PromptStatus.Cancel;

            switch (nameCmd)
            {
            case "cmdCF0":
                resElev1 = UserInput.getCogoPoint(prompt1, out idCgPnt1, Pub.pnt3dO, osMode: 8);
                resTop   = string.Format("{0} TC", resElev1);
                resBot   = "0\" CF";
                pnt3d    = idCgPnt1.getCogoPntCoordinates();
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                idsCgPnts.Add(idCgPnt1);
                Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTop, resBot);
                break;

            case "cmdDEP":
            case "cmdGQ":
            case "cmdWQ":
                idCgPnt1 = CgPnt.selectCogoPointByNode("\nSelect Low Point : ", osMode: 8);
                if (idCgPnt1 == null)
                {
                    return;
                }
                pnt3d1 = idCgPnt1.getCogoPntCoordinates();

                idCgPnt2 = CgPnt.selectCogoPointByNode("\nSelect High Point : ", osMode: 8);
                if (idCgPnt2 == null)
                {
                    return;
                }
                pnt3d2 = idCgPnt2.getCogoPntCoordinates();
                if (pnt3d2 == Pub.pnt3dO)
                {
                    return;
                }
                deltaZ = System.Math.Abs(pnt3d1.Z - pnt3d2.Z);
                switch (nameCmd)
                {
                case "cmdDEP":
                    resTop = "DEEPEN";
                    resBot = string.Format("PANEL= {0:F2}'", deltaZ);
                    break;

                case "cmdGQ":
                    resTop = "CONSTRUCT GRAVITY WALL";
                    string resDelta = "0.50";
                    escape = UserInput.getUserInputDoubleAsString("\nEnter Additional Height in feet: ", out resDelta, resDelta);
                    if (escape)
                    {
                        return;
                    }
                    resBot = string.Format("H= {0:F2}'", deltaZ + double.Parse(resDelta));
                    break;

                case "cmdWQ":
                    resTop = "CONSTRUCT RETAINING WALL";
                    resBot = string.Format("H= {0:F2}'", deltaZ + 1.5);
                    break;
                }
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d2, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d2, 0.09, "ARROW", 7);

                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                idsCgPnts = new List <ObjectId> {
                    idCgPnt1,
                    idCgPnt2
                };

                Txt.addLdrText(nameCmd, apps.lnkDP, idLDR, idsCgPnts, resTop, resBot);
                break;

            case "cmdFF":
            case "cmdFFD":
                resElev1 = UserInput.getCogoPoint(prompt1, out idCgPnt1, Pub.pnt3dO, osMode: 8);
                pnt3d    = idCgPnt1.getCogoPntCoordinates();
                resTop   = string.Format("{0} FF", resElev1);
                if (nameCmd == "cmdFFD")
                {
                    idLDR = ObjectId.Null;
                }
                else if (nameCmd == "cmdFF")
                {
                    //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                    idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                    if (idLDR == ObjectId.Null)
                    {
                        return;
                    }
                }
                idsCgPnts.Add(idCgPnt1);
                //resSlab = Dict.getCmdDefault(nameCmd, "resSlab");
                resSlab = "0.50";                                                                                               //per M. Roberts 6/21/2015
                escape  = UserInput.getUserInputDoubleAsString("\nEnter Slab Thickness:", out resSlab, resSlab);
                if (escape)
                {
                    if (idLDR != ObjectId.Null)
                    {
                        idLDR.delete();
                    }
                    return;
                }
                deltaZ = double.Parse(resSlab);
                resBot = string.Format("{0} PAD", (double.Parse(resElev1) - deltaZ).ToString("F2"));
                Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTop, resBot, "", deltaZ);
                break;

            case "cmdFL":
            case "cmdFLX":
                resElev1 = UserInput.getCogoPoint(prompt1, out idCgPnt1, Pub.pnt3dO, osMode: 8);
                if (resElev1 == string.Empty)
                {
                    return;
                }
                pnt3d = idCgPnt1.getCogoPntCoordinates();
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                idsCgPnts.Add(idCgPnt1);

                resBot = Dict.getCmdDefault(nameCmd, "resBot");
                if (resBot == string.Empty)
                {
                    resBot = "FL";
                }

                prompt = string.Format("\nEnter Bottom Text: FL/FS/Other <{0}> [FL/FS]:", resBot);
                escape = UserInput.getUserInputKeyword(resBot, out resBot, prompt, "FL FS");
                if (escape)
                {
                    idLDR.delete();
                    return;
                }

                if (nameCmd == "cmdFLX")
                {
                    resTop = string.Format("({0})", resElev1);
                }
                else
                {
                    resTop = resElev1;
                }

                Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTop, resBot);
                Dict.setCmdDefault(nameCmd, "resBot", resBot);

                break;

            case "cmdG":
            case "cmdGX":
                resElev1 = UserInput.getCogoPoint(prompt1, out idCgPnt1, Pub.pnt3dO, osMode: 8);
                if (resElev1 == string.Empty)
                {
                    return;
                }
                pnt3d = idCgPnt1.getCogoPntCoordinates();
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                idsCgPnts.Add(idCgPnt1);

                resBot = Dict.getCmdDefault(nameCmd, "resBot");
                if (resBot == string.Empty)
                {
                    resBot = "FL";
                }

                prompt = string.Format("\nBottom Label is: FL/FS/Other <{0}>: [FL/FS]: ", resBot);
                escape = UserInput.getUserInputKeyword(resBot, out resBot, prompt, "FL FS");
                if (escape)
                {
                    idLDR.delete();
                    return;
                }

                resTop = Dict.getCmdDefault(nameCmd, "resTop");
                if (resTop == "")
                {
                    resTop = "TC";
                }
                prompt = string.Format("\nTop Label is: TC/Other <{0}>: [TC]: ", resTop);
                escape = UserInput.getUserInputKeyword(resTop, out resTop, prompt, "TC");
                if (escape)
                {
                    idLDR.delete();
                    return;
                }

                resCurb = Dict.getCmdDefault(nameCmd, "resCurb");
                if (resCurb == "")
                {
                    resCurb = "0.50";
                }
                escape = UserInput.getUserInputDoubleAsString(string.Format("\nEnter Offset for {0}", resTop), out resCurb, resCurb);
                if (escape)
                {
                    idLDR.delete();
                    return;
                }

                resElev2 = string.Format("{0:F2}", double.Parse(resElev1) + double.Parse(resCurb));
                string resBotMod = string.Format("{0}{1}", resElev1, resBot);
                string resTopMod = string.Format("{0}{1}", resElev2, resTop);
                if (nameCmd == "cmdGX")
                {
                    resBotMod = string.Format("({0})", resBotMod);
                    resTopMod = string.Format("({0})", resTopMod);
                }

                Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTopMod, resBotMod, deltaZ: double.Parse(resCurb));
                Dict.setCmdDefault(nameCmd, "resTop", resTop);
                Dict.setCmdDefault(nameCmd, "resBot", resBot);
                Dict.setCmdDefault(nameCmd, "resCurb", resCurb);
                break;

            case "cmdGS":
            case "cmdGS0":
            case "cmdGS2":
            case "cmdGS3":
            case "cmdGSE":
            case "cmdGSS":
            case "cmdGSX":
            case "cmdSL":
            case "cmdSS":
                try
                {
                    if (nameCmd == "cmdGSE")
                    {
                        pnt3d1 = UserInput.getPoint("\nSelect First Endpoint: ", out ps, osMode: 1);
                        if (pnt3d1 == Pub.pnt3dO)
                        {
                            return;
                        }
                        pnt3d2 = UserInput.getPoint("\nSelect Second Endpoint: ", out ps, osMode: 1);
                        if (pnt3d2 == Pub.pnt3dO)
                        {
                            return;
                        }
                    }
                    else if (nameCmd == "cmdGSX")
                    {
                        resElev1 = UserInput.getPoint("\nSelect First Point: ", out idCgPnt1, out pnt3d, Pub.pnt3dO, osMode: 8);
                        if (resElev1 == string.Empty)
                        {
                            return;
                        }
                        if (idCgPnt1 == ObjectId.Null)
                        {
                            pnt3d1 = pnt3d;
                        }
                        else
                        {
                            pnt3d1 = idCgPnt1.getCogoPntCoordinates();
                        }

                        resElev2 = UserInput.getPoint("\nSelect Second Point: ", out idCgPnt2, out pnt3d, pnt3d1, osMode: 8);
                        if (resElev2 == string.Empty)
                        {
                            return;
                        }
                        if (idCgPnt2 == ObjectId.Null)
                        {
                            pnt3d2 = pnt3d;
                        }
                        else
                        {
                            pnt3d2 = idCgPnt2.getCogoPntCoordinates();
                        }
                    }
                    else
                    {                                                          //cmd GS, GS0, GS2, GS3, GSE, GSS, GSX, SS, SL
                        resElev1 = UserInput.getCogoPoint("\nSelect First Point: ", out idCgPnt1, Pub.pnt3dO, osMode: 8);
                        if (resElev1 == string.Empty)
                        {
                            return;
                        }
                        pnt3d1 = idCgPnt1.getCogoPntCoordinates();

                        resElev2 = UserInput.getCogoPoint("\nSelect Second Point: ", out idCgPnt2, pnt3d1, osMode: 8);
                        if (resElev2 == string.Empty)
                        {
                            return;
                        }
                        pnt3d2 = idCgPnt2.getCogoPntCoordinates();
                    }

                    double scale = Misc.getCurrAnnoScale();
                    double angle = pnt3d1.getDirection(pnt3d2);
                    double dxy   = pnt3d1.getDistance(pnt3d2);
                    double dz    = pnt3d2.Z - pnt3d1.Z;
                    double slope = dz / dxy;

                    Pub.Slope = slope;
                    Pub.dZ    = dz;

                    if (pnt3d2.Z > pnt3d1.Z)                                        //nominal case is sloping downhill - arrow points to lower grade
                    {
                        angle = angle + System.Math.PI;
                    }

                    string message = string.Format("\nHorz = {0:F4} : Vert = {1:F4} : R = {2:F2}%\r", dxy, dz, slope * 100);
                    BaseObjs._editor.WriteMessage(message);

                    ps       = PromptStatus.Cancel;
                    pnt3dIns = UserInput.getPoint("\nPick Insertion Point for Slope: ", out ps, osMode: 0);
                    if (ps == PromptStatus.Cancel)
                    {
                        return;
                    }
                    if (ps == PromptStatus.None)
                    {
                        pnt3dIns = pnt3d1.getMidPoint2d(pnt3d2);
                    }

                    double factor = 0.0;
                    slope = System.Math.Abs(slope);
                    switch (nameCmd)
                    {
                    case "cmdGS":
                        resElev = string.Format("R={0:F2}%", slope * 100);
                        factor  = 3.8;
                        break;

                    case "cmdGSE":
                        resElev = string.Format("R={0:F4}%", slope * 100);
                        factor  = 3.8;
                        break;

                    case "cmdGS0":
                        resElev = string.Format("{0:F0}%", Base_Tools45.Math.roundUP3(slope) * 100);
                        factor  = 1.5;
                        break;

                    case "cmdGS2":
                        resElev = string.Format("R={0:F2}%", slope * 100);
                        factor  = 3.0;
                        break;

                    case "cmdGS3":
                        resElev = string.Format("{0:F0}%", Base_Tools45.Math.roundUP3(slope) * 100);
                        factor  = 1.2;
                        break;

                    case "cmdGSS":
                        resElev = string.Format("{0:F1}%", slope * 100);
                        factor  = 2.0;
                        break;

                    case "cmdGSX":
                        resElev = string.Format("(R={0:F2}%)", slope * 100);
                        factor  = 3.8;
                        break;

                    case "cmdSL":
                        resElev = string.Format("S={0:F4}", slope);
                        factor  = 3.0;
                        break;
                    }
                    pnt3dLdr1 = pnt3dIns.traverse(angle, 0.09 * scale * factor);
                    pnt3dLdr2 = pnt3dIns.traverse(angle + pi, 0.09 * scale * factor);

                    Point3dCollection pnts3dLdr = new Point3dCollection {
                        pnt3dLdr1,
                        pnt3dLdr2
                    };
                    ObjectId idLayer = Layer.manageLayers("ARROW");
                    idLDR = Ldr.addLdr(pnts3dLdr, idLayer, 0.09, 0.0, clr.byl, ObjectId.Null);

                    idsCgPnts = new List <ObjectId> {
                        idCgPnt1,
                        idCgPnt2
                    };

                    List <Point3d> pnts3d = new List <Point3d> {
                        pnt3d1, pnt3d2
                    };

                    if (nameCmd == "cmdGS3")
                    {
                        Txt.addLdrText(nameCmd, apps.lnkGS, idLDR, idsCgPnts, resElev, "", "", 0.0, 0.7, pnts3dX: pnts3d);
                    }
                    else
                    {
                        Txt.addLdrText(nameCmd, apps.lnkGS, idLDR, idsCgPnts, resElev, "", "", 0.0, pnts3dX: pnts3d);                                          //pnts3d added to allow using something other than a CogoPoint
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " LdrText_ProcessCmds.cs: line: 313");
                }
                break;

            case "cmdLD":
                //resElev1 = UserInput.getCogoPoint(prompt1, out idCgPnt1, Pub.pnt3dOrg, osMode: 8);
                //pnt3d = idCgPnt1.getCogoPntCoordinates();
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                pnt3d = UserInput.getPoint(prompt1, out ps, 521);

                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                resTop = Dict.getCmdDefault(nameCmd, "resTop");
                bool cancel = true;
                cancel = UserInput.getUserInput(resTop, "\nEnter Top Text: ", out resTop, true);
                if (cancel || resTop == string.Empty)
                {
                    idLDR.delete();
                    return;
                }
                resBot = Dict.getCmdDefault(nameCmd, "resBot");
                cancel = true;
                cancel = UserInput.getUserInput(resBot, "\nEnter Bottom Text: ", out resBot, true);

                Txt.addLdrText(nameCmd, apps.lnkLD, idLDR, null, resTop, resBot);

                Dict.setCmdDefault(nameCmd, "resTop", resTop);                          //OK
                Dict.setCmdDefault(nameCmd, "resBot", resBot);                          //OK

                break;

            case "cmdLLA":
                bool              canLdr;
                Handle            hEntX     = "0000".stringToHandle();
                string            nameLayer = "";
                FullSubentityPath path      = new FullSubentityPath();
                Entity            ent       = Ldr.getFirstLdrPoint(out pnt3d, out canLdr, out hEntX, out nameLayer, out path);
                if (ent == null)
                {
                    return;
                }
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                resTop = nameLayer;
                resBot = "";
                Txt.addLdrText(nameCmd, apps.lnkLD, idLDR, null, resTop, resBot);

                break;

            case "cmdLLG":
                string zone = "405";
                prompt = string.Format("\nEnter the California SPCS Zone: <{0}>: [401/402/403/404/405/406]: ", zone);
                escape = UserInput.getUserInputKeyword(zone, out zone, prompt, "401 402 403 404 405 406");
                if (escape)
                {
                    return;
                }
                pnt3d = UserInput.getPoint("\nSelect a GRID point: ", out ps, osMode: 8);
                if (pnt3d == Pub.pnt3dO)
                {
                    return;
                }
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                LdrText_cmdLLG.cmdLLG(zone, pnt3d.Y, pnt3d.X, out resTop, out resBot);
                Txt.addLdrText(nameCmd, apps.lnkLD, idLDR, null, resTop, resBot);
                break;

            case "cmdRQ":
            case "cmdRiser":
                resElev1 = UserInput.getPoint("\nSelect Low Point : ", out idCgPnt1, out pnt3d, Pub.pnt3dO, osMode: 8);
                if (resElev1 == string.Empty)
                {
                    return;
                }
                if (idCgPnt1 == ObjectId.Null)
                {
                    pnt3d1 = pnt3d;
                }
                else
                {
                    pnt3d1 = idCgPnt1.getCogoPntCoordinates();
                }

                resElev2 = UserInput.getPoint("\nSelect High Point: ", out idCgPnt2, out pnt3d, pnt3d1, osMode: 8);
                if (resElev2 == string.Empty)
                {
                    return;
                }
                if (idCgPnt2 == ObjectId.Null)
                {
                    pnt3d2 = pnt3d;
                }
                else
                {
                    pnt3d2 = idCgPnt2.getCogoPntCoordinates();
                }

                idLDR = Ldr.drawLdr(pnt3d2, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }

                if (pnt3d1.Z > pnt3d2.Z)
                {
                    resElev  = resElev1;
                    resElev1 = resElev2;
                    resElev2 = resElev;
                    pnt3d    = pnt3d1;
                    pnt3d1   = pnt3d2;
                    pnt3d2   = pnt3d;
                }

                double nomRiser = 0.583;
                double aveRiser = 0;
                int    numRiser = 1;

                deltaZ = pnt3d2.Z - pnt3d1.Z;

                if (deltaZ < 0.333)                         //4"
                {
                    Application.ShowAlertDialog("\nElevation difference is less than 4 in. - revise landing elevation");
                }
                else if (deltaZ <= nomRiser)
                {                           //7"
                    aveRiser = deltaZ;
                }
                else if (deltaZ <= 0.667)                         //8"
                {
                    Application.ShowAlertDialog("\nElevation difference is greater than 7 in.  and less than 8 in. - therefore landing elevation needs to be adjusted");
                }
                else
                {                         // > 8"
                    if (deltaZ.mod(nomRiser) == 0)
                    {
                        numRiser = (int)System.Math.Truncate(deltaZ / nomRiser);
                    }
                    else
                    {
                        numRiser = (int)System.Math.Truncate(deltaZ / nomRiser);
                        numRiser++;
                    }
                    aveRiser = deltaZ / numRiser;

                    if (aveRiser < 0.333)
                    {
                        numRiser--;
                        aveRiser = deltaZ / numRiser;
                    }
                }

                string minRiser = (aveRiser * 12.0).decimalToFraction();
                if (nameCmd == "cmdRiser")
                {
                    resTop = string.Format("({0}) {1} ", numRiser, minRiser);
                    resBot = "RISERS";
                }
                else if (nameCmd == "cmdRQ")
                {
                    double lenRamp = deltaZ / 0.0833;
                    resTop = string.Format("CONSTRUCT {0:F2} FT HC RAMP", lenRamp);
                    resBot = string.Format("({0}) RISERS {1}", numRiser, minRiser);
                }
                Txt.addLdrText(nameCmd, apps.lnkLD, idLDR, null, resTop, resBot);

                break;

            case "cmdSDE":
            case "cmdSDS":
            case "cmdSED":
                Point3d  pnt3dPicked = Pub.pnt3dO;
                string   nameAlign   = string.Empty;
                ObjectId idAlign     = Align.selectAlign("Select Alignment:\n", "Alignment not found! Retry\n", out pnt3dPicked, out nameAlign);
                if (idAlign == ObjectId.Null)
                {
                    return;
                }
                bool go = true;
                do
                {
                    BaseObjs.write(string.Format("Active Alignment is: {0}\n", nameAlign));
                    pnt3d = UserInput.getPoint("Pick Arrow Start Point:\n", out ps, osMode: 8);
                    if (pnt3d == Pub.pnt3dO)
                    {
                        return;
                    }
                    pnt3d1 = pnt3d;                             //store elevation from start point

                    idCgPnt1 = Select.selectCogoPntAtPoint3d(pnt3d1);
                    idsCgPnts.Add(idCgPnt1);

                    //idLDR = LdrText_JigLeader0.jigLeader0(pnt3dTar, 0.09, "ARROW", 7);
                    idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                    if (idLDR == ObjectId.Null)
                    {
                        return;
                    }
                    escape    = false;
                    resPrefix = Dict.getCmdDefault(nameCmd, "resPrefix");
                    if (resPrefix == "")
                    {
                        resPrefix = "STA";
                    }
                    prompt = string.Format("\nEnter Station Prefix: STA/Other/. for None <{0}>: [STA/.]: ", resPrefix);
                    escape = UserInput.getUserInputKeyword(resPrefix, out resPrefix, prompt, "STA .");
                    if (escape)
                    {
                        idLDR.delete();
                        return;
                    }

                    escape    = false;
                    resSuffix = Dict.getCmdDefault(nameCmd, "resSuffix");
                    if (resSuffix == "")
                    {
                        resSuffix = ".";
                    }
                    prompt = string.Format("\nEnter Station Suffix: BC/EC/Other/. for None <{0}>: [BC/EC/.]: ", resSuffix);
                    escape = UserInput.getUserInputKeyword(resSuffix, out resSuffix, prompt, "BC EC .");
                    if (escape)
                    {
                        idLDR.delete();
                        return;
                    }

                    escape  = false;
                    resDesc = Dict.getCmdDefault(nameCmd, "resDesc");
                    if (resDesc == "")
                    {
                        resDesc = nameAlign;
                    }
                    prompt = string.Format("\nEnter Station Desc/. for None <{0}>: [.]: ", resDesc);
                    escape = UserInput.getUserInputKeyword(resDesc, out resDesc, prompt, ".");
                    if (escape)
                    {
                        idLDR.delete();
                        return;
                    }

                    if (nameCmd == "cmdSDE" || nameCmd == "cmdSED")
                    {
                        escape     = false;
                        resElevSuf = Dict.getCmdDefault(nameCmd, "resElevSuf");
                        if (resElevSuf == "")
                        {
                            resElevSuf = ".";
                        }
                        prompt = string.Format("\nEnter Elevation Suffix: INV/TC/FS/Other/. for None <{0}>: [.]: ", resElevSuf);
                        escape = UserInput.getUserInputKeyword(resElevSuf, out resElevSuf, prompt, ".");
                        if (escape)
                        {
                            idLDR.delete();
                            return;
                        }
                    }

                    double station = 0.0, offset = 0.0;
                    pnt3d = idLDR.getBegPnt();
                    Align.getAlignStaOffset(idAlign, pnt3d, ref station, ref offset);
                    if (resPrefix == ".")
                    {
                        resPrefix = "";
                    }
                    if (resSuffix == ".")
                    {
                        resSuffix = "";
                    }

                    resTop = string.Format("{0} {1} {2}", resPrefix, station.ToString("#####0+00.00"), resSuffix);
                    if (resDesc == ".")
                    {
                        resDesc = "";
                    }
                    resBot = resDesc;

                    if (nameCmd == "cmdSDE" || nameCmd == "cmdSED")
                    {
                        resBot2 = string.Format("{0:F2} {1}", pnt3d1.Z, resElevSuf);
                    }

                    Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTop, resBot, resBot2);
                } while (go);

                Dict.setCmdDefault(nameCmd, "resPrefix", resPrefix);
                Dict.setCmdDefault(nameCmd, "resSuffix", resSuffix);
                Dict.setCmdDefault(nameCmd, "resDesc", resDesc);
                Dict.setCmdDefault(nameCmd, "resElevSuf", resElevSuf);
                break;

            //case "cmdSF1":
            //    break;

            //case "cmdSF2":
            //    break;

            //case "cmdSLG":
            //    break;

            //case "cmdSS1":
            //    break;

            //case "cmdSS2":
            //    break;
            case "cmdPFA":
                break;

            case "cmdPFBEG":
                break;

            case "cmdPFDIM":
                break;

            case "cmdPFDIML":
                break;

            case "cmdPFDIMS":
                break;

            case "cmdPFDM":
                break;

            case "cmdPFDP":
                break;

            case "cmdPFED":
                break;

            case "cmdPFEND":
                break;

            case "cmdPFES":
                break;

            case "cmdPFI":
                break;

            case "cmdPFIS":
                break;

            case "cmdPFS":
                break;

            case "cmdPFSDE":
                break;

            case "cmdPFSIE":
                break;

            case "cmdPFXI":
                break;

            case "cmdPLA":
                break;

            case "cmdPLBD":
                break;

            case "cmdPLBDS":
                break;

            case "cmdPLCD":
                break;

            case "cmdPLEND":
                break;

            case "cmdPLBEG":
                break;
            //case "cmdPLMH":
            //    osMode = SnapMode.getOSnap();
            //    SnapMode.setOSnap(0);
            //    Point3d pnt3dPicked = Pub.pnt3dOrg;
            //    Algn align = (Algn)Base_Tools45.Select.selectEntity(typeof(Algn), "Select Algn", "Algn Selection Failed", out pnt3dPicked);

            //    SnapMode.setOSnap((int)osMode);
            //    break;
            case "cmdPLX":
                break;

            case "cmdVB":
                break;

            case "cmdVG":
                break;

            case "cmdPFSDM":
                break;

            case "cmdPFSDP":
                break;

            case "cmdPFSI":
                break;

            case "cmdPLSCO":
                break;

            case "cmdPLSMH":
                break;

            case "cmdSBD":
                break;

            case "cmdSE":
                break;

            case "cmdSSZ":
                pnt3d = UserInput.getPoint("\nSelect Node to label: ", out ps, osMode: 8);
                if (ps != PromptStatus.OK)
                {
                    return;
                }
                //idLDR = LdrText_JigLeader0.jigLeader0(pnt3d, 0.09, "ARROW", 7);
                idLDR = Ldr.drawLdr(pnt3d, 0.09, "ARROW", 7);
                if (idLDR == ObjectId.Null)
                {
                    return;
                }
                if (resBot == string.Empty)
                {
                    resBot = "TOP";
                }

                prompt = string.Format("\nEnter Bottom Text: TOP/TOE/Other <{0}> [TOP/TOE]:", resBot);
                escape = UserInput.getUserInputKeyword(resBot, out resBot, prompt, "TOP TOE");
                if (escape)
                {
                    idLDR.delete();
                    return;
                }

                resTop    = string.Format("{0:F2}", pnt3d.Z);
                idsCgPnts = null;

                Txt.addLdrText(nameCmd, apps.lnkCO, idLDR, idsCgPnts, resTop, resBot);
                Dict.setCmdDefault(nameCmd, "resBot", resBot);

                break;
            }
        }
Exemplo n.º 12
0
        ARCG()
        {
            Arc arc = null;

            Point3d pnt3dBeg = Pub.pnt3dO, pnt3dEnd = Pub.pnt3dO, pnt3dX = Pub.pnt3dO;

            ObjectId       idCgPntEnd = ObjectId.Null;
            ObjectId       idPoly     = ObjectId.Null;
            List <Point3d> pnts3d     = null;

            PromptStatus      ps;
            bool              escape = true;
            Point3d           pnt3dPick;
            string            nameLayer;
            FullSubentityPath path = new FullSubentityPath();

            Entity ent = xRef.getNestedEntity("\nSelect ARC: ", out escape, out pnt3dPick, out nameLayer, out path);

            if (escape)
            {
                return;
            }

            if (ent.GetType().ToString() != "Autodesk.AutoCAD.DatabaseServices.Arc")
            {
                Application.ShowAlertDialog(string.Format("Selected object was type of: {0} - Exiting...", ent.GetType().ToString()));
                return;
            }
            else
            {
                arc = (Arc)ent;
            }

            string elev = "", prompt = "Select Cogo Point for begin elevation: ";

            ObjectId idCgPntBeg = cmdABC.getEndPoint(pnt3dBeg, out elev, prompt);

            if (elev == "")
            {
                return;
            }

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

            idsCgPnt.Add(idCgPntBeg);

            pnt3dBeg = idCgPntBeg.getCogoPntCoordinates();
            BaseObjs.write(string.Format("\nBegin Elevation = {0:F2}", elev));

            int n = (arc.Normal.Z > 0) ? 1 : -1;                            //right hand direction

            if (arc.EndPoint.isEqual(pnt3dBeg, 0.1))
            {
                arc.ReverseCurve();         //*****************************************************************************
            }

            string cmdOpts = "M";

            prompt = string.Format("\nDistance/End of curve/Single point/Multiple points <{0}> [D/E/S/M]:", cmdOpts);
            escape = UserInput.getUserInputKeyword(cmdOpts, out cmdOpts, prompt, "D E S M");
            if (escape)
            {
                return;
            }

            double dist = 0.0, elv = 0.0, deltaZ = 0.0, grade = 0.0;
            uint   pntNum = 0;

            resultsRL resultsRL = new resultsRL();
            ObjectId  idCgPntX  = ObjectId.Null;

            switch (cmdOpts)
            {
                #region "D"

            case "D":
                escape = UserInput.getUserInput("\nEnter arc distance from selected begin point: ", out dist);
                if (escape)
                {
                    return;
                }

                pnt3dX = arc.GetPointAtDist(dist);

                cmdRL.getRLpromptresults(out resultsRL, out escape);
                if (escape)
                {
                    return;
                }
                switch (resultsRL.opt)
                {
                case "R":
                    grade = resultsRL.val;
                    elv   = pnt3dBeg.Z + dist * grade;
                    break;

                case "Z":
                    deltaZ = resultsRL.val;
                    elv    = pnt3dBeg.Z + deltaZ;
                    break;
                }
                pnt3dX   = new Point3d(pnt3dX.X, pnt3dX.Y, elv);
                idCgPntX = pnt3dX.setPoint(out pntNum);                         //***********   new point   *******************
                break;

                #endregion "D"

                #region "E"

            case "E":
                cmdRL.getRLpromptresults(out resultsRL, out escape);
                if (escape)
                {
                    return;
                }
                switch (resultsRL.opt)
                {
                case "R":
                    grade = resultsRL.val;
                    elv   = pnt3dBeg.Z + arc.Length * grade;
                    break;

                case "Z":
                    deltaZ = resultsRL.val;
                    grade  = deltaZ / arc.Length;
                    break;
                }

                pnts3d = arc.traverse(grade, pnt3dBeg);

                idCgPntEnd = pnts3d[pnts3d.Count - 1].setPoint(out pntNum);     //***********   new point  *******************
                idsCgPnt.Add(idCgPntEnd);

                BrkLine.makeBreakline(apps.lnkBrks, "cmdARCG", out idPoly, idsCgPnt, pnts3dL: pnts3d);

                break;

                #endregion "E"

                #region "S"

            case "S":
                pnt3dX = UserInput.getPoint("\nSelect target point on arc: ", out ps, osMode: 512);
                if (pnt3dX == Pub.pnt3dO)
                {
                    return;
                }

                dist = arc.GetDistAtPoint(pnt3dX);

                resultsRL = new resultsRL();
                cmdRL.getRLpromptresults(out resultsRL, out escape);
                if (escape)
                {
                    return;
                }
                switch (resultsRL.opt)
                {
                case "R":
                    grade = resultsRL.val;
                    elv   = pnt3dBeg.Z + dist * grade;
                    break;

                case "Z":
                    deltaZ = resultsRL.val;
                    elv    = pnt3dBeg.Z + deltaZ;
                    break;
                }
                pnt3dX   = new Point3d(pnt3dX.X, pnt3dX.Y, elv);
                idCgPntX = pnt3dX.setPoint(out pntNum);                         //***********   new point  *******************
                break;

                #endregion "S"

                #region "M"

            case "M":
                string res = "N";
                prompt = string.Format("\nSelect Method: <Interval distance/Number of points per segment> <{0}> [I N]: ", res);
                escape = UserInput.getUserInputKeyword(res, out res, prompt, "I N");
                int numPnts = 5;
                switch (res)
                {
                case "I":
                    dist   = 10;
                    escape = UserInput.getUserInput(string.Format("\nEnter distance between points <{0}>:", dist), out dist, dist, false);
                    if (escape)
                    {
                        return;
                    }
                    numPnts = (int)System.Math.Truncate(arc.Length / dist);
                    break;

                case "N":
                    ps = UserInput.getUserInputInt(string.Format("\nNumber of Points <{0}>:", numPnts), false, true, false, false, true, numPnts, out numPnts);
                    if (ps != PromptStatus.OK)
                    {
                        return;
                    }
                    dist = arc.Length / numPnts;
                    break;
                }

                resultsRL = new resultsRL();
                cmdRL.getRLpromptresults(out resultsRL, out escape);
                if (escape)
                {
                    return;
                }
                switch (resultsRL.opt)
                {
                case "R":
                    grade = resultsRL.val;
                    break;

                case "Z":
                    deltaZ = resultsRL.val;
                    grade  = deltaZ / arc.Length;
                    break;
                }

                pnt3dX   = new Point3d(pnt3dX.X, pnt3dX.Y, elv);
                idCgPntX = pnt3dX.setPoint(out pntNum);                         //***********   new point  *******************
                double sta = 0.0;

                for (int i = 1; i < numPnts; i++)
                {
                    sta = i * dist;
                    if (sta <= (arc.Length - dist / 2))
                    {
                        pnt3dX   = arc.GetPointAtDist(sta);
                        pnt3dX   = new Point3d(pnt3dX.X, pnt3dX.Y, pnt3dBeg.Z + sta * grade);
                        idCgPntX = pnt3dX.setPoint(out pntNum);
                        idsCgPnt.Add(idCgPntX);
                    }
                }

                elv      = pnt3dBeg.Z + arc.Length * grade;
                pnt3dX   = new Point3d(pnt3dX.X, pnt3dX.Y, elv);
                idCgPntX = pnt3dX.setPoint(out pntNum);
                idsCgPnt.Add(idCgPntX);                                 //***********   new point - end point  *******************

                break;

                #endregion "M"
            }
        }
Exemplo n.º 13
0
        ABC(string nameCmd)
        {
            Arc arc0 = null;

            Point3d pnt3dBeg = Pub.pnt3dO, pnt3dEnd = Pub.pnt3dO, pnt3dX = Pub.pnt3dO;

            ObjectId idCgPntEnd = ObjectId.Null;
            ObjectId idPoly     = ObjectId.Null;

            List <Point3d> pnts3d = null, pnts3dEntX = null;

            bool              escape    = true;
            Object            xRefPathX = null;
            PromptStatus      ps;
            FullSubentityPath path;
            Point3d           pnt3dPick;
            bool              isClosed = false;

            double grd = 0.0;
            Entity ent = xRef.getNestedEntity("\nSelect ARC: ", out escape, out xRefPathX, out ps, out pnts3dEntX, out path, out pnt3dPick, out isClosed);

            if (ent.GetType().ToString() != "Autodesk.AutoCAD.DatabaseServices.Arc")
            {
                Application.ShowAlertDialog(string.Format("Selected object was type of: {0} - Exiting...", ent.GetType().ToString()));
                return;
            }
            else
            {
                arc0 = (Arc)ent;
            }

            pnt3dX = UserInput.getPoint("\nPick point Back of Curb adjacent to arc segment", arc0.StartPoint, out escape, out ps, osMode: 8);

            double distX = arc0.Center.getDistance(pnt3dX);

            if (distX == arc0.Radius)
            {
                Application.ShowAlertDialog("Selected point is on arc.  Select point away from street side: ");
                pnt3dX = UserInput.getPoint("\nPick point Back of Curb adjacent to arc segment", pnt3dBeg, out escape, out ps, osMode: 8);
                distX  = arc0.Center.getDistance(pnt3dX);
                if (distX == arc0.Radius)
                {
                    return;
                }
            }

            int side = -1;
            int n    = (arc0.Normal.Z > 0) ? 1 : -1;

            switch (n)
            {
            case 1:                     //right hand direction
                if (distX > arc0.Radius)
                {
                    side = 1;
                }
                break;

            case -1:                    //left hand direction
                if (distX < arc0.Radius)
                {
                    side = 1;
                }
                break;
            }

            string elev = "", prompt = "\nSelect Cogo Point for begin elevation at beginning of curve (as indicated by guideline): ";

            ObjectId idCgPntBeg = getEndPoint(pnt3dBeg, out elev, prompt);

            if (elev == "")
            {
                return;
            }

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

            idsCgPnt.Add(idCgPntBeg);

            pnt3dBeg = idCgPntBeg.getCogoPntCoordinates();
            BaseObjs.write(string.Format("\nBegin Elevation = {0:F2}", elev));

            if (arc0.EndPoint.isEqual(pnt3dBeg, 0.1))
            {
                Curve curve = arc0;
                curve.ReverseCurve();                                     //*****************************************************************************
            }
            else if (arc0.StartPoint.isEqual(pnt3dBeg, 0.1))
            {
            }
            else
            {
                Application.ShowAlertDialog("Selected Begin point is not at either end of the arc.  Revise and retry...");
                return;
            }

            uint pntNum = 0;

            ObjectId idCgPntX = ObjectId.Null;

            List <double> userInput = null;

            userInput = cmdBC.getUserInput(nameCmd);
            if (userInput == null)
            {
                return;
            }

            double offH1 = 0.5 * 1.25 * side;
            double offV1 = userInput[0] + 0.0208;
            double offH2 = userInput[1] * side;
            double offV2 = userInput[2] * userInput[1];
            double offH3 = 0;
            double offV3 = 0;

            List <double> offHs = new List <double> {
                0.0, offH1, offH2
            };
            List <double> offVs = new List <double> {
                0.0, offV1, offV2
            };

            List <Arc> arcs = new List <Arc>();

            arcs.Add(arc0);

            DBObjectCollection dbObjs = arc0.GetOffsetCurves(offH1);
            Arc arc1 = (Arc)dbObjs[0];

            arcs.Add(arc1);
            dbObjs = arc1.GetOffsetCurves(offH2);
            Arc arc2 = (Arc)dbObjs[0];

            arcs.Add(arc2);
            Arc arc3 = null;

            if (nameCmd == "cmdABG")
            {
                offH3 = (userInput[3] * side * -1) - offH1 - offH2;  //offset from bench
                offV3 = userInput[4] - offV1 - offV2;                //offset from bench
                offHs.Add(offH3);
                offVs.Add(offV3);

                dbObjs = arc0.GetOffsetCurves(userInput[3] * side * -1);
                arc3   = (Arc)dbObjs[0];
                arcs.Add(arc3);
            }

            string cmdDefault = "R";

            prompt = string.Format("\nStraight grade(two or more points)/slope Intercept/Vertical curve/Plane method/Modified plane method/Reinhard plane method: S/I/V/P/M/R <{0}> [S/I/V/P/M/R]:", cmdDefault);
            escape = UserInput.getUserInputKeyword(cmdDefault, out cmdDefault, prompt, "S I V P M R");
            if (escape)
            {
                return;
            }

            Vector3d v3dBeg = new Vector3d(0, 0, 0);
            Vector3d v3dEnd = new Vector3d(0, 0, 0);

            List <arcInfo> arcInfos = new List <arcInfo>();

            arcInfo aInfo = getArcInfo(pnt3dBeg, arc0, nameCmd, offHs, offVs, idCgPntBeg);

            arcInfos.Add(aInfo);


            Point3d pnt3d = pnt3dBeg;

            switch (cmdDefault)
            {
                #region "S"

            case "S":                                                                   // Assuming points are set at both ends, with optional points set at intermediate locations on arc
                bool Done = false;
                do
                {
                    prompt     = "\nSelect Cogo Point on Arc (Arc endpoint or intermediate point) ENTER when done: ";
                    idCgPntEnd = getEndPoint(pnt3d, out elev, prompt);
                    if (elev == "")
                    {
                        Done = true;
                    }
                    else
                    {
                        pnt3d = idCgPntEnd.getCogoPntCoordinates();
                        idsCgPnt.Add(idCgPntEnd);

                        aInfo = getArcInfo(pnt3d, arc0, nameCmd, offHs, offVs, idCgPntEnd);
                        arcInfos.Add(aInfo);
                    }
                }while (!Done);

                var sortByLen = from a in arcInfos
                                orderby a.distFromBeg ascending
                                select a;
                int i = -1;
                foreach (var b in sortByLen)
                {
                    arcInfos[++i] = b;
                }

                processArcInfo(ref arcInfos);

                switch (idsCgPnt.Count)
                {
                case 1:
                    return;

                default:
                    processArcs(arcs, arcInfos, arc0, idsCgPnt, nameCmd, offHs, offVs);
                    break;
                }

                break;

                #endregion "S"

                #region "I"

            case "I":

                double m1 = Pub.slp1;
                double m2 = Pub.slp2;

                prompt     = "\nSelect Cogo Point for end elevation: ";
                idCgPntEnd = getEndPoint(pnt3dBeg, out elev, prompt);
                if (elev == "")
                {
                    return;
                }
                pnt3dEnd = idCgPntEnd.getCogoPntCoordinates();
                idsCgPnt.Add(idCgPntEnd);

                grd = (pnt3dEnd.Z - pnt3dBeg.Z) / arc0.Length;
                BaseObjs.write(string.Format("\nSlope along curve is: {0:P2}", grd));

                m1 = Pub.slp1;
                m2 = Pub.slp2;

                UserInput.getUserInput("\nEnter slope from FIRST POINT: ", out m1, m1);
                if (m1 == -99.99)
                {
                    return;
                }
                UserInput.getUserInput("\nEnter slope from SECOND POINT: ", out m2, m2);
                if (m2 == -99.99)
                {
                    return;
                }

                Pub.slp1 = m1;
                Pub.slp2 = m2;

                double elev1 = pnt3dBeg.Z;
                double elev2 = pnt3dEnd.Z;
                distX = cmdSSP.getSlopeInterceptArc(arc0.Length, elev1, elev2, m1, -m2);
                if (distX == 0)
                {
                    return;
                }

                Point3d pnt3dInt = arc0.GetPointAtDist(distX);
                pnt3dInt = new Point3d(pnt3dInt.X, pnt3dInt.Y, elev1 + distX * m1);
                ObjectId idCgPntInt = pnt3dInt.setPoint(out pntNum);
                idsCgPnt.Add(idCgPntInt);

                Application.ShowAlertDialog(string.Format("The elevation of the slope\nintercept is {0:F2}", pnt3dInt.Z));


                aInfo = getArcInfo(pnt3dInt, arc0, nameCmd, offHs, offVs, idCgPntInt);
                arcInfos.Add(aInfo);


                aInfo = getArcInfo(pnt3dEnd, arc0, nameCmd, offHs, offVs, idCgPntEnd);
                arcInfos.Add(aInfo);


                processArcInfo(ref arcInfos);

                processArcs(arcs, arcInfos, arc0, idsCgPnt, nameCmd, offHs, offVs);

                break;

                #endregion "I"

                #region "V"

            case "V":
                prompt     = "\nSelect Cogo Point for end elevation: ";
                idCgPntEnd = getEndPoint(pnt3dBeg, out elev, prompt);
                if (elev == "")
                {
                    return;
                }
                pnt3dEnd = idCgPntEnd.getCogoPntCoordinates();
                idsCgPnt.Add(idCgPntEnd);

                grd = (pnt3dEnd.Z - pnt3dBeg.Z) / arc0.Length;
                BaseObjs.write(string.Format("\nSlope along curve is: {0:P2}", grd));

                m1 = Pub.slp1;
                m2 = Pub.slp2;

                UserInput.getUserInput("\nEnter slope from FIRST POINT: ", out m1, m1);
                if (m1 == -99.99)
                {
                    return;
                }
                UserInput.getUserInput("\nEnter slope from SECOND POINT: ", out m2, m2);
                if (m2 == -99.99)
                {
                    return;
                }
                string lenVC = "20";
                escape = UserInput.getUserInputDoubleAsString("\nEnter length of vertical curve: ", out lenVC, lenVC);
                if (escape)
                {
                    return;
                }

                Pub.slp1 = m1;
                Pub.slp2 = m2;

                elev1 = pnt3dBeg.Z;
                elev2 = pnt3dEnd.Z;
                distX = cmdSSP.getSlopeInterceptArc(arc0.Length, elev1, elev2, m1, -m2);
                if (distX == 0)
                {
                    return;
                }

                pnt3dInt = arc0.GetPointAtDist(distX);
                pnt3dInt = new Point3d(pnt3dInt.X, pnt3dInt.Y, elev1 + distX * m1);

                Application.ShowAlertDialog(string.Format("The elevation of the slope\nintercept is {0:F2}", pnt3dInt.Z));

                double lVC = double.Parse(lenVC);
                if ((distX - lVC / 2) < 0 || (distX + lVC / 2) > arc0.Length)
                {
                    double lenMax = distX * 2;
                    if ((arc0.Length - distX) < lenMax / 2)
                    {
                        lenMax = (arc0.Length - distX) * 2;
                        Application.ShowAlertDialog(string.Format("Maximum length of Vertical Curve length with current inputs is {0:F2}", lenMax));
                    }
                }

                pnts3d = arc0.traverse(m1, -m2, distX, lVC, pnt3dBeg);

                BrkLine.makeBreakline(apps.lnkBrks, nameCmd, out idPoly, idsCgPnt, pnts3dL: pnts3d);
                break;

                #endregion "V"

                #region "M"

            case "M":
                prompt = "\nSelect Begin Curve backsight Cogo Point for grade and direction: ";
                Point3d pnt3dBegBS = UserInput.getPoint(prompt, pnt3dBeg, out escape, out ps, osMode: 8);
                if (pnt3dBegBS == Pub.pnt3dO)
                {
                    return;
                }

                prompt     = "\nSelect Cogo Point for end elevation: ";
                idCgPntEnd = getEndPoint(pnt3dBeg, out elev, prompt);
                if (elev == "")
                {
                    return;
                }
                pnt3dEnd = idCgPntEnd.getCogoPntCoordinates();

                grd = (pnt3dEnd.Z - pnt3dBeg.Z) / arc0.Length;
                BaseObjs.write(string.Format("\nSlope along curve is: {0:P2}", grd));

                prompt = "\nSelect End Curve backsight Cogo Point for grade and direction: ";
                Point3d pnt3dEndBS = UserInput.getPoint(prompt, pnt3dEnd, out escape, out ps, osMode: 8);
                if (pnt3dEndBS == Pub.pnt3dO)
                {
                    return;
                }

                Point3d pnt3dPI = Geom.getPntInt(pnt3dBegBS, pnt3dBeg, pnt3dEndBS, pnt3dEnd, true, extend.both);

                double g1 = pnt3dBegBS.getSlope(pnt3dBeg);
                double g2 = pnt3dEnd.getSlope(pnt3dEndBS);

                double el1 = pnt3dBeg.Z + g1 * pnt3dBeg.getDistance(pnt3dPI);
                double el2 = pnt3dEnd.Z - g2 * pnt3dEnd.getDistance(pnt3dPI);

                double ratio = 0;

                double aDiff = g1 - g2;
                double el    = 0;

                if (g1 < 0 && g2 < 0)
                {
                    ratio = g1 / (g1 + g2);
                    if (g1 <= g2)
                    {     //g1 controls
                        if (el1 < el2)
                        {
                            el = el1 + (el2 - el1) * ratio;
                        }
                        else if (el1 > el2)
                        {
                            el = el1 - (el1 - el2) * ratio;
                        }
                    }
                    else if (g2 < g1)
                    {     //g2 controls
                        if (el2 < el1)
                        {
                            el = el2 + (el1 - el2) * (1 - ratio);
                        }
                        else if (el2 > el1)
                        {
                            el = el2 - (el2 - el1) * (1 - ratio);
                        }
                    }
                }
                else if (g1 > 0 && g2 > 0)
                {
                    ratio = g1 / (g1 + g2);
                    if (g1 >= g2)
                    {     //g1 controls
                        if (el1 < el2)
                        {
                            el = el1 + (el2 - el1) * ratio;
                        }
                        else if (el1 > el2)
                        {
                            el = el1 - (el1 - el2) * ratio;
                        }
                    }
                    else if (g2 > g1)
                    {     //g2 controls
                        if (el2 < el1)
                        {
                            el = el2 + (el1 - el2) * (1 - ratio);
                        }
                        else if (el2 > el1)
                        {
                            el = el2 - (el2 - el1) * (1 - ratio);
                        }
                    }
                }
                else
                {
                    ratio = g1 / aDiff;
                    if (ratio >= (1 - ratio))
                    {     //g1 controls
                        if (el1 < el2)
                        {
                            el = el1 + (el2 - el1) * ratio;
                        }
                        else if (el1 > el2)
                        {
                            el = el1 - (el1 - el2) * ratio;
                        }
                    }
                    else if ((1 - ratio) > ratio)
                    {     //g2 controls
                        if (el2 < el1)
                        {
                            el = el2 + (el1 - el2) * (1 - ratio);
                        }
                        else if (el2 > el1)
                        {
                            el = el2 - (el2 - el1) * (1 - ratio);
                        }
                    }
                }

                pnt3dPI = new Point3d(pnt3dPI.X, pnt3dPI.Y, el);
                pnt3dPI.setPoint(out pntNum);
                BaseObjs.updateGraphics();

                double g1Mod = pnt3dBeg.getSlope(pnt3dPI);
                double g2Mod = pnt3dPI.getSlope(pnt3dEnd);

                g1 = (g1 + g1Mod) / 2;
                g2 = (g2 + g2Mod) / 2;

                Point3d pnt3dChordMid = pnt3dBeg.getMidPoint3d(pnt3dEnd);

                Vector3d v3dM = pnt3dPI - pnt3dChordMid;

                pnts3d = arc0.planeMethodModified(pnt3dBeg, pnt3dEnd, pnt3dPI, v3dM, g1, g2, ref idsCgPnt);
                idsCgPnt.Add(idCgPntEnd);

                arcInfos = new List <arcInfo>();
                for (int s = 0; s < pnts3d.Count; s++)
                {
                    pnt3dX = pnts3d[s];
                    aInfo  = getArcInfo(pnt3dX, arc0, nameCmd, offHs, offVs, idsCgPnt[s]);
                    arcInfos.Add(aInfo);
                }

                processArcInfo(ref arcInfos);
                processArcs(arcs, arcInfos, arc0, idsCgPnt, nameCmd, offHs, offVs);

                break;

                #endregion "M"

                #region "R"

            case "R":
                prompt     = "\nSelect Begin Curve backsight Cogo Point for grade and direction: ";
                pnt3dBegBS = UserInput.getPoint(prompt, pnt3dBeg, out escape, out ps, osMode: 8);
                if (pnt3dBegBS == Pub.pnt3dO)
                {
                    return;
                }

                prompt     = "\nSelect Cogo Point for end elevation: ";
                idCgPntEnd = getEndPoint(pnt3dBeg, out elev, prompt);
                if (elev == "")
                {
                    return;
                }
                pnt3dEnd = idCgPntEnd.getCogoPntCoordinates();

                grd = (pnt3dEnd.Z - pnt3dBeg.Z) / arc0.Length;
                BaseObjs.write(string.Format("\nSlope along curve is: {0:P2}", grd));

                prompt     = "\nSelect End Curve backsight Cogo Point for grade and direction: ";
                pnt3dEndBS = UserInput.getPoint(prompt, pnt3dEnd, out escape, out ps, osMode: 8);
                if (pnt3dEndBS == Pub.pnt3dO)
                {
                    return;
                }

                pnt3dPI = Geom.getPntInt(pnt3dBegBS, pnt3dBeg, pnt3dEndBS, pnt3dEnd, true, extend.both);

                g1 = pnt3dBegBS.getSlope(pnt3dBeg);
                g2 = pnt3dEnd.getSlope(pnt3dEndBS);
                string resOut = "";

                prompt = string.Format("\nUse g1={0:P2} or g2={1:P2}?: [1/2]", g1, g2);
                escape = UserInput.getUserInputKeyword("1", out resOut, prompt, "1 2");
                if (escape)
                {
                    return;
                }

                el = 0;
                switch (resOut)
                {
                case "1":
                    el = pnt3dBeg.Z + g1 * pnt3dBeg.getDistance(pnt3dPI);
                    break;

                case "2":
                    el = pnt3dEnd.Z - g2 * pnt3dEnd.getDistance(pnt3dPI);
                    break;
                }

                pnt3dPI = new Point3d(pnt3dPI.X, pnt3dPI.Y, el);
                pnt3dPI.setPoint(out pntNum);
                BaseObjs.updateGraphics();

                pnts3d = arc0.planeMethodReinhard(pnt3dBeg, pnt3dEnd, pnt3dPI, ref idsCgPnt);
                idsCgPnt.Add(idCgPntEnd);

                arcInfos = new List <arcInfo>();
                for (int s = 0; s < pnts3d.Count; s++)
                {
                    pnt3dX = pnts3d[s];
                    aInfo  = getArcInfo(pnt3dX, arc0, nameCmd, offHs, offVs, idsCgPnt[s]);
                    arcInfos.Add(aInfo);
                }

                processArcInfo(ref arcInfos);
                processArcs(arcs, arcInfos, arc0, idsCgPnt, nameCmd, offHs, offVs);

                break;

                #endregion "R"

                #region "P"

            case "P":
                prompt     = "S\nelect Begin Curve backsight Cogo Point for grade and direction: ";
                pnt3dBegBS = UserInput.getPoint(prompt, pnt3dBeg, out escape, out ps, osMode: 8);
                if (pnt3dBegBS == Pub.pnt3dO)
                {
                    return;
                }

                prompt     = "\nSelect Cogo Point for end elevation: ";
                idCgPntEnd = getEndPoint(pnt3dBeg, out elev, prompt);
                if (elev == "")
                {
                    return;
                }
                pnt3dEnd = idCgPntEnd.getCogoPntCoordinates();

                grd = (pnt3dEnd.Z - pnt3dBeg.Z) / arc0.Length;
                BaseObjs.write(string.Format("\nSlope along curve is: {0:P2}", grd));

                prompt     = "\nSelect End Curve backsight Cogo Point for grade and direction: ";
                pnt3dEndBS = UserInput.getPoint(prompt, pnt3dEnd, out escape, out ps, osMode: 8);
                if (pnt3dEndBS == Pub.pnt3dO)
                {
                    return;
                }

                pnt3dPI = Geom.getPntInt(pnt3dBegBS, pnt3dBeg, pnt3dEndBS, pnt3dEnd, true, extend.both);

                g1 = pnt3dBegBS.getSlope(pnt3dBeg);
                g2 = pnt3dEndBS.getSlope(pnt3dEnd);

                el1 = pnt3dBeg.Z + g1 * pnt3dBeg.getDistance(pnt3dPI);
                el2 = pnt3dEnd.Z + g2 * pnt3dEnd.getDistance(pnt3dPI);

                el = (el1 + el2) / 2;

                pnt3dPI = new Point3d(pnt3dPI.X, pnt3dPI.Y, el);

                pnt3dChordMid = pnt3dBeg.getMidPoint3d(pnt3dEnd);

                v3dM = pnt3dPI - pnt3dChordMid;

                pnts3d = arc0.planeMethod(pnt3dBeg, pnt3dEnd, pnt3dPI, v3dM, ref idsCgPnt, nameCmd);
                idsCgPnt.Add(idCgPntEnd);

                arcInfos = new List <arcInfo>();
                for (int s = 0; s < pnts3d.Count; s++)
                {
                    pnt3dX = pnts3d[s];
                    aInfo  = getArcInfo(pnt3dX, arc0, nameCmd, offHs, offVs, idsCgPnt[s]);
                    arcInfos.Add(aInfo);
                }

                processArcInfo(ref arcInfos);
                processArcs(arcs, arcInfos, arc0, idsCgPnt, nameCmd, offHs, offVs);

                break;

                #endregion "P"
            }
        }