makeSurface(string strSurfaceName) { SelectionSet objSSet = EW_Utility1.buildSSet2a(strSurfaceName); if (objSSet == null || objSSet.Count == 0) { return; } ObjectId[] ids = objSSet.GetObjectIds(); ObjectIdCollection idsBrks = new ObjectIdCollection(); foreach (ObjectId id in ids) { idsBrks.Add(id); } EW_CheckSurfaceStyles.checkSurfaceStyles(strSurfaceName); TinSurface objSurface = Surf.getTinSurface(strSurfaceName); if (objSurface == null) { return; } objSurface.ObjectId.delete(); objSurface = Surf.addTinSurface(strSurfaceName, out exists); objSurface.BreaklinesDefinition.AddStandardBreaklines(idsBrks, 1.0, 0, 0, 0); objSurface.BuildOptions.CrossingBreaklinesElevationOption = Autodesk.Civil.CrossingBreaklinesElevationType.UseAverage; SelectionSet objSSetLim = EW_Utility1.buildSSetGradingLim(); if (objSSetLim.Count == 0) { MessageBox.Show("GRADING LIMIT not found - OUTER BOUNDARY not added."); return; } ObjectId idLWPline = objSSetLim.GetObjectIds()[0]; Conv.processBndry(idLWPline); ObjectId[] id3dPoly = { Conv.poly_Poly3d(idLWPline, 0, "0") }; objSurface.BoundariesDefinition.AddBoundaries(new ObjectIdCollection(id3dPoly), 1.0, Autodesk.Civil.SurfaceBoundaryType.Outer, true); objSurface.Rebuild(); id3dPoly[0].delete(); }
public static void makeSurfaceBOT() { string strSurfaceName = "BOT"; EW_CheckSurfaceStyles.checkSurfaceStyles(strSurfaceName); Surf.removeSurface("BOT"); TinSurface objSurfaceBOT = Surf.addTinSurface("BOT", out exists); ObjectId idCivilPntGrp = CgPnt_Group.checkPntGroup("BOT"); objSurfaceBOT.PointGroupsDefinition.AddPointGroup(idCivilPntGrp); SelectionSet objSSet = EW_Utility1.buildSSet13(); ObjectId[] idsBrksArray = objSSet.GetObjectIds(); ObjectIdCollection idsBrks = new ObjectIdCollection(); foreach (ObjectId id in idsBrksArray) { idsBrks.Add(id); } objSurfaceBOT.BreaklinesDefinition.AddStandardBreaklines(idsBrks, 1.0, 0, 0, 0); ObjectId idLWPline = EW_Utility1.buildSSetGradingLim().GetObjectIds()[0]; if (idLWPline != ObjectId.Null) { ObjectIdCollection ids = new ObjectIdCollection(); ids.Add(idLWPline); objSurfaceBOT.BoundariesDefinition.AddBoundaries(ids, 1, Autodesk.Civil.SurfaceBoundaryType.Outer, true); objSurfaceBOT.Rebuild(); } else { MessageBox.Show("GRADING LIMIT not found - OUTER BOUNDARY not added."); } }
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(); } }