You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're not specifying any integer values so the first enum will have a value of zero, and so becomes the implicit default. The net result is that any object with an enum like this will default to that first value, unless a value is set explicitly. Two examples of how this can happen:
var slab = model.Instance.New<IfcSlabType>(); where slab.PredefinedType will default to FLOOR
#1=IFCSLABTYPE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$) where PredefinedType on the entity will also default to FLOOR, because the last parameter (PDT) is null
While both examples are technically invalid IFC, we still accept them, and will then report the type as being PredefinedType FLOOR. On different types it's obviously a different value, but still typically a value that would surprise.
Should we consider updating the codegen in a future release so any occurrence of 'NOTDEFINED' (or equivalent) will be the first in the Enum, meaning any default value would give conceptually accurate output. Obviously a breaking interface change so would need to align with a major release. Alternatively we need to initialise these Mandatory enum properties explicitly to an appropriate value.
The text was updated successfully, but these errors were encountered:
When we define an IFC Enum (such as IfcSlabTypeEnum) from code-gen, we define the enum values in the order they are in EXPRESS. e.g.
We're not specifying any integer values so the first enum will have a value of zero, and so becomes the implicit default. The net result is that any object with an enum like this will default to that first value, unless a value is set explicitly. Two examples of how this can happen:
var slab = model.Instance.New<IfcSlabType>();
whereslab.PredefinedType
will default toFLOOR
#1=IFCSLABTYPE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$)
where PredefinedType on the entity will also default toFLOOR
, because the last parameter (PDT) is nullWhile both examples are technically invalid IFC, we still accept them, and will then report the type as being PredefinedType FLOOR. On different types it's obviously a different value, but still typically a value that would surprise.
Should we consider updating the codegen in a future release so any occurrence of 'NOTDEFINED' (or equivalent) will be the first in the Enum, meaning any default value would give conceptually accurate output. Obviously a breaking interface change so would need to align with a major release. Alternatively we need to initialise these Mandatory enum properties explicitly to an appropriate value.
The text was updated successfully, but these errors were encountered: