Conversation
Bonsai already writes an Axis representation for walls (Plan/Axis/GRAPH_VIEW) and for every profile based member such as beams and columns (Model/Axis/GRAPH_VIEW), but CreateDrawing.get_linework_contexts only ever collected Body, Facetation and Annotation subcontexts, so that centreline geometry could never reach a drawing. Users were tracing centrelines by hand as separate annotations for every element. Collect the Axis subcontexts into a third linework bucket and, when the drawing opts in via EPset_Drawing.HasAxisLinework, project them into the linework SVG as their own groups classed "axis" alongside the element's usual classes. Styling then goes through the existing CSS channel, with a centreline dash pattern added to default.css. The pass is off by default, so existing drawings are unchanged. Generated with the assistance of an AI coding tool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the OSArch-funded Drawings & Documentation Phase 1 programme. Fixes #6423 (D&D Phase 1 Item 02).
The issue asks for "an option to add custom lines to elements", with "centerlines for beams" as the headline example, and notes that today "I'm manually adding lines to get the centerlines etc to show up for every element. I think this should be automatic!"
It turns out most of this already exists. Bonsai writes an
Axisrepresentation for walls (Plan/Axis/GRAPH_VIEW) and for every profile-based member such as beams and columns (Model/Axis/GRAPH_VIEW), and the Representations panel already lets a user add and edit an Axis representation on any element. The gap was purely on the output side:CreateDrawing.get_linework_contextsonly collectedBody,FacetationandAnnotationsubcontexts, so that centreline geometry could never reach a drawing.This collects the Axis subcontexts into a third linework bucket and, when the drawing opts in via
EPset_Drawing.HasAxisLinework, projects them into the linework SVG as their own groups classedaxisalongside the element's usual classes. Styling goes through the existing CSS channel, with a centreline dash pattern added todefault.css. A checkbox sits next to Underlay / Linework / Annotation. The pass runs aftermerge_linework_and_add_metadata, which would otherwise reclassify the groups as cut/projection.Off by default, so existing drawings are unchanged.
Test plan
Verified in headless Blender through the real operators:
HasAxisLinework, SVG contains onlyprojectionandcutgroups.EPset_Drawing.HasAxisLinework = Trueinto the IFC and round-trips through write and reopen.Plan/AxisCurve2D (authored via the realgeometry.add_axis_representationAPI):bim.create_drawingemits<g class="IfcWall material-null axis">with the wall's GlobalId; a 4 m axis at 1:100 came out asM230.0,250.0 L270.0,250.0, i.e. 40 mm long and centred on the 500 mm sheet.Model/AxisCurve3D: two correctly projected segments — the "centerlines for beams" case, confirming multi-segment and 3D axes..axisCSS rule present in the composited sheet SVG.test/core/test_drawing.py41 passed,test/tool/test_drawing.py87 passed; black+ruff clean.Not covered here
FREESTYLE linework mode (different SVG path), and synthesising centrelines for element classes that carry no Axis representation (slabs, doors, windows) — Bonsai never authors one for those, and deriving one is a separate design question.
The issue's "a line on an other arbitrary position" could mean per-element reference lines, per-element-type lines propagating to occurrences, or rule-driven generated lines. This adds the output channel that serves all three, and the first already works today through the Representations panel plus this change; the other two need UX decisions worth confirming with @jes-r before building.
This PR contains AI-generated code, generated with the assistance of an AI coding tool.