getPoints(string prompt1, string prompt2) { List <ObjectId> idCgPnts = new List <ObjectId>(); try { int n = 0; PromptStatus ps; bool done = false; Point3d pnt3d; bool escape = true; ObjectId idCgPnt = ObjectId.Null; do { switch (n) { case 0: idCgPnt = CgPnt.selectCogoPointByNode(prompt1, ref Pub.pnt3dO, out escape, out ps, osMode: 8); n++; break; default: pnt3d = idCgPnt.getCogoPntCoordinates(); idCgPnt = CgPnt.selectCogoPointByNode(prompt2, ref pnt3d, out escape, out ps, osMode: 8); break; } switch (ps) { case PromptStatus.Cancel: return(idCgPnts); case PromptStatus.None: if (idCgPnts.Count < 2) { return(idCgPnts); } done = true; break; case PromptStatus.OK: idCgPnts.Add(idCgPnt); break; } }while (!done); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC1.cs: line: 240"); } finally { } return(idCgPnts); }
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; } }
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"); } } }
SPG(string nameCmd) { gp.pnt3d1 = Pub.pnt3dO; gp.pnt3d2 = Pub.pnt3dO; PromptStatus ps = PromptStatus.Cancel; string desc1 = ""; string desc2 = ""; bool escape; object mode = SnapMode.getOSnap(); try { Point3d pnt3d1 = Pub.pnt3dO; ObjectId idCgPnt1 = CgPnt.selectCogoPointByNode("\nSelect FIRST point-node: ", ref pnt3d1, out escape, out ps, osMode: 8); if (ps == PromptStatus.Cancel) { return; } desc1 = idCgPnt1.getCogoPntDesc(); gp.pnt3d1 = pnt3d1; Point3d pnt3d2 = Pub.pnt3dO; ObjectId idCgPnt2 = CgPnt.selectCogoPointByNode("\nSelect SECOND point-node: ", ref pnt3d2, out escape, out ps, osMode: 8); if (ps == PromptStatus.Cancel) { return; } desc2 = idCgPnt2.getCogoPntDesc(); gp.pnt3d2 = pnt3d2; SnapMode.setOSnap(1); do { gp.pnt3dX = Pub.pnt3dO; gp.pnt3dT = Pub.pnt3dO; gp.pnt3dT = gPnt.getPoint("\nSelect Target location or press Enter to exit: ", nameCmd); if (gp.pnt3dT == Pub.pnt3dO) { return; } gp.pnt3dX = gc.calcBasePnt3d(gp.pnt3dT, gp.pnt3d1, gp.pnt3d2); if (gp.pnt3dX == Pub.pnt3dO) { return; } uint pntNum; CgPnt.setPoint(gp.pnt3dX, out pntNum, desc1); }while (1 < 2); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdSPG.cs: line: 63"); } finally { SnapMode.setOSnap((int)mode); } }
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"); } } }