Sliced object in vertical aligment view
Dear all,
I am looking for means to visually represent solids within vertical alignment views as illustrated below. Generating a stepped section along a curved alignement seems not possible due to changing length.
I have asked this elsewhere, but maybe somebody has got it working somehow. A mix between section views and station-based vertical alignment views in-effect.
Best
Seb
a#
b#
Comments
-
Not quite sure what it is your trying to show. You probably need to do the section view based on a Z plane then add it to your vertical profile. The tricky bit is working out say a chainage point for say left corner and what is the Z value of that corner, you can then apply vertical scale factor to the section if required.
Can you post a sample dwg
, with 3Dsolid, section and vertical profile.
0 -
Cheers for taking the time and responding. Please find a sample file attached. I have drawn and shifted sectionplanes manually for the time being. For generating sectionplanes programmatically I have to make up my mind. From a user perspective I want to select the vertical alignment view and then only the entities I want to project.
0 -
Ok I managed to get to something like this. It took a little while to get to the image. Here is how I did it.
1st got the Z value of lowest point of solid.
I used the section command and a circle, you must make sure the circle is drawn in correct plane direction and I used roatet3d to stand it up. This made the section. Do a google for some utubes.
I rotated the section using roatet3d to make it flat in a plan view. And re-aligned to horizontal.
I then placed the section matching the correct distance along the vertical alignment and at the correct Z. Ps did not really do that.
So got this result.
In automating this need to get the practicality of doing it manually then apply that to say a program, one step at a time, for me a lisp. If you can work out some of the steps then I can help you. I say help as nothing is nice and ortho to X & Y axis.
0 -
@ALANH
thanks for taking the time. I also advanced a bit cheers to pyrx relating solids to stationing of an alignment programmatically. I will publish here when done.
0 -
If you get the centroid of the solid you may be able to use in lisp (Vlax-curve-getclosestpointto align centroid) you can then getdistatpoint which would be a chainage along the alignment.
0 -
Dirty scripting, but working:
import traceback import math from pyrx import Ge, Db, Ap, Br, Ed, Cv def create_section(db: Db.Database, pts: list[Ge.Point3d], ids: list[Db.ObjectId], name: str, height: float) -> Db.Section: smid = db.getSectionManagerId() sm = Db.SectionManager(smid) for id in sm.objectIds(): ent = Db.Section(id, Db.OpenMode.kForWrite) if ent.getName() == name: ent.erase() sec = Db.Section(pts, Ge.Vector3d.kZAxis) sec.setState(Db.SectionState.kPlane) sec.enableLiveSection(False) sec.setHeight(Db.SectionHeight.kHeightAboveSectionLine, height) sec.setHeight(Db.SectionHeight.kHeightBelowSectionLine, height) sec.setName(name) secid = db.addToModelspace(sec) ss = Db.SectionSettings(sec.getSettings(), Db.OpenMode.kForWrite) ss.setCurrentSectionType(Db.SectionType.k2dSection) ss.setSourceObjects(Db.SectionType.k2dSection, ids) ss.setVisibility(Db.SectionType.k2dSection, Db.SectionGeometry.kBackgroundGeometry, True) ss.setHiddenLine(Db.SectionType.k2dSection, Db.SectionGeometry.kBackgroundGeometry, False) opts = Db.SectionGeneration.kSourceSelectedObjects | Db.SectionGeneration.kDestinationFile ss.setGenerationOptions(Db.SectionType.k2dSection, Db.SectionGeneration(opts)) return sec def create_section_block(db: Db.Database, name: str, entities: list[Db.Entity]) -> Db.ObjectId: bt = Db.BlockTable(db.blockTableId(), Db.OpenMode.kForWrite) if bt.has(name): ent = Db.BlockTableRecord(bt.getAt(name), Db.OpenMode.kForWrite) ent.erase() btr = Db.BlockTableRecord() btr.setName(name) btrid = bt.add(btr) btr.appendAcDbEntities(entities) return btrid def create_block_ref(db: Db.Database, btrid: Db.ObjectId, coords: Ge.Point3d, scale: Ge.Scale3d) -> Db.ObjectId: block_ref = Db.BlockReference(coords, btrid) block_ref.setScaleFactors(scale) model = Db.BlockTableRecord(db.modelSpaceId(), Db.OpenMode.kForWrite) return model.appendAcDbEntity(block_ref) @Ap.Command() def doit15(): try: db = Db.curDb() # Select solid and vertical alignment view es = Ed.Editor.entSel("\nSelect: ", Db.Solid3d.desc()) if es[0] != Ed.PromptStatus.eOk: raise RuntimeError("Yeet! {}: ".format(es[0])) source_ids = [es[1]] es = Ed.Editor.entSel("\nSelect Vertical Alignment View: ", Cv.CvDbVAlignmentView.desc()) if es[0] != Ed.PromptStatus.eOk: raise RuntimeError("Yeet! {}: ".format(es[0])) # Prepare info vAlignView = Cv.CvDbVAlignmentView(es[1]) hAlign = Cv.CvDbHAlignment(vAlignView.baseHAlignment()) stationEq = hAlign.stationEquations() fs = stationEq.getStartingStation() ls = stationEq.getStation(stationEq.getRawStationFromLength(hAlign.length())) min_sta, max_sta = ls, fs zmin, zmax = -math.inf, math.inf base = vAlignView.baseElevation() top = base + (vAlignView.height() / vAlignView.verticalScale()) scalev = vAlignView.verticalScale() scaleh = vAlignView.horizontalScale() # Traverse vertices in solid for source_id in source_ids: solid = Db.Solid3d(source_id) vt = Br.VertexTraverser(Br.Brep(solid)) for vtx in vt.getVertexs(): pt = vtx.getPoint() closest = hAlign.getClosestPointTo(pt) found, station, proxi = hAlign.getStationAtPoint(Ge.Point2d(closest.x, closest.y)) if found: min_sta = min(min_sta, station) max_sta = max(max_sta, station) zmin = min(zmin, pt.z) zmax = max(zmax, pt.z) if zmax < base or zmin > top: print("\nSection outside of view, not plotting") return # Create section line start_pt = hAlign.getPointAtStation(min_sta)[1] end_pt = hAlign.getPointAtStation(max_sta)[1] mid_z = (top + base) / 2 pts = [Ge.Point3d(start_pt.x, start_pt.y, mid_z), Ge.Point3d(end_pt.x, end_pt.y, mid_z)] sec_height = mid_z - base name = f"{vAlignView.name()} - {station:08.1f}" sec = create_section(db, pts, source_ids, name, sec_height) # Create and transform section block mat = Ge.Matrix3d().setToAlignCoordSys( Ge.Point3d(pts[0].x, pts[0].y, pts[0].z), sec.plane()[0], sec.verticalDirection(), sec.viewingDirection(), Ge.Point3d.kOrigin, Ge.Vector3d.kXAxis, Ge.Vector3d.kYAxis, Ge.Vector3d.kZAxis ) section_geo = [] for source_id in source_ids: ent = Db.Entity(source_id) for items in sec.generateSectionGeometry(ent): section_geo.extend(item.getTransformedCopy(mat) for item in items) blkid = create_section_block(db, name, section_geo) # Determine insert point and create blockref pt = vAlignView.toWCSPoint2d(Ge.Point2d(min_sta/scaleh, base + sec_height)) create_block_ref(db, blkid, Ge.Point3d(pt.x, pt.y, 0), Ge.Scale3d(1*scaleh, 1*scalev, 1.0)) except Exception as err: traceback.print_exception(err)
0