Title: Bonsai: clear occurrence PredefinedType when a type's PredefinedType is edited to a concrete value by petruconduraru · Pull Request #9629 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Bonsai: clear occurrence PredefinedType when a type's PredefinedType is edited to a concrete value by petruconduraru · Pull Request #9629 · IfcOpenShell/IfcOpenShell
X Title: Bonsai: clear occurrence PredefinedType when a type's PredefinedType is edited to a concrete value by petruconduraru · Pull Request #9629 · IfcOpenShell/IfcOpenShell
Description: Replaces #8829, which targeted v0.8.0 from a branch we cannot update. Same fix on v0.9.0, with a regression test. Problem The buildingSMART validation service flags normative rule OJT001 (Object Predefined Type): when an IfcTypeObject has a concrete PredefinedType, the related occurrence's PredefinedType must be empty (unset). An occurrence carrying an explicit .NOTDEFINED. value is a violation. ifcopenshell.api.type.assign_type already clears an occurrence's PredefinedType/ObjectType at assignment time when the type is concrete (see #7006 / #7011). But if a type's own PredefinedType is edited to a concrete value after its occurrences are already typed, nothing reconciles those occurrences, so an occurrence left at explicit .NOTDEFINED. stays that way and fails OJT001. Fix In edit_attributes.py's type-editing branch, when a type's resolved PredefinedType becomes concrete (not NOTDEFINED/None), clear the ObjectType/PredefinedType of its occurrences (via Types on IFC4+, ObjectTypeOf on IFC2X3), mirroring assign_type's existing logic and hasattr guards. Occurrences of a type that is itself NOTDEFINED/untyped are left untouched (they are allowed to carry their own value), and untyped elements are unaffected. Scope This covers the authoring path (editing a type's PredefinedType after typing occurrences). It intentionally does NOT add export-time normalization, so models where the inconsistency was baked in purely by import (e.g. a Revit IFC export with an occurrence already .NOTDEFINED. under a concretely-typed type) and never touched via Bonsai's type editing are out of scope here; that would be a separate, deliberate export-normalization decision. Testing Before: IfcWall(...,.NOTDEFINED.) under IfcWallType(...,.MOVABLE.) (OJT001 fail). After: IfcWall(...,$), type unchanged, ifcopenshell.util.element.get_predefined_type() still resolves to MOVABLE (no data loss). Untyped wall keeps its own PredefinedType; wall under a NOTDEFINED type keeps its own value; multiple occurrences all cleared consistently; IfcBeam/IfcBeamType behave the same; IFC2X3 path guarded (no occurrence PredefinedType there). test/api/type/ + test/api/root/ (191 tests) and full test/api/ suite: no new failures. This change was written with AI assistance. Tests on v0.9.0 Against the 0.9.0 alpha260928 wrapper with this branch's sources: the new test fails with the fix reverted and passes with it. ruff format and ruff check clean. This contribution was generated with the assistance of an AI coding tool (all code, tests and text). Generated with the assistance of an AI coding tool.
Open Graph Description: Replaces #8829, which targeted v0.8.0 from a branch we cannot update. Same fix on v0.9.0, with a regression test. Problem The buildingSMART validation service flags normative rule OJT001 (Object Pr...
X Description: Replaces #8829, which targeted v0.8.0 from a branch we cannot update. Same fix on v0.9.0, with a regression test. Problem The buildingSMART validation service flags normative rule OJT001 (Object Pr...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/9629
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1a13a431-27d7-60c5-82c0-84982de29956 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9CE0:6FCC9:C9E084:113ECA5:6B054E25 |
| html-safe-nonce | bfe964103cc6fc633216d72a1a2f1ec4cee052b3e8eb320b33a3d2e5566becf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0UwOjZGQ0M5OkM5RTA4NDoxMTNFQ0E1OjZCMDU0RTI1IiwidmlzaXRvcl9pZCI6IjQ4NDk4OTUxMDI3MTE0MTg0MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 042e51a996d96186c910dade0286800d77958e634648ebce4f1fe72b6290bc3c |
| hovercard-subject-tag | pull_request:4672813623 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/IfcOpenShell/IfcOpenShell/pull/9629/files |
| twitter:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| og:image:alt | Replaces #8829, which targeted v0.8.0 from a branch we cannot update. Same fix on v0.9.0, with a regression test. Problem The buildingSMART validation service flags normative rule OJT001 (Object Pr... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width