Fix EPset_Drawing.BringToFront not applying to merged cut geometry - #9318
Open
theoryshaw wants to merge 1 commit into
Open
Fix EPset_Drawing.BringToFront not applying to merged cut geometry#9318theoryshaw wants to merge 1 commit into
theoryshaw wants to merge 1 commit into
Conversation
merge_linework_and_add_metadata created its merged groups with
etree.Element("g"), which puts them outside the SVG namespace.
move_elements_to_top then looks for them with ".//svg:g[...]", so
EPset_Drawing.BringToFront never matched the merged cut and material
layer groups - i.e. exactly the groups holding the filled, closed
polygons that do the occluding. Listed elements failed to hide what was
behind them.
This is invisible in the written file: lxml serialises an unnamespaced
<g> inside an SVG-default-namespace parent as plain <g class="...">
without xmlns="", so on re-parse it is SVG-namespaced. The mismatch only
exists in memory, during the session where it matters.
Creating the group and path in the SVG namespace leaves the serialised
output byte-identical and makes them visible to the later XPath queries.
Fixes IfcOpenShell#9317
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 #9317
EPset_Drawing.BringToFrontonly reordered some of an element's SVG groups. The ones it missed were the merged cut and material-layer groups — i.e. exactly the groups holding the filled, closed polygons that do the occluding — so a listed element failed to hide anything behind it.merge_linework_and_add_metadatacreated those groups withetree.Element("g"), which puts them outside the SVG namespace.move_elements_to_toplooks for them with.//svg:g[contains(@class, '...')], which cannot match an unnamespaced element.The reason this went unnoticed is that it is invisible in the written file. lxml serialises an unnamespaced
<g>inside an SVG-default-namespace parent as plain<g class="...">— noxmlns=""— so on re-parse the element is SVG-namespaced. The mismatch exists only in memory, during the one session where it matters:Creating the group and path in the SVG namespace leaves the serialised output byte-identical and makes them visible to the later XPath queries.
Before / after
Test case: a section with
EPset_Drawing.BringToFront = "IfcSlab", where the slab passes through a wall.Group order before — only the serializer's
projectiongroup (correctly namespaced) reaches the end; the two mergedIfcSlabcut groups stay underneath the wall:After, all
IfcSlabgroups are moved to the end and the slab correctly occludes the wall. (The remaining sliver of wall on the far side is correct — the slab genuinely does not extend that far.)Not addressed here
There are two more unnamespaced
etree.Element("path")calls in the same file (the SHAPELYsurfacefills and theIfcSpacepass). Nothing queries them in-memory afterwards, so they are latent rather than broken; left alone to keep this change minimal.🤖 Generated with Claude Code