IfcOpenShell does not recognize serialization of SELECT (4.3)?

Created on 26 Jan 2021  Â·  6Comments  Â·  Source: IfcOpenShell/IfcOpenShell

I've been using BIMTester integrated with IfcOpenShell to validate an IFC file for IFC Rail, and I've come across a problem.

It seems that IfcOpenShell does not recognize the serialization of SELECT for IfcFacilityPart. In particular, STEP serializes the SELECT for the PredefinedType by wrapping the value with the class name.

I tried modifying the IFC file by writing the predefined type argument as an Enum (as it was in IFC 4.2) and passes the validation.
Is it possible to fix this?

Here an Example:

this is how the STEP file should be written in 4.3
=IFCFACILITYPART(‘2rZAYplcf7Hu4GBw_FfuTH’,$,'CircularQuay’,$,$,$,$,$,$,IFCMARINEPARTTYPEENUM(.BERTHINGSTRUCTURE.),.NOTDEFINED.);

this is how it was done in 4.2 and it is recognized by IfcOpenShell
= IFCFACILITYPART('0AS_KCenrFxQym6$QHvEr5',$, 'T1', $, $, $, $, $, .ELEMENT., .TRACKSTRUCTUREPART., .LONGITUDINAL.);

Most helpful comment

That's true, it's not the select that's the problem, but the select of enumeration. That's a new modelling construct in 4.3 and does not work well with how enumeration is implemented in IfcOpenShell and how selects specify their members. I'm aware of this issue, It's on my list to fix this, but I need to find a way without braking changes in the APIs.

All 6 comments

That's true, it's not the select that's the problem, but the select of enumeration. That's a new modelling construct in 4.3 and does not work well with how enumeration is implemented in IfcOpenShell and how selects specify their members. I'm aware of this issue, It's on my list to fix this, but I need to find a way without braking changes in the APIs.

@aothms Thanks for the reply. Please keep us updated on this.

I've made some progress on this issue:

  • 08576e28 fixed boxed enum validation
  • b3f581d7 Handle boxed enum creation in Python
  • 89d6b3d2 Fixes for RC2 changes re IfcPoint and IfcSegment
  • d2bf2cf4 Pick RC2 definitions where required
  • 43b2982d fix char encoding issue in source
  • e750a134 Add generated rc2 schemas
  • 6bbbc528 prep for 4x3_rc2
  • 7f4a4367 regen schema
  • e6592ca7 conversion rules for first citizin enum types #1276

The following script now runs successfully, i.e create the aforementioned IfcFacilityPart and validate it.

import logging
import ifcopenshell
import ifcopenshell.validate

logger = logging.getLogger("validate")
logger.setLevel(logging.DEBUG)

f = ifcopenshell.file(schema='IFC4X3_RC2')
f.createIfcFacilityPart(
    ifcopenshell.guid.new(),
    PredefinedType=f.createIfcMarinePartTypeEnum('BERTHINGSTRUCTURE'),
    UsageType='NOTDEFINED')
f.write('test.ifc')

print(f[1])

ifcopenshell.validate.validate(f, logger)

The latest builds on the website should have this functionality available now

OK we could confirm this was fixed. The issue can be closed.

@aothms is there any documentation supporting the validate function please?

@rbertucat I've added a bit. Let me know if you miss something or have clarifying questions. https://github.com/IfcOpenShell/IfcOpenShell/commit/3eacd809b0dc0c4d03d4675f3f64a509cb27789f

Was this page helpful?
0 / 5 - 0 ratings

Related issues

otsoa picture otsoa  Â·  8Comments

globalcitizen picture globalcitizen  Â·  12Comments

olomakovskyi-blackbird picture olomakovskyi-blackbird  Â·  5Comments

Ahmed-Abdelhak picture Ahmed-Abdelhak  Â·  11Comments

Moult picture Moult  Â·  8Comments