René's URL Explorer Experiment


Title: Fix get_part_of_product crash and IFC2X3 typo (#8081) by petruconduraru · Pull Request #8317 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: Fix get_part_of_product crash and IFC2X3 typo (#8081) by petruconduraru · Pull Request #8317 · IfcOpenShell/IfcOpenShell

X Title: Fix get_part_of_product crash and IFC2X3 typo (#8081) by petruconduraru · Pull Request #8317 · IfcOpenShell/IfcOpenShell

Description: Fixes #8081 Credit @PahlawanJoey reported the crash and, on request, pasted the full console traceback (from Window > Toggle System Console). Those extra frames are what pinned this down to get_part_of_product. Problem Creating a door type crashed: File ".../bonsai/bim/module/model/door.py", line 99, in update_door_modifier_representation representation_data["part_of_product"] = ifcopenshell.util.representation.get_part_of_product(element, body) File ".../ifcopenshell/util/representation.py", line 443, in get_part_of_product if maps := [r for r in element.RepresentationMaps if r.MappedRepresentation.ContextOfItems == context]: TypeError: 'NoneType' object is not iterable Reproduced end to end in headless Blender: a new IFC4 project whose file has no Model/Profile/ELEVATION_VIEW context skips the elevation representation step in door.py, so the very first call into get_part_of_product hits a freshly created IfcDoorType whose RepresentationMaps is still unset. That matches Joey's frames exactly, including root/operator.py:786 and product.py:157. Two defects, both fixed RepresentationMaps is an optional IfcTypeProduct attribute (confirmed against the schema declaration for both IFC4 and IFC2X3). When unset it is None, and the list comprehension iterates it unconditionally. Fixed by returning None early, matching what the rest of the function already does when there is no match. Line 442 read element.file.schema != "IFX2X3", a typo for "IFC2X3" that has been there since this function was introduced (dc79e9e005, one commit, no later edits). Since file.schema never equals "IFX2X3", the guard always evaluated true, so IFC2X3 type products always fell into the RepresentationMaps branch, contradicting the function's own docstring ("this will return None for IFC2X3 element types"). Fixed the string. Behaviour change for existing IFC2X3 users Before this fix, an IFC2X3 type product with populated RepresentationMaps matching the context returned that map instead of None (the typo defeated the intended early return). After the fix it always returns None for IFC2X3, as documented. The only consumers are add_door_representation and the analogous window path, and both already guard on part_of_product being falsy purely to skip attaching IfcShapeAspects: if self.settings["part_of_product"]: ifcopenshell.api.geometry.add_shape_aspect(...) So for IFC2X3 the representation is still created normally, it just no longer gets Lining/Framing/Glazing shape aspects tied back to the type. That is a graceful, already-supported no-op path, not a new crash, and it is what the docstring says should happen. Verification Reproduced pre-fix and post-fix at two levels: Direct unit level: get_part_of_product on a freshly created IfcDoorType (IFC4) and IfcDoorStyle (IFC2X3) with RepresentationMaps unset raises the exact reported TypeError on the exact reported line, both before this fix. Full Blender level (headless, isolated BLENDER_USER_RESOURCES, Blender 5.2): bpy.ops.bim.add_default_type(ifc_element_type="IfcDoorType") on a fresh IFC4 project with its Model/Profile/ELEVATION_VIEW context removed reproduces Joey's traceback frame for frame, then succeeds after the fix. Confirmed the non-2X3 "has matching maps" and "no matching maps" paths are unchanged (existing behaviour preserved) with both direct calls and a normal in-app door-type creation (which already has representation maps populated by the time get_part_of_product runs, so it never hit the crash in the first place, only files missing that context did). Added test/util/test_representation.py (TestGetPartOfProduct, TestGetPartOfProductIFC2X3), 6 tests. 3 of them fail against the pre-fix code (2 crash with the reported TypeError, 1 asserts the documented IFC2X3 None behaviour); all 6 pass after both fixes. $ pytest test/util/test_representation.py -v 6 passed Lint black --check and ruff check (CI-exact toolchain) both clean on the touched files. Generated with the assistance of an AI coding tool, reviewed by Petru Conduraru.

Open Graph Description: Fixes #8081 Credit @PahlawanJoey reported the crash and, on request, pasted the full console traceback (from Window > Toggle System Console). Those extra frames are what pinned this down to get_...

X Description: Fixes #8081 Credit @PahlawanJoey reported the crash and, on request, pasted the full console traceback (from Window > Toggle System Console). Those extra frames are what pinned this down to ...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8317

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6f9ce915-33e5-cb93-53c7-4e68fc25dfb3
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBC32:99B56:91FA3E:CC5F5B:6B0483E9
html-safe-nonceba9b7cd0eddb338fdbb45fa25391679d34b8433408c704e12ce6902a555a5f8e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzMyOjk5QjU2OjkxRkEzRTpDQzVGNUI6NkIwNDgzRTkiLCJ2aXNpdG9yX2lkIjoiMTU4Mzc2MzcwNzUyMjIyMTAzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac90b8f041d405d472021ed71b5ec3786959d66af5048b7988f2bb3f6895aab5a3
hovercard-subject-tagpull_request:3998315613
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
twitter:imagehttps://avatars.githubusercontent.com/u/139251053?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/139251053?s=400&v=4
og:image:altFixes #8081 Credit @PahlawanJoey reported the crash and, on request, pasted the full console traceback (from Window > Toggle System Console). Those extra frames are what pinned this down to get_...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1d5c152376e38b7d2e37f3d5179be29a73bee93b85110da28a4eebe1159cdc70
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef5017e8ff4ea25a8011fcf0f2a0e430c60dc86c8
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fpull%2F8317%2Ffiles
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%2Fpull%2F8317%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
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
Sign up for GitHub https://github.com/signup?return_to=%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2Fnew%2Fchoose
petruconduraruhttps://github.com/petruconduraru
IfcOpenShell:v0.9.0https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.9.0
BIMvoice:fix-get-part-of-product-none-repmaps-8081https://github.com/BIMvoice/IfcOpenShell/tree/fix-get-part-of-product-none-repmaps-8081
Conversation 1 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317
Commits 5 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits
Checks 8 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/checks
Files changed https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Fix get_part_of_product crash and IFC2X3 typo (#8081) https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#top
Show all changes 5 commits https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
e3d0d82 Guard get_part_of_product against None RepresentationMaps #8081 petruconduraru Jul 6, 2026 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits/e3d0d8240b50f03cb84a27eb42e380998a705b3d
e2d4f3f util.representation: fix IFC2X3 schema typo in get_part_of_product petruconduraru Jul 25, 2026 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits/e2d4f3fff33d526599f1eec189e08ce8bec23a84
d971623 tests: cover get_part_of_product for products and IFC2X3/IFC4 types petruconduraru Jul 25, 2026 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits/d971623b6a4b89e3fa7b753e03159134dd373f8e
9f1d5d2 Merge remote-tracking branch 'origin/v0.9.0' into mig/8317 petruconduraru Sep 29, 2026 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits/9f1d5d242d4b52d238331df43ec27da3bb032f5e
5f62fb1 Remove comments from added tests petruconduraru Sep 29, 2026 https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/commits/5f62fb1f12c4375ba4bfb9286c4adacd1a16f367
Clear filters https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
test_representation.py https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-0f4d6652d07324590bde3cae6ee1f64097c69e9d24b0ef601bcbd7f8481a0741
src/ifcopenshell-python/ifcopenshell/util/representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
View file https://github.com/IfcOpenShell/IfcOpenShell/blob/5f62fb1f12c4375ba4bfb9286c4adacd1a16f367/src/ifcopenshell-python/ifcopenshell/util/representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/{{ revealButtonHref }}
https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-aab3de053b422bed2ce2100c0c4a30df22053cb141ae0b97c54625c65d9cb7f6
src/ifcopenshell-python/test/util/test_representation.pyhttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files#diff-0f4d6652d07324590bde3cae6ee1f64097c69e9d24b0ef601bcbd7f8481a0741
View file https://github.com/IfcOpenShell/IfcOpenShell/blob/5f62fb1f12c4375ba4bfb9286c4adacd1a16f367/src/ifcopenshell-python/test/util/test_representation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IfcOpenShell/IfcOpenShell/pull/8317/{{ revealButtonHref }}
Please reload this pagehttps://github.com/IfcOpenShell/IfcOpenShell/pull/8317/files
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-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.