FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix malformed LoadBearing property templates in IFC4 psets by theoryshaw · Pull Request #9300 · IfcOpenShell/IfcOpenShell · GitHub

Fix malformed LoadBearing property templates in IFC4 psets - #9300

Open
theoryshaw wants to merge 1 commit into
IfcOpenShell:v0.8.0from
theoryshaw:fix-loadbearing-pset-templates
Open

Fix malformed LoadBearing property templates in IFC4 psets#9300
theoryshaw wants to merge 1 commit into
IfcOpenShell:v0.8.0from
theoryshaw:fix-loadbearing-pset-templates

Conversation

Copy link
Copy Markdown
Member

LoadBearing was missing from Pset_RoofCommon (and Pset_RampCommon / Pset_StairCommon) in the property set UI, even though the IFC4 documentation defines it: https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/schema/ifcsharedbldgelements/pset/pset_roofcommon.htm

Root cause

The property is declared in Pset_IFC4_ADD2.ifc, but the entity was malformed. 822107a ("Patch Ifc4 psets that missing IfcBoolean type in LoadBearing props #5708") hand-edited these lines and accidentally dropped the $ placeholder for OwnerHistory, leaving 11 attributes instead of 12. Every following attribute shifted by one:

0 GlobalId     '1s7fxao7L4X9mgLw5vDLbk'
1 OwnerHistory 'LoadBearing'          <- should be $
2 Name         'Indicates whether the object is intended to carry loads (TRUE) or not (FALSE).'
3 Description  None
4 TemplateType 'IfcBoolean'           <- not a valid P_* enum
5 PrimaryMeasureType None

So the property surfaced with its description as the name and no valid template type, which is why it never appeared. Reading attribute 11 (AccessState) raises RuntimeError outright.

Affected entities: #3983 (Pset_RoofCommon), #3808 (Pset_RampCommon), #4429 (Pset_StairCommon). The fourth edit in that commit (#22147) was done correctly. Pset_IFC2X3.ifc and Pset_IFC4X3.ifc are unaffected.

Fix

Restored the missing $ on the three lines. Parsing now yields:

Pset_RampCommon  [('LoadBearing', 'P_SINGLEVALUE', 'IfcBoolean')]
Pset_RoofCommon  [('LoadBearing', 'P_SINGLEVALUE', 'IfcBoolean')]
Pset_StairCommon [('LoadBearing', 'P_SINGLEVALUE', 'IfcBoolean')]

Tests

Added to test/util/test_pset.py:

  • test_load_bearing_is_defined_in_ifc4 — asserts LoadBearing is present and typed IfcBoolean in the three affected psets.
  • test_property_templates_are_well_formed — a general guard over all three bundled Pset_*.ifc files asserting every IfcSimplePropertyTemplate has OwnerHistory is None, a non-empty Name, and a TemplateType that is a valid P_*/Q_* enum. This is what catches an attribute shift from a future hand-edit; verified it flags exactly #3808/#3983/#4429 against the pre-fix file and passes after.

I also scanned all three template files for any other attribute-count mismatches in IfcSimplePropertyTemplate / IfcPropertySetTemplate / IfcComplexPropertyTemplate — these three were the only ones.

Full test/util/test_pset.py suite: 22 passed.

Note: separately, ifc4_properties.json has "LoadBearing": {} under Pset_RoofCommon (empty description). That file is auto-generated by the doc scraper in util/doc.py and only affects tooltip text, so I left it rather than hand-editing generated output.

🤖 Generated with Claude Code

Pset_RoofCommon, Pset_RampCommon and Pset_StairCommon each declared their
LoadBearing IfcSimplePropertyTemplate with 11 attributes instead of 12 -
the `$` placeholder for OwnerHistory was dropped in 822107a, shifting
every following attribute by one:

    1 OwnerHistory  'LoadBearing'   <- should be $
    2 Name          'Indicates whether the object is intended to carry...'
    4 TemplateType  'IfcBoolean'    <- not a valid P_* enum

The property therefore surfaced with its description as a name and no
valid template type, so it never showed up in the property set UI.

Restore the missing OwnerHistory placeholder, and add regression tests
covering both the three affected psets and the general well-formedness of
all bundled Pset_*.ifc property templates.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL