René's URL Explorer Experiment


Title: Iterator with hybrid-cgal-simple-opencascade drops the opening cut on elements with a MappedRepresentation body · Issue #10049 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Iterator with hybrid-cgal-simple-opencascade drops the opening cut on elements with a MappedRepresentation body · Issue #10049 · IfcOpenShell/IfcOpenShell

X Title: Iterator with hybrid-cgal-simple-opencascade drops the opening cut on elements with a MappedRepresentation body · Issue #10049 · IfcOpenShell/IfcOpenShell

Description: Bug Description With hybrid-cgal-simple-opencascade (Bonsai's default geometry library) or cgal-simple, ifcopenshell.geom.iterator returns an empty shape for an element that has an opening and a MappedRepresentation body: 0 vertices, not...

Open Graph Description: Bug Description With hybrid-cgal-simple-opencascade (Bonsai's default geometry library) or cgal-simple, ifcopenshell.geom.iterator returns an empty shape for an element that has an opening and a Ma...

X Description: Bug Description With hybrid-cgal-simple-opencascade (Bonsai's default geometry library) or cgal-simple, ifcopenshell.geom.iterator returns an empty shape for an element that has an opening and ...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/10049

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Iterator with hybrid-cgal-simple-opencascade drops the opening cut on elements with a MappedRepresentation body","articleBody":"### Bug Description\n\nWith `hybrid-cgal-simple-opencascade` (Bonsai's default geometry library) or `cgal-simple`, `ifcopenshell.geom.iterator` returns an empty shape for an element that has an opening and a `MappedRepresentation` body: 0 vertices, nothing logged. Any typed occurrence whose body is mapped from its type is affected. `create_shape` with the same library cuts the opening correctly, and so does the iterator with `opencascade`, `cgal` or `hybrid-cgal-opencascade`. An element with the same box as a direct (unmapped) body also voids correctly.\n\nIn Bonsai this shows up as an element that disappears when you void it. For example, select a typed `IfcStair` and run:\n\n```python\nbpy.ops.bim.add_element(ifc_product=\"IfcFeatureElement\", ifc_class=\"IfcOpeningElement\", skip_dialog=True)\n```\n\nThe stair gets its `IfcRelVoidsElement`, then `tool.Geometry.reimport_element_representations` reloads it through the iterator and builds an empty mesh. Reopening the file goes through the same iterator.\n\n### Minimal reproduction\n\nThe script builds the file from scratch. It creates an `IfcFurnitureType` with a 2 × 1 × 1 m extruded box, an occurrence (mapped via `assign_type`, or with the same box assigned directly as a control) and a 0.5 m opening through the middle:\n\n\u003cdetails>\u003csummary>repro_mapped_opening.py\u003c/summary>\n\n```python\nimport multiprocessing\n\nimport numpy as np\nimport ifcopenshell\nimport ifcopenshell.api.context\nimport ifcopenshell.api.feature\nimport ifcopenshell.api.geometry\nimport ifcopenshell.api.project\nimport ifcopenshell.api.root\nimport ifcopenshell.api.type\nimport ifcopenshell.api.unit\nimport ifcopenshell.geom\nimport ifcopenshell.util.shape_builder\n\n\ndef run(mapped):\n    f = ifcopenshell.api.project.create_file(version=\"IFC4\")\n    ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcProject\")\n    ifcopenshell.api.unit.assign_unit(f)\n    model = ifcopenshell.api.context.add_context(f, context_type=\"Model\")\n    body = ifcopenshell.api.context.add_context(\n        f, context_type=\"Model\", context_identifier=\"Body\", target_view=\"MODEL_VIEW\", parent=model\n    )\n    builder = ifcopenshell.util.shape_builder.ShapeBuilder(f)\n\n    # A type with a 2 x 1 x 1 m box body. assign_type gives the occurrence a MappedRepresentation;\n    # the control gives the occurrence the same box directly.\n    element_type = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcFurnitureType\")\n    box = builder.extrude(builder.rectangle(size=np.array((2.0, 1.0))), magnitude=1.0)\n    ifcopenshell.api.geometry.assign_representation(f, element_type, builder.get_representation(body, [box]))\n    element = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcFurniture\")\n    ifcopenshell.api.geometry.edit_object_placement(f, product=element)\n    if mapped:\n        ifcopenshell.api.type.assign_type(f, related_objects=[element], relating_type=element_type)\n    else:\n        ifcopenshell.api.geometry.assign_representation(f, element, builder.get_representation(body, [box]))\n\n    # A 0.5 m cube opening through the middle of the box.\n    opening = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcOpeningElement\")\n    cube = builder.extrude(builder.rectangle(size=np.array((0.5, 0.5))), magnitude=1.5, position=(0.75, 0.25, -0.25))\n    ifcopenshell.api.geometry.assign_representation(f, opening, builder.get_representation(body, [cube]))\n    ifcopenshell.api.geometry.edit_object_placement(f, product=opening)\n    ifcopenshell.api.feature.add_feature(f, feature=opening, element=element)\n\n    print(\"\\nBody:\", element.Representation.Representations[0].RepresentationType)\n    print(f\"{'library':34} {'create_shape':>14} {'iterator':>14}\")\n    settings = ifcopenshell.geom.settings()\n    for library in (\"opencascade\", \"cgal\", \"cgal-simple\", \"hybrid-cgal-opencascade\", \"hybrid-cgal-simple-opencascade\"):\n        results = []\n        try:\n            shape = ifcopenshell.geom.create_shape(settings, element, geometry_library=library)\n            results.append(len(shape.geometry.verts) // 3)\n            iterator = ifcopenshell.geom.iterator(\n                settings, f, multiprocessing.cpu_count(), include=[element], geometry_library=library\n            )\n            assert iterator.initialize()\n            results.append(len(iterator.get().geometry.verts) // 3)\n        except Exception as e:\n            results.append(f\"error: {e}\")\n        print(f\"{library:34} \" + \" \".join(f\"{str(r):>14}\" for r in results))\n\n\nrun(mapped=True)\nrun(mapped=False)\n```\n\n\u003c/details>\n\nVertex counts (16 = the box with the hole cut through it). The output is identical on both builds tested:\n\n| library | mapped body, `create_shape` | mapped body, iterator | direct body, `create_shape` | direct body, iterator |\n|---|---|---|---|---|\n| `opencascade` | 16 | 16 | 16 | 16 |\n| `cgal` | 16 | 16 | 16 | 16 |\n| `cgal-simple` | 0 | 0 | 0 | 0 |\n| `hybrid-cgal-opencascade` | 16 | 16 | 16 | 16 |\n| `hybrid-cgal-simple-opencascade` | 16 | **0** | 16 | 16 |\n\nThe `cgal-simple` row is expected, since that kernel has no booleans. The bold cell is the bug: the hybrid kernel only fails to fall back to OCC when the body is mapped and the shape comes from the iterator.\n\nThe same thing happens with a typed `IfcStair` whose body is an `IfcPolygonalFaceSet` mapped from its type. It isn't specific to extrusions. Whether the opening has an `ObjectPlacement` doesn't matter, and neither do Bonsai's iterator settings (`weld-vertices`, `layerset-first`, `keep-bounding-boxes`, `context-ids`).\n\n### Where it seems to go wrong\n\nMy reading of the code at a298d34894 (v0.9.0). I haven't confirmed it with a debugger.\n\n- [`hybrid_kernel::convert`](https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L51-L79) chooses a kernel by calling `mapping_->find_openings(item->instance)`. `create_shape` converts per product. For a mapped body, the iterator converts the shared representation once (the shape id comes back as the type's representation, `\u003crep>-openings-\u003cid>`, rather than the occurrence's mapped representation). So `find_openings` finds no openings, and the boolean-less `cgal-simple` kernel is allowed to convert the item.\n- Later, `converter.cpp` applies the occurrence's openings ([L161](https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/converter.cpp#L161), [L203](https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/converter.cpp#L203)). [`hybrid_kernel::convert_openings`](https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L106-L129) finds no boolean-capable kernel that `accepts()` a `cgal-simple` shape and returns `false`.\n\nThe `@todo` at [hybrid_kernel.h L58-L63](https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L58-L63) describes this situation (*\"this would fail later on in the find_openings() call, because we have a SimpleCgalShape which cannot be used on a kernel that supports booleans\"*). The direct-body case avoids it because there the item's instance can be looked up for openings.\n\n### Relation to fa4f53feeb / #9393\n\nfa4f53feeb (\"Check convert_openings() status flag\", the same change #9393 proposes) treats the `false` return as an error and keeps the unopened shape. On a build with that commit, I'd expect the element to come back **un-voided** instead of empty: still wrong, but it no longer vanishes. I haven't tested that build; both builds below predate it. So the remaining problem is that the opening is never cut with the default library. Possible directions, both untested:\n\n- In `hybrid_kernel::convert`, also treat an item as having openings when it's a mapped representation used by a product that has openings.\n- When no kernel accepts the shapes in `convert_openings`, convert the item again with the next boolean-capable kernel and cut it there.\n\n### Environment\n\n- Windows 10 x64\n- `ifcopenshell` 0.8.5 from PyPI, Python 3.12\n- `ifcopenshell` 0.9.1-6022a6d, as shipped with Bonsai in Blender 5.1.2 (v0.9.0 branch, before fa4f53feeb)\n\nThis issue (investigation, repro script and text) was prepared with the assistance of an AI coding tool and reviewed by me.\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-10-24T00:49:44Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/10049"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6eb1437f-97f3-8516-a3f5-b8ddeb12d8b3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE878:2102E4:56B4F7:74D7CF:6B049ED0
html-safe-noncededa432721a76fa8525b71fa4e11e8dbf262e178e3529fc30441c110fd25eb16
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODc4OjIxMDJFNDo1NkI0Rjc6NzREN0NGOjZCMDQ5RUQwIiwidmlzaXRvcl9pZCI6IjU0NTI1MjI3NTQyODcxMTU5ODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6db510a4650e9a1ed3fe077fe3d2b7a8664978e1bdaec853fbbcb8651f3245ab
hovercard-subject-tagissue:6007671859
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/10049/issue_layout
twitter:imagehttps://opengraph.githubassets.com/16bc5e1259e6a2187e1709ccb0acaa4c3f2604f2bca33a30902b468db9fd8c2e/IfcOpenShell/IfcOpenShell/issues/10049
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/16bc5e1259e6a2187e1709ccb0acaa4c3f2604f2bca33a30902b468db9fd8c2e/IfcOpenShell/IfcOpenShell/issues/10049
og:image:altBug Description With hybrid-cgal-simple-opencascade (Bonsai's default geometry library) or cgal-simple, ifcopenshell.geom.iterator returns an empty shape for an element that has an opening and a Ma...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
None9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3fd14143b75b2af7b76bbd23b069867d091adfcc
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/10049#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F10049
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F10049
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10049
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10049
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10049
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests937 (937)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
Iterator with hybrid-cgal-simple-opencascade drops the opening cut on elements with a MappedRepresentation bodyhttps://github.com/IfcOpenShell/IfcOpenShell/issues/10049#top
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Oct 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#issue-6007671859
a298d34https://github.com/IfcOpenShell/IfcOpenShell/commit/a298d3489419a06636c5f4b423b2fc9c1ceb7c65
hybrid_kernel::converthttps://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L51-L79
L161https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/converter.cpp#L161
L203https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/converter.cpp#L203
hybrid_kernel::convert_openingshttps://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L106-L129
hybrid_kernel.h L58-L63https://github.com/IfcOpenShell/IfcOpenShell/blob/a298d34894/src/ifcgeom/hybrid_kernel.h#L58-L63
fa4f53fhttps://github.com/IfcOpenShell/IfcOpenShell/commit/fa4f53feeb306f34760df016695aaae8368ce786
#9393https://github.com/IfcOpenShell/IfcOpenShell/pull/9393
fa4f53fhttps://github.com/IfcOpenShell/IfcOpenShell/commit/fa4f53feeb306f34760df016695aaae8368ce786
#9393https://github.com/IfcOpenShell/IfcOpenShell/pull/9393
fa4f53fhttps://github.com/IfcOpenShell/IfcOpenShell/commit/fa4f53feeb306f34760df016695aaae8368ce786
aothmshttps://github.com/aothms
on Oct 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#event-34130150913
Fix #10049 mapped item openings hybridhttps://github.com/IfcOpenShell/IfcOpenShell/commit/e8c585c81c94d19d1e142e4c2166d35f9ebbbd91
#10049https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
https://docs.github.com/articles/closing-issues-via-commit-messages
e8c585chttps://github.com/IfcOpenShell/IfcOpenShell/commit/e8c585c81c94d19d1e142e4c2166d35f9ebbbd91
https://github.com/aothms
aothmshttps://github.com/aothms
on Oct 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#issuecomment-6384800723
#10052https://github.com/IfcOpenShell/IfcOpenShell/pull/10052
aothmshttps://github.com/aothms
completedhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
c371da5https://github.com/IfcOpenShell/IfcOpenShell/commit/c371da54a267f32c74640a5abf1a045fc6c30b6f
on Oct 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#event-34131402863
aditiapratamahttps://github.com/aditiapratama
on Oct 25, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#event-34163351508
Fix IfcOpenShell#10049 mapped item openings hybridhttps://github.com/aditiapratama/IfcOpenShell/commit/c371da54a267f32c74640a5abf1a045fc6c30b6f
IfcOpenShell#10049https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
https://docs.github.com/articles/closing-issues-via-commit-messages
c371da5https://github.com/aditiapratama/IfcOpenShell/commit/c371da54a267f32c74640a5abf1a045fc6c30b6f
theoryshawhttps://github.com/theoryshaw
on Oct 27, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/10049#event-34384438517
Fix TrueMirrorElements first-run failure on typed elementshttps://github.com/Rob2309/IfcOpenShell/commit/b7854baa26f0beb6ba4d4e81df55b064fb452c23
b7854bahttps://github.com/Rob2309/IfcOpenShell/commit/b7854baa26f0beb6ba4d4e81df55b064fb452c23
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/10049
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.