buildingSMART / IFC4.3.x-development

Repository to collect updates to the IFC4.3 Specification
Other
170 stars 86 forks source link

Function encoding issues #507

Open SergejMuhic opened 2 years ago

SergejMuhic commented 2 years ago

This issue is probably more for the STEP team looking at the standard. I am not sure whether they are looking into this repo but I don't know where else to post it. Pinging @TLiebich @arch1501

RelPlacement\IfcLocalPlacement.RelativePlacement.Dim = 3 is bothering me. IfcLocalPlacement.RelativePlacement is an IfcAxis2Placement select on which .Dim is called. Obviously, the select does not have a .Dim attribute. This seems odd and in principle should not work. Any comments on this? I would offer myself to change to function.

aothms commented 2 years ago

From 12.7.3 Attribute references I read

If the declared type of the expression to the left of the attribute reference is a select data type, then the attribute name specified to the right shall be declared in an entity named in the select list or within a supertype or subtype of an entity named within the select list.

So judging from this fragment it seems to be fine. Not sure if there are other relevant bits I'm overlooking. I do agree with your sentiment that it would be clearer if selects behaved more like interfaces in programming languages so that you can exercise some control over all select members having the same necessary set of (derived) attributes.

@TLiebich

They follow with

If the specified attribute is not present in the entity instance or partial complex entity value, indeterminate (indeterminate (?)) is returned.

So maybe the first part of the conjunction isn't even necessary and maybe the explicit IfcCartesianPoint (cast) isn't either.

AxisStartInXY : ('IFC4X3.IFCCARTESIANPOINT' IN TYPEOF(Axis.Location)) AND (Axis.Location\IfcCartesianPoint.Coordinates[3] = 0.0);

It might even be wrong, because I read in 12.7.4 Group references

The group reference () provides a reference to a partial complex entity value within a complex entity instance. The expression to the left of the group reference shall evaluate to a complex entity instance.

In our case the "expression to the left of the group reference" is not a "complex entity instance".

Edit: maybe it is a complex entity instance, as I read from the definition:

complex entity data type

a representation of an entity. A complex entity data type establishes a domain of values defined by the common attributes and constraints of an allowed combination of entity data types within a particular subtype/supertype graph.

Maybe it's not as related to complex entity instance definition in the IFC exchange file because those we never have as we don't have multiple inheritance.

SergejMuhic commented 2 years ago

Thanks, this helps out.

I guess with the null/indeterminate return it can be handled properly. Makes it a bit more complex but doable.

Regarding group references, I think the entity according to its definition is complex, so that part fits IMHO. (Agreeing with the edit).