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.);
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:
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
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.