checkBldgElev(string strAlignName) { TinSurface objSurface = null; bool exists = false; try { ObjectId idLayer = Layer.manageLayers(fStake.GCAL_LAYER); BaseObjs.regen(); } catch (System.Exception) { Stake_GetSurfaceCPNT.getSurfaceFromXRef("STAKE", "STAKE"); objSurface = Surf.getTinSurface("CPNT-ON", out exists); } Alignment objAlign = Align.getAlignment(strAlignName); string.Format("\"Test Building No. {0} :\n", strAlignName); Form.ControlCollection objCntrls = default(Form.ControlCollection); Control objCntrl = default(Control); if (checkBldgElevs(objAlign.ObjectId)) { objCntrls = (Form.ControlCollection)fGrid.Frame08.Controls; objCntrl = objCntrls[strAlignName]; objCntrl.BackgroundImage = System.Drawing.Image.FromFile("R:\\TSET\\VBA\\CHECK.bmp"); objCntrls = (Form.ControlCollection)fGrid.Frame10.Controls; objCntrl = objCntrls[string.Format("cmd{0}", strAlignName.Substring(5))]; objCntrl.Enabled = true; } else { objCntrls = (Form.ControlCollection)fGrid.Frame08.Controls; objCntrl = objCntrls[strAlignName]; objCntrl.BackgroundImage = System.Drawing.Image.FromFile("R:\\TSET\\VBA\\X.bmp"); objCntrls = (Form.ControlCollection)fGrid.Frame10.Controls; objCntrl = objCntrls[string.Format("cmd{0}", strAlignName.Substring(5))]; objCntrl.Enabled = false; } }
TP2() { Point3d pnt3d1 = UserInput.getPoint("\nPick Corner 1: ", Pub.pnt3dO, out escaped, out ps, osMode: 0); if (pnt3d1 == Pub.pnt3dO) { return; } Point3d pnt3d2 = UserInput.getPoint("\nPick Baseline direction: ", pnt3d1, out escaped, out ps, osMode: 0); if (pnt3d1 == Pub.pnt3dO) { return; } Vector2d v2dX = pnt3d2.Convert2d(BaseObjs.xyPlane) - pnt3d1.Convert2d(BaseObjs.xyPlane); Vector2d v2dY = v2dX.RotateBy(System.Math.PI / 2); Vector3d v3dY = new Vector3d(v2dY.X, v2dY.Y, 0); Point3d pnt3dY = pnt3d1 + v3dY; Matrix3d m3d = UCsys.addUCS(pnt3d1, pnt3d2, "temp"); Point3d pnt3d0 = Db.wcsToUcs(pnt3d1); Polyline poly = jigPolylineArea(pnt3d0); UCsys.setUCS2World(); poly.ObjectId.transformToWcs(BaseObjs._db); escaped = UserInput.getUserInputDoubleAsString("\nEnter Elevation: ", out elev, elev); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Slope: ", out slope, slope); if (escaped) { return; } double dblSlope = double.Parse(slope); Point3d pnt3dCEN = poly.getCentroid(); Point3d pnt3dTAR = UserInput.getPoint("\nPick edge of polygon in the Direction of Increasing Slope: ", pnt3dCEN, out escaped, out ps, osMode: 641); if (pnt3dTAR == Pub.pnt3dO) { return; } ObjectIdCollection idspoly3d = new ObjectIdCollection(); double dblDist = 0.0; ObjectId idPoly3d = ObjectId.Null; pnt3dCEN = pnt3dCEN.addElevation(double.Parse(elev)); if (pnt3dTAR != Pub.pnt3dO) { dblDist = pnt3dCEN.getDistance(pnt3dTAR); } string nameLayer = string.Format("{0}-BORDER", "BASIN"); Layer.manageLayers(nameLayer); int numObj = 0; bool exists = false; ObjectId idDict = Dict.getNamedDictionary(apps.lnkBrks, out exists); if (exists) { numObj = idDict.getDictEntries().Count; } string nameSurf = string.Format("{0}{1}", "BASIN", numObj.ToString("00")); ObjectId idDictObj = Dict.addSubDict(idDict, nameSurf); using (BaseObjs._acadDoc.LockDocument()) { if (pnt3dTAR != Pub.pnt3dO) { pnt3dTAR = new Point3d(pnt3dTAR.X, pnt3dTAR.Y, pnt3dCEN.Z + dblDist * dblSlope); idPoly3d = Base_Tools45.C3D.DrawBasinBot.build3dPolyBasinBot(poly.ObjectId, pnt3dCEN, pnt3dTAR, dblSlope, nameLayer, apps.lnkBrks); } else { idPoly3d = Conv.poly_Poly3d(poly.ObjectId, double.Parse(elev), nameLayer); } idspoly3d.Add(idPoly3d); TinSurface surf = Surf.addTinSurface(nameSurf, out exists); if (exists) { Application.ShowAlertDialog(string.Format("Surface Name conflict - surface \"{0}\" already exists. Exiting...", nameSurf)); return; } surf.BreaklinesDefinition.AddStandardBreaklines(idspoly3d, 1.0, 0.0, 0.0, 0.0); surf.Rebuild(); } using (BaseObjs._acadDoc.LockDocument()) { BaseObjs.regen(); } }
getRadial_Perpendicular(Point3d pnt3dTar, Entity obj) { double dblAng = 0, dblLC = 0, dblM = 0; Point3d pnt3dPolar = Pub.pnt3dO, pnt3dInt = Pub.pnt3dO; Point3dCollection varPntInt = new Point3dCollection(); Line objLineDir = null; ObjectId idLineDir = ObjectId.Null; List <ObjectId> idList = new List <ObjectId>(); switch (obj.GetType().ToString()) { case "Arc": Arc objArc = (Arc)obj; Point3d pnt3dCen = objArc.Center; if (System.Math.Round(pnt3dCen.getDistance(pnt3dTar), 1) != 0) { idLineDir = Draw.addLine(pnt3dCen, pnt3dTar); objLineDir = (Line)idLineDir.getEnt(); objLineDir.IntersectWith(objArc, Intersect.ExtendThis, varPntInt, IntPtr.Zero, IntPtr.Zero); idLineDir.delete(); pnt3dInt = varPntInt[0]; } else { Point3d pnt3dBeg = objArc.StartPoint; Point3d pnt3dEnd = objArc.EndPoint; dblAng = pnt3dBeg.getDirection(pnt3dEnd); dblLC = pnt3dBeg.getDistance(pnt3dEnd); pnt3dPolar = pnt3dBeg.traverse(dblAng, dblLC / 2); dblM = objArc.Radius * (1 - System.Math.Cos(objArc.TotalAngle / 2)); pnt3dInt = pnt3dPolar.traverse(dblAng - PI / 2, dblM); } break; case "Line": Line objline = (Line)obj; dblAng = objline.Angle + PI / 2; pnt3dPolar = pnt3dTar.traverse(dblAng, 1); idLineDir = Draw.addLine(pnt3dTar, pnt3dPolar); objLineDir.IntersectWith(objline, Intersect.ExtendThis, varPntInt, IntPtr.Zero, IntPtr.Zero); idLineDir.delete(); pnt3dInt = varPntInt[0]; break; case "Polyline2d": Polyline2d objPoly2d = (Polyline2d)obj; break; case "Polyline3d": Polyline3d obj3dPoly = (Polyline3d)obj; break; case "Polyline": Polyline objLWPoly = (Polyline)obj; ObjectId idPoly = objLWPoly.ObjectId; idPoly.changeProp(nameLayer: "STAKE-TEMP"); DBObjectCollection varEnts = new DBObjectCollection(); objLWPoly.Explode(varEnts); objLWPoly.ObjectId.delete(); Layer.manageLayer(fStake.CNTL_LAYER, layerFrozen: true); Point3d varPntPik = fMisc.PICK_PNT; TypedValue[] tvs = new TypedValue[5]; tvs.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"), 0); tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Arc)).DxfName), 1); tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Line)).DxfName), 2); tvs.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"), 3); tvs.SetValue(new TypedValue((int)DxfCode.LayerName, "STAKE-TEMP"), 4); Point3dCollection pnts3dBox = new Point3dCollection { new Point3d(varPntPik.X - 1, varPntPik.Y - 1, 0), new Point3d(varPntPik.X + 1, varPntPik.Y - 1, 0), new Point3d(varPntPik.X + 1, varPntPik.Y + 1, 0), new Point3d(varPntPik.X - 1, varPntPik.Y + 1, 0) }; SelectionSet ss = Select.buildSSet(tvs, pnts3dBox); ObjectId[] ids = ss.GetObjectIds(); for (int i = 0; i < ids.Length; i++) { idList.Add(ids[i]); } Layer.manageLayer(fStake.CNTL_LAYER, layerFrozen: false); if (ids.Count() == 1) { obj = ids[0].getEnt(); } switch (obj.GetType().ToString()) { case "Arc": objArc = (Arc)obj; pnt3dCen = objArc.Center; if (System.Math.Round(pnt3dCen.getDistance(pnt3dTar), 1) != 0) { idLineDir = Draw.addLine(pnt3dCen, pnt3dTar); objLineDir = (Line)idLineDir.getEnt(); objLineDir.IntersectWith(objArc, Intersect.ExtendThis, varPntInt, IntPtr.Zero, IntPtr.Zero); idLineDir.delete(); pnt3dInt = varPntInt[0]; } else { Point3d pnt3dBeg = objArc.StartPoint; Point3d pnt3dEnd = objArc.EndPoint; dblAng = pnt3dBeg.getDirection(pnt3dEnd); dblLC = pnt3dBeg.getDistance(pnt3dEnd); pnt3dPolar = pnt3dBeg.traverse(dblAng, dblLC / 2); dblM = objArc.Radius * (1 - System.Math.Cos(objArc.TotalAngle / 2)); pnt3dInt = pnt3dPolar.traverse(dblAng - PI / 2, dblM); } break; case "Line": objline = (Line)obj; dblAng = objline.Angle + PI / 2; pnt3dPolar = pnt3dTar.traverse(dblAng, 1); idLineDir = Draw.addLine(pnt3dTar, pnt3dPolar); objLineDir = (Line)idLineDir.getEnt(); objLineDir.IntersectWith(objline, Intersect.ExtendThis, varPntInt, IntPtr.Zero, IntPtr.Zero); idLineDir.delete(); pnt3dInt = varPntInt[0]; break; } foreach (DBObject dbObj in varEnts) { idList.Add(dbObj.ObjectId); } foreach (ObjectId id in idList) { id.delete(); } break; } BaseObjs.regen(); return(pnt3dInt); }