buildTCandBench(double offH, double offV, ObjectId idPoly3dFL, ObjectId idPoly3dRF, bool addPoints, ref List <Handle> handles) { ObjectId idPoly3dNew = ObjectId.Null; try { ObjectId idPoly = idPoly3dRF.addPoly(); ObjectId idPolyOff = idPoly.offset(offH); Point3dCollection pnts3d = idPoly3dRF.getCoordinates3d(); Point3dCollection pnts3dOff = idPolyOff.getCoordinates3d(); Point3dCollection pnts3dNew = new Point3dCollection(); List <ObjectId> idsCgPnts = new List <ObjectId>(); idPoly.delete(); idPolyOff.delete(); if (pnts3d.Count == pnts3dOff.Count) { uint pntNum; for (int i = 0; i < pnts3dOff.Count; i++) { Point3d pnt3d = new Point3d(pnts3dOff[i].X, pnts3dOff[i].Y, pnts3d[i].Z + offV); pnts3dNew.Add(pnt3d); if (addPoints) { ObjectId idCogoPnt = pnt3d.setPoint(out pntNum, "CPNT-ON"); handles.Add(idCogoPnt.getHandle()); idsCgPnts.Add(idCogoPnt); } } if (addPoints) { idPoly3dNew = BrkLine.makeBreakline(apps.lnkBrks, "cmdBC", out idPoly, idsCgPnts); foreach (ObjectId id in idsCgPnts) { id.setXData(idPoly3dNew.getHandle(), apps.lnkBrks3); } } else { idPoly3dNew = Draw.addPoly3d(pnts3dNew, "CPNT-BRKLINE"); } idPoly3dNew.setXData(idPoly3dFL.Handle, apps.lnkBrks3); handles.Add(idPoly3dNew.Handle); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC.cs: line: 182"); } return(idPoly3dNew); }
BC1(string nameCmd) { List <double> userInput = null; Polyline3d poly3dFL = null; ObjectId idPoly3dFL = ObjectId.Null; int side; Point3d pnt3dBEG = Pub.pnt3dO; Point3d pnt3dEND = Pub.pnt3dO; Point3d pnt3dX = Pub.pnt3dO; List <ObjectId> idsCgPnt = new List <ObjectId>(); ObjectId idPoly = ObjectId.Null; bool escape = false; try { userInput = cmdBC.getUserInput(nameCmd); if (userInput == null) { return; } BaseObjs.acadActivate(); if (Grading_Palette.gPalette.pGrading.optBRKLINE.IsChecked == true) { Point3d pnt3dPick; Entity ent = Select.selectEntity(typeof(Polyline3d), "Select Brkline:", "Brkline selection failed.", out pnt3dPick); poly3dFL = (Polyline3d)ent; //this 3dPoly is from points and is linked to the points with "lnkBrks" !!!!!!!!!!!!!!!!!!!!!!!!!! idPoly3dFL = poly3dFL.ObjectId; ResultBuffer rb = idPoly3dFL.getXData(null); if (rb == null) { return; } TypedValue[] tvsAll = rb.AsArray(); List <string> nameApps; List <TypedValue[]> tvsLst = tvsAll.parseXData(out nameApps); if (nameApps.Contains(apps.lnkBrks) || nameApps.Contains(apps.lnkBrks2)) { foreach (TypedValue[] tvs in tvsLst) { if (tvs[0].Value.ToString() == apps.lnkBrks) { idPoly3dFL.clearXData(apps.lnkBrks); tvs.SetValue(new TypedValue(1001, apps.lnkBrks2), 0); //link end points to FL upgraded from brkline idPoly3dFL.setXData(tvs, apps.lnkBrks2); } else if (tvs[0].Value.ToString() == apps.lnkBrks2) { idPoly3dFL.clearXData(apps.lnkBrks3); //clear old link data if exists - endpoints should be same } } } } else if (Grading_Palette.gPalette.pGrading.optPNTS.IsChecked == true) { try { string prompt1 = "\nSelect first point (Esc to quit): "; string prompt2 = "\nSelect next point (Enter to exit/Esc to quit: "; idsCgPnt = getPoints(prompt1, prompt2); idPoly3dFL = BrkLine.makeBreakline(apps.lnkBrks2, "BC", out idPoly, idsCgPnt); //this 3dPoly is from points and is linked to the points with "lnkBrks2" OK. } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC1.cs: line: 79"); } } try { using (Transaction tr = BaseObjs.startTransactionDb()) { poly3dFL = (Polyline3d)tr.GetObject(idPoly3dFL, OpenMode.ForRead); pnt3dBEG = idsCgPnt[0].getCogoPntCoordinates(); pnt3dEND = idsCgPnt[1].getCogoPntCoordinates(); PromptStatus ps; string prompt = "\nPick point Back of Curb adjacent to first segment"; pnt3dX = UserInput.getPoint(prompt, pnt3dBEG, out escape, out ps, osMode: 0); if (pnt3dX == Pub.pnt3dO || escape) { return; } if (pnt3dX.isRightSide(pnt3dBEG, pnt3dEND)) { side = 1; } else { side = -1; } double offH1 = 0.5 * side; double offV1 = userInput[0] + 0.0208; double offH2 = userInput[1] * side; double offV2 = userInput[2] * userInput[1]; List <Handle> handles = new List <Handle>(); ObjectId idPoly3dTC = buildCurbFeature(offH1, offV1, idPoly3dFL, idPoly3dFL, false, ref handles, side); // collect handles from TC, BB, CgPnt, GT Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dTC, offH1, offV1, 0.0, -1.0); ObjectId idPoly3dBB = buildCurbFeature(offH2, offV2, idPoly3dFL, idPoly3dTC, true, ref handles, side); Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dBB, offH1 + offH2, offV1 + offV2, 0.0, -1.0); ObjectId idPolyBB = idPoly3dBB.addPoly("GB"); handles.Add(idPolyBB.getHandle()); if (nameCmd == "cmdBG") { double offH3 = userInput[3] * side * -1; double offV3 = userInput[4]; ObjectId idPoly3dLP = buildCurbFeature(offH3, offV3, idPoly3dFL, idPoly3dFL, true, ref handles, side); Grading_Dict.addBrksToPntXDict(poly3dFL.ObjectId, idPoly3dLP, offH3, offV3, 0.0, -1.0); ObjectId idPolyGT = idPoly3dLP.addPoly("Gutter"); handles.Add(idPolyGT.getHandle()); } idPoly3dFL.setXData(handles, apps.lnkBrks3); tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC1.cs: line: 140"); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC1.cs: line: 145"); } }
SetPointBySlopeFromRef3dPoly() { ObjectId idPoly = ObjectId.Null; Point3d pnt3dPick = Pub.pnt3dO; Dictionary <double, ObjectId> basePnts = new Dictionary <double, ObjectId>(); double station = 0.0; try { gp.poly3dRF = (Polyline3d)Select.selectEntity(typeof(Polyline3d), "\nSelect Breakline (3dPolyline): ", "Breakline selection failed. Exiting...", out pnt3dPick); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdRTx.cs: line: 28"); } gp.vertex = pnt3dPick.getVertexNo(gp.poly3dRF.ObjectId); string ResultRTr = Grading_Palette.gPalette.pGrading.cmdRTr_Default; if (ResultRTr == string.Empty) { ResultRTr = "R"; } double deltaZ = double.Parse(Dict.getCmdDefault("cmdRTr", "DeltaZ").ToString()); double grade = Pub.Slope; object mode = SnapMode.getOSnap(); SnapMode.setOSnap(513); //endpoint + nearest try { do { List <ObjectId> idPnts = new List <ObjectId>(); bool escape = false; gp.pnt3dT = Grading_GetPointTracking.getPoint("Select Target Location: ", "cmdRTR"); if (!gp.inBounds) { continue; } if (gp.pnt3dT != Pub.pnt3dO) { string prompt = string.Format("\nZ value difference / Rate of grade /Both <{0}>:[Z/R/B]", ResultRTr); escape = UserInput.getUserInputKeyword(ResultRTr.ToUpper(), out ResultRTr, prompt, "Z R B"); if (escape) { break; } double elevTAR = 0; switch (ResultRTr.ToUpper()) { case "R": escape = UserInput.getUserInput("\nRate of Grade: ", out grade, grade); if (escape) { break; } Pub.Slope = grade; gp.pnt3dX = gc.calcBasePntAndTargetPntElev(gp.pnt3dT, grade, gp.poly3dRF, gp.vertex, out elevTAR, out station); if (gp.pnt3dX == Pub.pnt3dO && !gp.shift) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("Point Selected is out of bounds of selected segment. Exiting..."); continue; } gp.pnt3dT = new Point3d(gp.pnt3dT.X, gp.pnt3dT.Y, elevTAR); break; case "Z": deltaZ = Pub.dZ; escape = UserInput.getUserInput("Z Value Difference", out deltaZ, deltaZ); if (escape) { break; } Pub.dZ = deltaZ; gp.pnt3dX = gc.calcBasePntAndTargetPntElev(gp.pnt3dT, 0.0, gp.poly3dRF, gp.vertex, out elevTAR, out station); if (gp.pnt3dX == Pub.pnt3dO && !gp.shift) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("Point Selected is out of bounds of selected segment."); break; } gp.pnt3dT = new Point3d(gp.pnt3dT.X, gp.pnt3dT.Y, elevTAR + deltaZ); break; case "B": escape = UserInput.getUserInput("\nRate of Grade: ", out grade, grade); if (escape) { break; } Pub.Slope = grade; escape = UserInput.getUserInput("Z Value Difference", out deltaZ, deltaZ); if (escape) { break; } gp.pnt3dX = gc.calcBasePntAndTargetPntElev(gp.pnt3dT, grade, gp.poly3dRF, gp.vertex, out elevTAR, out station); if (gp.pnt3dX == Pub.pnt3dO && !gp.shift) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("Point Selected is out of bounds of selected segment."); break; } gp.pnt3dT = new Point3d(gp.pnt3dT.X, gp.pnt3dT.Y, elevTAR + deltaZ); break; } if (!escape) { uint pntNum; ObjectId idPntBase = ObjectId.Null; if (basePnts.TryGetValue(station, out idPntBase)) { idPnts.Add(idPntBase); } else { idPntBase = gp.pnt3dX.setPoint(out pntNum, "CPNT-ON"); basePnts.Add(station, idPntBase); idPnts.Add(idPntBase); } idPnts.Add(gp.pnt3dT.setPoint(out pntNum, "CPNT-ON")); if (ResultRTr != "B") { List <Handle> hPnts = new List <Handle>(); hPnts.Add(idPnts[0].getHandle()); hPnts.Add(idPnts[1].getHandle()); BrkLine.makeBreakline(apps.lnkBrks, "cmdRTR", out idPoly, idPnts); } } } else { break; } }while (1 < 2); Grading_Palette.gPalette.pGrading.cmdRTr_Default = ResultRTr; Dict.setCmdDefault("cmdRTr", "cmdDefault", ResultRTr); Dict.setCmdDefault("cmdRTr", "Slope", grade.ToString()); Dict.setCmdDefault("cmdRTr", "DeltaZ", deltaZ.ToString()); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdRTx.cs: line: 157"); } finally { SnapMode.setOSnap((int)mode); } }
BD(double B1Width, double B1Slope, double B2Width, double B2Slope, double gradeSlope, int interval, string surfTAR, string surfDES, int side = 0, double elev = 0.0, Polyline3d poly3d = null) { Boolean success = false; Boolean exists = false; Boolean doB1 = fSG.boolB1; Boolean doB2 = fSG.boolB1; List <Point3d> pnts3d = new List <Point3d>(); List <Point3d> pnts3dB1 = new List <Point3d>(); List <Point3d> pnts3dB2 = new List <Point3d>(); List <Point3d> pnts3dDL = new List <Point3d>(); List <Point3d> pnts3dRF = new List <Point3d>(); Vector3d v3d = Vector3d.XAxis; Point3d pnt3dB; BaseObjs.acadActivate(); ObjectId idPoly3dOrg = ObjectId.Null; ObjectId idPoly3d = ObjectId.Null; ObjectId idPoly = ObjectId.Null; if (poly3d == null) { idPoly3dOrg = Select.getBrkLine("\nSelect 3D Polyline Reference: "); } else { idPoly3dOrg = poly3d.ObjectId; } if (idPoly3dOrg == ObjectId.Null) { return(false); } ResultBuffer rb = idPoly3dOrg.getXData(apps.lnkBrks); if (rb == null) { return(false); } TypedValue[] tvs = rb.AsArray(); List <ObjectId> idsCgPntRF = tvs.getObjectIdList(); List <ObjectId> idsCgPntM = null; ObjectId idCgPnt = ObjectId.Null; bool isClosed = idPoly3dOrg.checkIfClosed3d(false); if (!isClosed) { Application.ShowAlertDialog("Design reference Breakline is not closed. Exiting..."); return(false); } Point3d pnt3dB1_Mb = Pub.pnt3dO, pnt3dB2_Mb = Pub.pnt3dO, pnt3dDL_Mb = Pub.pnt3dO, pnt3dRF_Mb = Pub.pnt3dO; Point3d pnt3dB1_Me = Pub.pnt3dO, pnt3dB2_Me = Pub.pnt3dO, pnt3dDL_Me = Pub.pnt3dO, pnt3dRF_Me = Pub.pnt3dO; Point3d pnt3dX = Pub.pnt3dO, pnt3dXA = Pub.pnt3dO, pnt3dXB = Pub.pnt3dO; uint pntNum = 0; int s = 0; double angle = 0.0, deflc = 0.0, delta = 0.0, slopeChk = 0.0; List <ANG_PT_PROP> angPtProps = new List <ANG_PT_PROP>(); ANG_PT_PROP angPtProp = null; try { using (BaseObjs._acadDoc.LockDocument()) { pnts3d = idPoly3dOrg.getCoordinates3dList(); if (side == 0) { side = Geom.getSide(pnts3d); } angPtProps = pnts3d.getPoly3dAngPtProps(); int k = angPtProps.Count; for (int i = 0; i < k; i++) { angPtProp = angPtProps[i]; pnt3dB = angPtProp.BEG; //last point = first point deflc = angPtProp.ANG_DEFLC; if (i == 0) { pnts3dRF.Add(pnt3dB); //add begin point } angle = getMidDeltaDirection(side, deflc, angPtProp.DIR_SEG1, angPtProp.DIR_SEG2, out s); if (s == 0) { if (surfTAR == "") { pnt3dDL_Mb = getTargetElevation(elev, pnt3dB, angle, gradeSlope); } else { v3d = new Vector3d(sMath.Cos(angle), sMath.Sin(angle), -gradeSlope); pnt3dDL_Mb = getSlopeIntercept(surfTAR, pnt3dB, gradeSlope, v3d); } pnts3dDL.Add(pnt3dDL_Mb); idCgPnt = pnt3dDL_Mb.setPoint(out pntNum); BaseObjs.updateGraphics(); idsCgPntM = new List <ObjectId> { idsCgPntRF[i], idCgPnt }; idPoly3d = BrkLine.makeBreakline(apps.lnkSLP, "cmdBD", out idPoly, idsCgPntM); BaseObjs.updateGraphics(); } else if (s == -2 || s == 4) { getToeIntercept(side, angPtProp, surfTAR, elev, gradeSlope, doB1, B1Width, B1Slope, doB2, B2Width, B2Slope, ref pnt3dDL_Mb, ref pnt3dXA, ref pnt3dXB); if (i == 0) { pnt3dDL_Me = pnt3dXB; } else { pnts3dRF.Add(pnt3dXB); pnt3dXB.setPoint(out pntNum, "CPNT-ON"); BaseObjs.updateGraphics(); } slopeChk = pnt3dDL_Mb.getSlope(pnt3dXB); Debug.Print(slopeChk.ToString("0.0000")); pnts3dRF.Add(pnt3dB); //add RF Angle point pnts3dRF.Add(pnt3dXA); pnt3dXA.setPoint(out pntNum, "CPNT-ON"); BaseObjs.updateGraphics(); slopeChk = pnt3dDL_Mb.getSlope(pnt3dXA); Debug.Print(slopeChk.ToString("0.0000")); idCgPnt = pnt3dDL_Mb.setPoint(out pntNum, "CPNT-ON"); BaseObjs.updateGraphics(); idsCgPntM = new List <ObjectId> { idsCgPntRF[i], idCgPnt }; pnts3dDL.Add(pnt3dDL_Mb); idPoly3d = BrkLine.makeBreakline(apps.lnkSLP, "cmdBD", out idPoly, idsCgPntM); BaseObjs.updateGraphics(); } else if (s == 2 || s == -4) { pnts3dRF.Add(pnt3dB); double anglePerp1 = angPtProp.DIR_SEG1 + PI / 2 * -side; double anglePerp2 = angPtProp.DIR_SEG2 + PI / 2 * -side; Vector2d v2d1 = new Vector2d(sMath.Cos(anglePerp1), sMath.Sin(anglePerp1)); Vector2d v2d2 = new Vector2d(sMath.Cos(anglePerp2), sMath.Sin(anglePerp2)); delta = v2d1.GetAngleTo(v2d2); List <double> angles = new List <double>(); angles.Add(anglePerp1); double angleX = anglePerp1 + delta / 4 * side; angles.Add(angleX); angles.Add(angle); angleX = angle + delta / 4 * side; angles.Add(angleX); angles.Add(anglePerp2); foreach (double ang in angles) { angle = ang; if (surfTAR != "") { v3d = new Vector3d(sMath.Cos(angle), sMath.Sin(angle), -gradeSlope); pnt3dDL_Mb = getSlopeIntercept(surfTAR, pnt3dB, gradeSlope, v3d); } else { pnt3dDL_Mb = getTargetElevation(elev, pnt3dB, angle, gradeSlope); } pnts3dDL.Add(pnt3dDL_Mb); idCgPnt = pnt3dDL_Mb.setPoint(out pntNum, "CPNT-ON"); BaseObjs.updateGraphics(); idsCgPntM = new List <ObjectId> { idsCgPntRF[i], idCgPnt }; idPoly3d = BrkLine.makeBreakline(apps.lnkSLP, "cmdBD", out idPoly, idsCgPntM); BaseObjs.updateGraphics(); } } } pnts3dDL.Add(pnts3dDL[0]); //complete point list with first point - for closure if (pnt3dRF_Me != Pub.pnt3dO) { pnts3dRF.Add(pnt3dRF_Me); //point on RF opposite DL back - first mid delta pnt3dRF_Me.setPoint(out pntNum, "CPNT-ON"); BaseObjs.updateGraphics(); } pnts3dRF.Add(pnts3dRF[0]); //complete point list with first point - for closure } } catch (SystemException ex) { BaseObjs.writeDebug(ex.Message + " cmdBD.cs: line: 244"); success = false; } ObjectId idPoly3dX = ObjectId.Null; ObjectIdCollection idsPoly3dX = new ObjectIdCollection(); tvs = new TypedValue[13]; tvs.SetValue(new TypedValue(1001, "lnkSLP"), 0); using (BaseObjs._acadDoc.LockDocument()) { try { idPoly3dOrg.handOverPoly3d2(pnts3dRF); Handle hB1; if (pnts3dB1.Count > 0) { idPoly3dX = pnts3dB1.addPoly3d("CPNT-BRKLINE"); //Lower Bench idsPoly3dX.Add(idPoly3dX); hB1 = idPoly3dX.getHandle(); } else { B1Width = 0.0; B1Slope = 0.0; hB1 = "0".stringToHandle(); } tvs.SetValue(new TypedValue(1000, B1Width), 1); tvs.SetValue(new TypedValue(1000, B1Slope), 2); tvs.SetValue(new TypedValue(1005, hB1), 3); Handle hB2; if (pnts3dB2.Count > 0) { idPoly3dX = pnts3dB2.addPoly3d("CPNT-BRKLINE"); //Top of Slope/Upper Bench idsPoly3dX.Add(idPoly3dX); hB2 = idPoly3dX.getHandle(); } else { B2Width = 0.0; B2Slope = 0.0; hB2 = "0".stringToHandle(); } tvs.SetValue(new TypedValue(1000, B2Width), 4); tvs.SetValue(new TypedValue(1000, B2Slope), 5); tvs.SetValue(new TypedValue(1005, hB2), 6); Handle hDL; idPoly3dX = pnts3dDL.addPoly3d("CPNT-BRKLINE"); //Top of Slope/Daylight (if no upper bench) idsPoly3dX.Add(idPoly3dX); hDL = idPoly3dX.getHandle(); tvs.SetValue(new TypedValue(1000, gradeSlope), 7); tvs.SetValue(new TypedValue(1070, side), 8); tvs.SetValue(new TypedValue(1000, interval), 9); tvs.SetValue(new TypedValue(1005, hDL), 10); tvs.SetValue(new TypedValue(1000, surfTAR), 11); tvs.SetValue(new TypedValue(1000, surfDES), 12); idPoly3dOrg.setXData(tvs, apps.lnkSLP); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBD.cs: line: 307"); } } if (idPoly3dX != ObjectId.Null) { DialogResult result; result = MessageBox.Show(string.Format("Add Slope Breaklines to Design Surface? \nYes to add to surface: {0}\nNo to keep Breaklines, but not add to surface.\nCancel to dispose of Breaklines.", surfDES), "Slope Breaklines", System.Windows.Forms.MessageBoxButtons.YesNoCancel); switch (result) { case DialogResult.Yes: TinSurface surf = Surf.getTinSurface(surfDES, out exists); surf.BreaklinesDefinition.AddStandardBreaklines(idsPoly3dX, 1.0, 1.0, 0.0, 0.0); success = true; break; case DialogResult.No: success = true; break; case DialogResult.Cancel: success = false; break; } } else { success = false; } return(success); }
GD() { ObjectId idPoly = ObjectId.Null; const string nameLayer = "CPNT-BRKLINE"; double dblAngDock = 0; double dblLenDock = 0; Point3d pnt3dA = Pub.pnt3dO; //point AHEAD Point3d pnt3dB; //point BACK int intSlopeSign = 0; const double pi = System.Math.PI; bool exists = false; ObjectId idDictGRADEDOCK = Dict.getNamedDictionary("GRADEDOCK", out exists); if (!exists) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("Run AVG - exiting ....."); } List <Point3d> pnts3dLim = getDockLimits(); //use 0 as dock number i.e. do one dock at a time bool escape = false; double width = 60; escape = UserInput.getUserInput(string.Format("Enter dock width: <{0}>:", width), out width, width); if (escape) { return; } double height = 4.04; escape = UserInput.getUserInput(string.Format("Enter dock height: <{0}>:", height), out height, height); if (escape) { return; } ObjectId idDictBLDG = Dict.getSubDict(idDictGRADEDOCK, bldgNum); //bldgNum obtained @ getDockLimits ObjectId idDictDOCKS = ObjectId.Null; TypedValue[] tvs; using (BaseObjs._acadDoc.LockDocument()) { try { using (Transaction tr = BaseObjs.startTransactionDb()) { ResultBuffer rb = Dict.getXRec(idDictBLDG, "HANDLE3D"); if (rb == null) { return; } tvs = rb.AsArray(); rb = Dict.getXRec(idDictBLDG, "SLOPE"); if (rb == null) { return; } tvs = rb.AsArray(); double dblSlope = (double)tvs[0].Value; rb = Dict.getXRec(idDictBLDG, "CENTROID"); if (rb == null) { return; } tvs = rb.AsArray(); Point3d pnt3dCEN = new Point3d((double)tvs[0].Value, (double)tvs[1].Value, (double)tvs[2].Value); rb = Dict.getXRec(idDictBLDG, "TARGET"); if (rb == null) { return; } tvs = rb.AsArray(); Point3d pnt3dTAR = new Point3d((double)tvs[0].Value, (double)tvs[1].Value, (double)tvs[2].Value); double dblAngBase = pnt3dCEN.getDirection(pnt3dTAR); ObjectIdCollection idsPoly3dX = new ObjectIdCollection(); List <Point3d> pnts3d = new List <Point3d>(); List <ObjectId> idsCgPnts = new List <ObjectId>(); try { Point3d pnt3dBEG = pnts3dLim[0]; Point3d pnt3dEND = pnts3dLim[1]; dblAngDock = Measure.getAzRadians(pnt3dBEG, pnt3dEND); dblLenDock = pnt3dBEG.getDistance(pnt3dEND); pnt3dB = pnt3dBEG; if (pnt3dTAR != Pub.pnt3dO) { pnt3dA = new Point3d(pnt3dBEG.X, pnt3dBEG.Y, pnt3dTAR.Z + Geom.getCosineComponent(pnt3dCEN, pnt3dTAR, pnt3dBEG) * (dblSlope * -1) - height); } else { pnt3dA = new Point3d(pnt3dBEG.X, pnt3dBEG.Y, pnt3dCEN.Z - height); //assuming flat floor if pnt3dTAR is -1,-1,-1 } pnts3d.Add(pnt3dA); //CgPnt 1 } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdGD_old.cs: line: 113"); } ObjectId idPoly3d = ObjectId.Null; if (dblSlope != 0) { double angDock2 = System.Math.Round(dblAngDock, 2); double angBase2 = System.Math.Round(dblAngBase, 2); double modAngles = 0; double angDiff = System.Math.Round(angBase2 - angDock2, 2); if (angDiff == 0) { intSlopeSign = 1; } else { if (angBase2 > angDock2) { modAngles = angBase2.mod(angDock2); } else { modAngles = angDock2.mod(angBase2); } if (modAngles == 0) { if (angDiff > 0) { intSlopeSign = 1; } else if (angDiff < 0) { intSlopeSign = -1; } } if (System.Math.Abs(angDiff) == System.Math.Round(pi / 2, 2)) { intSlopeSign = 0; } } } if (intSlopeSign != 0) { // sloped floor dblAngDock = dblAngDock - pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, -0.01); pnts3d.Add(pnt3dA); //CgPnt 2 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock, dblSlope * intSlopeSign * 1); pnts3d.Add(pnt3dA); //Pnt3 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, 0.01); pnts3d.Add(pnt3dA); //CgPnt 4 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock, dblSlope * intSlopeSign * -1); pnts3d.Add(pnt3dA); //Pnt5 idPoly3d = pnts3d.build3dPolyDockApron("CPNT-ON", nameLayer, "GD", out idsCgPnts); idsPoly3dX.Add(idPoly3d); } else { dblAngDock = dblAngDock - pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, -0.005); pnts3d.Add(pnt3dA); //Pnt2 int intDivide = (int)System.Math.Truncate(dblLenDock / 84) + 1; if (intDivide % 2 != 0) { intDivide = intDivide + 1; } int x = 0; dblAngDock = dblAngDock + pi / 2; double seg = dblLenDock / intDivide; int updown = 1; for (x = 0; x <= intDivide - 1; x++) { updown = -updown; pnt3dA = pnt3dA.traverse(dblAngDock, seg, 0.005 * updown); pnts3d.Add(pnt3dA); } dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, 0.005); pnts3d.Add(pnt3dA); dblAngDock = dblAngDock + pi / 2; for (x = 0; x <= intDivide - 1; x++) { pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock / intDivide, 0.0); pnts3d.Add(pnt3dA); } idPoly3d = pnts3d.build3dPolyDockApron("CPNT-ON", nameLayer, "GD", out idsCgPnts); idsPoly3dX.Add(idPoly3d); List <ObjectId> idCgPntsX = new List <ObjectId>(); idCgPntsX.Add(idsCgPnts[1]); //CgPnt 2 at dock limit away from building int intUBnd = idsCgPnts.Count; x = -1; int n = 1; int k = intUBnd / 2; for (int j = 1; j <= k - 1; j++) { x = -x; n = n + (intUBnd - 2 * j) * x; System.Diagnostics.Debug.Print(string.Format("{0},{1}", j, n)); idCgPntsX.Add(idsCgPnts[n]); } for (int i = 1; i < idCgPntsX.Count; i++) { List <ObjectId> idsCogoPnts = new List <ObjectId> { idCgPntsX[i - 1], idCgPntsX[i - 0] }; idPoly3d = BrkLine.makeBreakline(apps.lnkBrks, "GD", out idPoly, idsCogoPnts); idsPoly3dX.Add(idPoly3d); } } Grading_Floor.modSurface("CPNT-ON", "Finish Surface", idsPoly3dX, false); tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdGD_old.cs: line: 238"); } } }
TP1() { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt1); elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, idCgPnt1, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt2); escaped = UserInput.getUserInputDoubleAsString("\nEnter Cross Slope (+ or -): ", out xSlope, xSlope); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Width: ", out width, width); if (escaped) { return; } Point3d pnt3d1 = idCgPnt1.getCogoPntCoordinates(); Point3d pnt3d2 = idCgPnt2.getCogoPntCoordinates(); List <Point3d> pnts3d = new List <Point3d> { pnt3d1, pnt3d2 }; int side = Geom.getSide(pnts3d); double dir = pnt3d1.getDirection(pnt3d2); double len = pnt3d1.getDistance(pnt3d2); Point3d pnt3d3 = pnt3d2.traverse(dir + pi / 2 * -side, double.Parse(width), double.Parse(xSlope)); ObjectId idCgPnt3 = pnt3d3.setPoint(out pntNum); idsCgPnt.Add(idCgPnt3); BaseObjs.updateGraphics(); Point3d pnt3d4 = pnt3d1.traverse(dir + pi / 2 * -side, double.Parse(width), double.Parse(xSlope)); ObjectId idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Add(idCgPnt4); BaseObjs.updateGraphics(); idsCgPnt.Add(idCgPnt1); ObjectId idPoly = ObjectId.Null; List <ObjectId> idCgPnts = new List <ObjectId> { idCgPnt1, idCgPnt2 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt2, idCgPnt3 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt3, idCgPnt4 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt4, idCgPnt1 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); }
TP4() { gp.pnt3d1 = Pub.pnt3dO; gp.pnt3d2 = Pub.pnt3dO; ps = PromptStatus.Cancel; object mode = 0; BaseObjs.acadActivate(); Vector3d v3d = Vector3d.XAxis; try { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } else { gp.pnt3d1 = idCgPnt1.getCogoPntCoordinates(); } elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, ObjectId.Null, osMode: 8); if (elev == "") { return; } else { gp.pnt3d2 = idCgPnt2.getCogoPntCoordinates(); } mode = SnapMode.getOSnap(); SnapMode.setOSnap(8); gp.pnt3dX = Pub.pnt3dO; gp.pnt3dT = Pub.pnt3dO; System.Windows.Forms.Keys mods = System.Windows.Forms.Control.ModifierKeys; bool shift = (mods & System.Windows.Forms.Keys.Shift) > 0; bool control = (mods & System.Windows.Forms.Keys.Control) > 0; gp.shift = shift; gp.pnt3dT = gPnt.getPoint("\nSelect Target location (CogoPoint for xSlope and distance / pick side to enter xSlope and distance: ", "cmdTP"); if (gp.pnt3dT == Pub.pnt3dO) { return; } else if (gp.pnt3dT.Z == 0) { gp.pnt3dX = gc.calcBasePnt3d(gp.pnt3dT, gp.pnt3d1, gp.pnt3d2); if (gp.pnt3dX == Pub.pnt3dO) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Cross Slope (+ or -): ", out xSlope, xSlope); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Width: ", out width, width); if (escaped) { return; } double dist = gp.pnt3d1.getDistance(gp.pnt3d2); double distX = gp.pnt3d1.getDistance(gp.pnt3dX); Point2d pnt2dX = gp.pnt3dX.Convert2d(BaseObjs.xyPlane); Point2d pnt2dT = gp.pnt3dT.Convert2d(BaseObjs.xyPlane); double distT = pnt2dX.GetDistanceTo(pnt2dT); gp.pnt3dT = new Point3d(gp.pnt3dT.X, gp.pnt3dT.Y, gp.pnt3dX.Z + distT * double.Parse(xSlope)); v3d = gp.pnt3dT - gp.pnt3dX; v3d *= double.Parse(width) / distT; } else { gp.pnt3dX = gc.calcBasePnt3d(gp.pnt3dT, gp.pnt3d1, gp.pnt3d2); if (gp.pnt3dX == Pub.pnt3dO) { return; } CgPnt.setPoint(gp.pnt3dX, out pntNum, "CPNT-ON"); v3d = gp.pnt3dT - gp.pnt3dX; } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdTP.cs: line: 336"); } finally { SnapMode.setOSnap((int)mode); } ObjectId idPoly = ObjectId.Null; Point3d pnt3d3 = idCgPnt2.getCogoPntCoordinates() + v3d; ObjectId idCgPnt3 = pnt3d3.setPoint(out pntNum); Point3d pnt3d4 = idCgPnt1.getCogoPntCoordinates() + v3d; ObjectId idCgPnt4 = pnt3d4.setPoint(out pntNum); List <ObjectId> idCgPnts = new List <ObjectId> { idCgPnt1, idCgPnt2 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt2, idCgPnt3 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt3, idCgPnt4 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt4, idCgPnt1 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); }
TP3() { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt1); elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, idCgPnt1, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt3); elev = UserInput.getCogoPoint("\nPick Cogo Point 3: ", out idCgPnt3, idCgPnt2, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt3); Point3d pnt3d1 = idCgPnt1.getCogoPntCoordinates(); Point3d pnt3d2 = idCgPnt2.getCogoPntCoordinates(); Point3d pnt3d3 = idCgPnt3.getCogoPntCoordinates(); Vector2d v2d12 = (pnt3d2 - pnt3d1).Convert2d(BaseObjs.xyPlane); Vector2d v2d21 = (pnt3d1 - pnt3d2).Convert2d(BaseObjs.xyPlane); Vector2d v2d23 = (pnt3d3 - pnt3d2).Convert2d(BaseObjs.xyPlane); Vector2d v2d32 = (pnt3d2 - pnt3d3).Convert2d(BaseObjs.xyPlane); ObjectId idCgPnt4 = ObjectId.Null; Point3d pnt3d4 = Pub.pnt3dO; double dir = 0.0; double len = 0.0; double slp = 0.0; double delta = pi - v2d12.GetAngleTo(v2d23); double diff = System.Math.Abs(delta - pi / 2); if (diff < 0.01) { dir = v2d21.Angle; len = pnt3d2.getDistance(pnt3d1); slp = pnt3d2.getSlope(pnt3d1); pnt3d4 = pnt3d3.traverse(dir, len, slp); idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Add(idCgPnt4); } else { dir = v2d23.Angle; len = pnt3d2.getDistance(pnt3d3); len = len * System.Math.Cos(delta); slp = pnt3d2.getSlope(pnt3d3); slp = slp * System.Math.Cos(delta); double testRight = Geom.testRight(pnt3d1, pnt3d2, pnt3d3); dir = v2d12.Angle; len = pnt3d1.getDistance(pnt3d2); pnt3d4 = pnt3d3.traverse(dir, len, slp); idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Insert(2, idCgPnt4); } idsCgPnt.Add(idsCgPnt[0]); ObjectId idPoly = ObjectId.Null; for (int n = 0; n < idsCgPnt.Count - 1; n++) { List <ObjectId> idCgPnts = new List <ObjectId> { idsCgPnt[n], idsCgPnt[n + 1] }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP3", out idPoly, idCgPnts); } }
BV() { int snapMode = SnapMode.getOSnap(); try { ObjectId idPoly3dFL = ObjectId.Null; ObjectId idPoly3dOP = ObjectId.Null; ObjectId idPoly3dLT = ObjectId.Null; ObjectId idPoly3dRT = ObjectId.Null; List <Point3d> pnts3dFL = null; List <Point3d> pnts3dRF = null; List <Point3d> pnts3dOP = null; List <Handle> handles3 = null; ObjectIdCollection ids = null; Point3d pnt3dBEG = Pub.pnt3dO; double width = double.Parse(fGrading.cmdBV_GutterWidth); UserInput.getUserInput("\nGutter Width in Feet: ", out width, width); if (width == -99.99) { return; } fGrading.cmdBV_GutterWidth = width.ToString(); Dict.setCmdDefault("cmdBV", "GUTTERWIDTH", width.ToString()); double deltaZ = double.Parse(fGrading.cmdBV_GutterDepth); UserInput.getUserInput("\nGutter Depth in Feet: ", out deltaZ, deltaZ); if (deltaZ == -99.99) { return; } fGrading.cmdBV_GutterDepth = deltaZ.ToString(); Dict.setCmdDefault("cmdBV", "GUTTERDEPTH", deltaZ.ToString()); ObjectId idPoly3dRF = ObjectId.Null; ObjectId idPolyRF = ObjectId.Null; ObjectId idPolyFL = ObjectId.Null; switch (fGrading.cmdBV_Source) //SOURCE { case "BRKLINE": Type type = typeof(Polyline3d); TypedValue[] tvs = new TypedValue[2]; tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 0); tvs.SetValue(new TypedValue((int)DxfCode.LayerName, "CPNT_BRKLINE"), 1); SelectionSet ss = Select.buildSSet(tvs); ss.moveToTop(); idPoly3dRF = Select.getBrkLine("Select 3d Breakline: "); if (idPoly3dRF == ObjectId.Null) { return; } if (fGrading.optFL.IsChecked == true) { idPolyFL = idPoly3dRF.toPolyline("FL"); } if (fGrading.optEDGE.IsChecked == true) { idPolyRF = idPoly3dRF.toPolyline("GUTTER"); } break; case "POINTS": if (fGrading.optFL.IsChecked == true) { try { idPoly3dFL = BrkLine.makeBreakline(apps.lnkBrks2, "cmdBV", out idPolyFL); //make breakline and store endPoints on breakline, store breakline on endpoints if (idPoly3dFL == ObjectId.Null) { return; } pnts3dFL = idPoly3dFL.getCoordinates3dList(); idPoly3dRF = idPoly3dFL; pnts3dRF = pnts3dFL; pnt3dBEG = idPoly3dFL.getBegPnt(); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBV.cs: line: 99"); } } else if (fGrading.optEDGE.IsChecked == true) { try { idPoly3dRF = BrkLine.makeBreakline(apps.lnkBrks2, "cmdRF", out idPolyRF); if (idPoly3dRF == ObjectId.Null) { return; } pnts3dRF = idPoly3dRF.getCoordinates3dList(); pnt3dBEG = idPoly3dRF.getBegPnt(); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBV.cs: line: 114"); } } break; } int i = 0; List <SEG_PROP> segProps = pnts3dRF.getPoly3dSegProps(); double offFL = width / 2; double xSlopeFL = deltaZ / offFL; double offOP = width; //opposite side double xSlopeOP = 0.00; string nameLayer = "CPNT-BRKLINE"; PromptStatus ps; switch (fGrading.cmdBV_Control) //CONTROL { case "EDGE": pnts3dOP = new List <Point3d>(); bool escape = false; int side = -1; Point3d pnt3dPick = UserInput.getPoint("Pick point on FL side of Gutter Edge.", pnt3dBEG, out escape, out ps, osMode: 0); if (escape || pnt3dPick == Pub.pnt3dO) { SnapMode.setOSnap(snapMode); return; } for (i = 1; i < pnts3dRF.Count; i++) { double length = pnts3dRF[i - 1].getDistance(pnts3dRF[i + 0]); double distance = pnt3dPick.getOrthoDist(pnts3dRF[i - 1], pnts3dRF[i + 0]); if (distance > 0 && distance < length) { if (pnt3dPick.isRightSide(pnts3dRF[i - 1], pnts3dRF[i + 0])) { side = 1; //otherwise default is -1 break; } } } if (i == pnts3dRF.Count - 1) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("You have selected a point in the blind spot."); SnapMode.setOSnap(snapMode); return; } for (i = 0; i < segProps.Count; i++) { switch (side) { case 1: if (i == 0) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); continue; } if (segProps[i].DELTA == 0) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); } else if (segProps[i].DELTA > 0) { pnts3dFL.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeFL, segProps[i].DELTA, segProps[i - 1].DIR_AHEAD, -1, offFL)); pnts3dOP.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeOP, segProps[i].DELTA, segProps[i - 1].DIR_AHEAD, -1, offOP)); } else if (segProps[i].DELTA < 0) { pnts3dFL.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeFL, System.Math.Abs(segProps[i].DELTA), segProps[i].DIR_AHEAD, -1, offFL)); pnts3dOP.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeOP, System.Math.Abs(segProps[i].DELTA), segProps[i].DIR_AHEAD, -1, offOP)); } if (i == segProps.Count - 1) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); } break; case -1: if (i == 0) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); continue; } if (segProps[i].DELTA == 0) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); } else if (segProps[i].DELTA > 0) { pnts3dFL.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeFL, segProps[i].DELTA, segProps[i].DIR_AHEAD, 1, offFL)); pnts3dOP.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeOP, segProps[i].DELTA, segProps[i].DIR_AHEAD, 1, offOP)); } else if (segProps[i].DELTA < 0) { pnts3dFL.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeFL, System.Math.Abs(segProps[i].DELTA), segProps[i - 1].DIR_AHEAD, 1, offFL)); pnts3dOP.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeOP, System.Math.Abs(segProps[i].DELTA), segProps[i - 1].DIR_AHEAD, 1, offOP)); } if (i == segProps.Count - 1) { pnts3dFL.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offFL, xSlopeFL)); pnts3dOP.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD + PI / 2 * side, -1 * offOP, xSlopeOP)); } break; } } idPoly3dFL = Draw.addPoly3d(pnts3dFL, nameLayer); Grading_Dict.addBrksToPntXDict(idPoly3dRF, idPoly3dFL, offFL, deltaZ, 0.0, -1.0); //ADD EDGE HANDLE AND OFFSETS TO POINT EXTENSION DICTIONARY, ADD POINT HANDLES TO EDGE idPolyFL = idPoly3dFL.toPolyline("FL"); idPoly3dOP = Draw.addPoly3d(pnts3dOP, nameLayer); Grading_Dict.addBrksToPntXDict(idPoly3dRF, idPoly3dOP, offOP, 0.0, 0.0, -1.0); ObjectId idPolyOP = idPoly3dOP.toPolyline("GUTTER"); handles3 = new List <Handle>(); handles3.Add(idPoly3dRF.getHandle()); handles3.Add(idPolyRF.getHandle()); handles3.Add(idPolyFL.getHandle()); handles3.Add(idPoly3dOP.getHandle()); handles3.Add(idPolyOP.getHandle()); ids = new ObjectIdCollection(); ids.Add(idPoly3dRF); ids.Add(idPoly3dOP); break; case "FL": Point3dCollection pnts3dLT = new Point3dCollection(); Point3dCollection pnts3dRT = new Point3dCollection(); int x = segProps.Count; for (i = 0; i < x; i++) { if (i == 0) { pnts3dLT.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2, 1 * offFL, xSlopeFL)); pnts3dRT.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD - PI / 2, 1 * offFL, xSlopeFL)); } if (i > 0 && i < x) { if (segProps[i].DELTA == 0) { pnts3dLT.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD + PI / 2, 1 * offFL, xSlopeFL)); pnts3dRT.Add(Geom.traverse_pnt3d(segProps[i].BEG, segProps[i].DIR_AHEAD - PI / 2, 1 * offFL, xSlopeFL)); } else if (segProps[i].DELTA > 0) { pnts3dLT.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeFL, segProps[i - 1].DELTA, segProps[i - 1].DIR_AHEAD, -1, offFL)); pnts3dRT.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeFL, segProps[i - 1].DELTA, segProps[i - 0].DIR_AHEAD, 1, offFL)); } else if (segProps[i].DELTA < 0) { pnts3dLT.Add(Geom.doAnglePointOUT(segProps[i].BEG, xSlopeFL, System.Math.Abs(segProps[i].DELTA), segProps[i - 0].DIR_AHEAD, -1, offFL)); pnts3dRT.Add(Geom.doAnglePointIN(segProps[i].BEG, xSlopeFL, System.Math.Abs(segProps[i].DELTA), segProps[i - 1].DIR_AHEAD, 1, offOP)); } } if (i == x - 1) { pnts3dLT.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD + PI / 2, 1 * offFL, xSlopeFL)); pnts3dRT.Add(Geom.traverse_pnt3d(segProps[i].END, segProps[i].DIR_AHEAD - PI / 2, 1 * offFL, xSlopeFL)); } } ObjectId idPolyLT = Draw.addPoly(pnts3dLT, "2dPoly"); idPoly3dLT = Draw.addPoly3d(pnts3dLT, nameLayer); Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dLT, -offFL, deltaZ, 0.0, -1.0); //ADD EDGE HANDLE AND OFFSETS TO POINT EXTENSION DICTIONARY, ADD POINT HANDLES TO EDGE ObjectId idPolyRT = Draw.addPoly(pnts3dRT, "2dPoly"); idPoly3dRT = Draw.addPoly3d(pnts3dRT, nameLayer); Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dRT, offFL, deltaZ, 0.0, -1.0); handles3 = new List <Handle>(); handles3.Add(idPoly3dLT.getHandle()); handles3.Add(idPolyLT.getHandle()); handles3.Add(idPoly3dRT.getHandle()); handles3.Add(idPolyRT.getHandle()); ids = new ObjectIdCollection(); ids.Add(idPoly3dLT); ids.Add(idPoly3dRT); break; } Grading_GetNestedCurbObjects.getCurbFromXref(ids, idPoly3dFL, handles3); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBV.cs: line: 322"); } finally { } }
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" } }
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"); } } }
BC(string nameCmd) { List <double> userInput = null; Polyline3d poly3dFL = null; ObjectId idPoly3dFL = ObjectId.Null; Point3d pnt3dBEG = Pub.pnt3dO; Point3d pnt3dEND = Pub.pnt3dO; Point3d pnt3dX = Pub.pnt3dO; int side; bool escape = false; try { userInput = getUserInput(nameCmd); if (userInput == null) { return; } BaseObjs.acadActivate(); int snapMode = SnapMode.getOSnap(); SnapMode.setOSnap(8); if (Grading_Palette.gPalette.pGrading.optBRKLINE.IsChecked == true) { Point3d pnt3dPick; Entity ent = Select.selectEntity(typeof(Polyline3d), "Select Brkline:", "Brkline selection failed.", out pnt3dPick); poly3dFL = (Polyline3d)ent; //this 3dPoly is from points and is linked to the points with "apps.lnkBrks" !!!!!!!!!!!!!!!!!!!!!!!!!! idPoly3dFL = poly3dFL.ObjectId; ResultBuffer rb = idPoly3dFL.getXData(null); if (rb == null) { return; } } else if (Grading_Palette.gPalette.pGrading.optPNTS.IsChecked == true) { ObjectId idPoly = ObjectId.Null; try { idPoly3dFL = BrkLine.makeBreakline(apps.lnkBrks2, "BC", out idPoly); //this 3dPoly is from points and is linked to the points with "lnkBrks2" OK. } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC.cs: line: 58"); } } try { using (Transaction tr = BaseObjs.startTransactionDb()) { poly3dFL = (Polyline3d)tr.GetObject(idPoly3dFL, OpenMode.ForRead); pnt3dBEG = poly3dFL.StartPoint; pnt3dEND = poly3dFL.EndPoint; PromptStatus ps; pnt3dX = UserInput.getPoint("Pick point Back of Curb adjacent to segment", pnt3dBEG, out escape, out ps, osMode: 8); if (pnt3dX == Pub.pnt3dO || escape) { SnapMode.setOSnap(snapMode); return; } if (Geom.testRight(pnt3dBEG, pnt3dEND, pnt3dX) > 0) { side = -1; } else { side = 1; } double offH1 = 0.5 * 1.25 * side; double offV1 = userInput[0] + 0.0208; double offH2 = userInput[1] * side; double offV2 = userInput[2] * userInput[1]; List <Handle> handles = new List <Handle>(); ObjectId idPoly3dTC = buildTCandBench(offH1, offV1, idPoly3dFL, idPoly3dFL, false, ref handles); // collect handles from TC, BB, CgPnt, GT Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dTC, offH1, offV1, 0.0, -1.0); ObjectId idPoly3dBB = buildTCandBench(offH2, offV2, idPoly3dFL, idPoly3dTC, true, ref handles); Grading_Dict.addBrksToPntXDict(idPoly3dFL, idPoly3dBB, offH1 + offH2, offV1 + offV2, 0.0, -1.0); ObjectId idPolyBB = idPoly3dBB.addPoly("GB"); idPoly3dBB.moveBottom(); handles.Add(idPolyBB.getHandle()); idPoly3dBB.moveToTop(); if (nameCmd == "cmdBG") { double offH3 = userInput[3] * side * -1; double offV3 = userInput[4]; ObjectId idPoly3dLP = buildTCandBench(offH3, offV3, idPoly3dFL, idPoly3dFL, true, ref handles); Grading_Dict.addBrksToPntXDict(poly3dFL.ObjectId, idPoly3dLP, offH3, offV3, 0.0, -1.0); ObjectId idPolyGT = idPoly3dLP.addPoly("Gutter"); idPolyGT.moveBottom(); handles.Add(idPolyGT.getHandle()); idPoly3dLP.moveToTop(); } idPoly3dFL.setXData(handles, apps.lnkBrks3); SnapMode.setOSnap(snapMode); tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC.cs: line: 123"); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdBC.cs: line: 128"); } }
BLO() { bool escape; PromptStatus ps; double deltaZ = Pub.offV; if (deltaZ == 0) { deltaZ = 0.50; } escape = UserInput.getUserInput(string.Format("\nElevation Offset <{0}>", deltaZ), out deltaZ, deltaZ); if (escape) { return; } double deltaXY = Pub.offH; if (deltaXY == 0) { deltaXY = 2.0; } escape = UserInput.getUserInput(string.Format("\nHorizontal Offset <{0}>", deltaXY), out deltaXY, deltaXY); if (escape) { return; } Pub.offV = deltaZ; Pub.offH = deltaXY; ObjectId id = ObjectId.Null; string prompt = ""; Point3d pnt3dBase = Pub.pnt3dO; Point3d pnt3dLast = Pub.pnt3dO; prompt = "\nSelect First Point: "; string resElev1 = UserInput.getCogoPoint(prompt, out id, Pub.pnt3dO, osMode: 8); if (resElev1 == string.Empty) { return; } Point3d pnt3d1 = id.getCogoPntCoordinates(); string desc1 = id.getCogoPntDesc(); prompt = "\nSelect Second Point: "; string resElev2 = UserInput.getCogoPoint(prompt, out id, pnt3d1, osMode: 8); if (resElev2 == string.Empty) { return; } Point3d pnt3d2 = id.getCogoPntCoordinates(); string desc2 = id.getCogoPntDesc(); Point3d pnt3dX = UserInput.getPoint("Pick a point on side to offset to: ", out ps, osMode: 0); double dist = pnt3d1.getDistance(pnt3d2); double slope = (gp.pnt3d2.Z - gp.pnt3d1.Z) / dist; double dir = pnt3d1.getDirection(pnt3d2); if (pnt3dX.isRightSide(pnt3d1, pnt3d2)) { dir = dir - System.Math.PI / 2; } else { dir = dir + System.Math.PI / 2; } Point3d pnt3d1X = pnt3d1.traverse(dir, deltaXY); Point3d pnt3d2X = pnt3d2.traverse(dir, deltaXY); pnt3d1X = new Point3d(pnt3d1X.X, pnt3d1X.Y, pnt3d1X.Z + deltaZ); pnt3d2X = new Point3d(pnt3d2X.X, pnt3d2X.Y, pnt3d2X.Z + deltaZ); uint pntNum = 0; ObjectId idCgPnt1 = pnt3d1X.setPoint(out pntNum, desc1); ObjectId idCgPnt2 = pnt3d2X.setPoint(out pntNum, desc2); List <ObjectId> ids = new List <ObjectId> { idCgPnt1, idCgPnt2 }; ObjectId idPoly = ObjectId.Null; BrkLine.makeBreakline(apps.lnkBrks, "BLO", out idPoly, ids); }
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"); } } }
processArcs(List <Arc> arcs, List <arcInfo> arcInfos, Arc arc0, List <ObjectId> idsCgPnt, string nameCmd, List <double> offHs, List <double> offVs) { ObjectId idPoly = ObjectId.Null; List <Handle> handles = new List <Handle>(); ObjectId idFL = ObjectId.Null; for (int y = 0; y < arcs.Count; y++) { Arc arc = arcs[y]; List <Point3d> pnts3d = new List <Point3d>(); for (int p = 0; p < arcInfos.Count - 1; p++) { Vector3d v3dBeg = new Vector3d(0, 0, 0); Vector3d v3dEnd = new Vector3d(0, 0, 0); for (int a = 0; a < y + 1; a++) { v3dBeg += arcInfos[p].v3ds[a]; v3dEnd += arcInfos[p + 1].v3ds[a]; } Point3d pnt3dBeg = arcInfos[p].idCgPnt.getCogoPntCoordinates(); pnt3dBeg += v3dBeg; Point3d pnt3dEnd = arcInfos[p + 1].idCgPnt.getCogoPntCoordinates(); pnt3dEnd += v3dEnd; double dist = arcInfos[p].distToNext * arcs[y].Length / arc0.Length; double grd = (pnt3dEnd.Z - pnt3dBeg.Z) / dist; double staBeg = arcInfos[p].distFromBeg * arcs[y].Length / arc0.Length; arc.traverse(pnt3dBeg, grd, dist, staBeg, ref pnts3d); } ObjectId idBrk = ObjectId.Null; if (y == 0) { idFL = BrkLine.makeBreakline(apps.lnkBrks3, nameCmd, out idPoly, idsCgPnt, pnts3dL: pnts3d); foreach (ObjectId id in idsCgPnt) { id.updatePntXData(idFL, apps.lnkBrks2); } } else { idBrk = BrkLine.makeBreakline(apps.lnkBrks, nameCmd, out idPoly, idsCgPnt, pnts3dL: pnts3d); Grading_Dict.addBrksToPntXDict(idFL, idBrk, offHs[y], offVs[y], 0.0, -1); if (y == 2) { using (Transaction tr = BaseObjs.startTransactionDb()) { BlockTableRecord ms = Blocks.getBlockTableRecordMS(); idPoly = arcs[2].convertArcToPolyline("GB"); tr.Commit(); } idPoly.moveBottom(); idBrk.moveToTop(); } handles.Add(idBrk.getHandle()); } BaseObjs.updateGraphics(); } idFL.setXData(handles, apps.lnkBrks3); }
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" } }