Conversation
Drawings are styled with CSS. Every element already gets a generated class list (IFC class, material, predefined type, drawing metadata keys), and annotations could additionally carry hand written classes in EPset_Annotation.Classes, read by SvgWriter. Regular building elements had no such channel, so there was no way to make one slab dash and another fill grey without hand editing the property set and the stylesheet. CreateDrawing.get_svg_classes now reads the same EPset_Annotation.Classes property, so custom classes reach cut, projection, surface and space geometry too. SvgWriter reuses the shared tool.Drawing helper instead of its own lookup. A Drawing Classes panel on the object tab assigns and unassigns those classes across the selection, offering the line weight, line style and fill classes that default.css ships, plus free text for stylesheet authors. default.css gains matching element level rules, declared last so they override the class, material and predefined type rules above them. No new rendering path is introduced. The classes land in the same class attribute and are resolved by the same stylesheet, so existing custom CSS keeps working and can select on the new classes. Generated with the assistance of an AI coding tool.
This was referenced Sep 9, 2026
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.
Fixes #6425 (D&D Phase 1 Item 04, funded via the OSArch campaign linked by @theoryshaw).
@jes-r asked for a way to make one slab draw with dashed contours while another draws as a filled grey area, reusing the predefined line types rather than a new styling mechanism.
Drawings are already styled with CSS, and
CreateDrawing.get_svg_classesalready emits a class list per element. What was missing is a per-element channel:EPset_Annotation.Classesexisted but was read only for annotations, had no UI, anddefault.cssscoped its line types to.PredefinedType-LINEWORKso they never reached building elements.This makes
get_svg_classesread the same property, so custom classes reach cut, projection, surface and space geometry, and adds a Drawing Classes panel on the object tab to assign and unassign them across the selection.default.cssgains matching element-level rules for line weight, line style and fill (declared last so they override class/material/predefined-type rules, while the existing.PredefinedType-LINEWORK.*rules keep winning for linework by specificity).SvgWriternow shares the tool helper instead of duplicating the lookup.This deliberately reuses the CSS pipeline rather than adding a second one. The classes land in the same class attribute and are resolved by the same stylesheet, so existing custom stylesheets keep working and can select on the new classes. The presets in the menu are a convenience only, any class name may be typed.
One point worth a maintainer opinion: the property reused is
EPset_Annotation.Classes, which now appears on regular products. Introducing a separate product-level property felt like a parallel mechanism for the same concept, but happy to rename if preferred.Test plan
Verified in headless Blender by generating a real drawing with two slabs, one assigned
dashedand onefill-grey. The outputPLAN_VIEW.svgcontainsclass="IfcSlab material-null dashed projection"andclass="IfcSlab material-null fill-grey projection"(plus the cut group), with the embedded stylesheet carrying.dashed { stroke-dasharray: 3, 2; }and.fill-grey { fill: #aaaaaa; }— jes-r's own example working end to end.Also verified: class sanitisation, storage in the pset, persistence through save and reopen, per-element separation in
get_svg_classes, every UI preset having a matchingdefault.cssrule, removal, and panel/menu registration.test/core/test_drawing.py43 passed; newTestElementClassescases pass; black+ruff clean.Siblings #6423 (extra parametric lines) and #6424 (elements hidden behind others) are not addressed here. Per-drawing overrides (element X dashed only in drawing Y) are also out of scope — today's model is per-element and global, and whether the funders expect per-drawing scoping is worth a maintainer's call.
This PR contains AI-generated code, generated with the assistance of an AI coding tool.