IFC4.3.x-development icon indicating copy to clipboard operation
IFC4.3.x-development copied to clipboard

IfcCurveDim does not contain code for IfcSpiral

Open aothms opened this issue 2 years ago • 16 comments

@SergejMuhic @PeterRdf

What would be the suitable definition? Is it Position.Dim or sth else?

aothms avatar Feb 03 '23 19:02 aothms

Aw, good catch. This makes sense. Spirals are bound to planes but can be positioned in 3D of course. I agree.

SergejMuhic avatar Feb 03 '23 20:02 SergejMuhic

Additional proposal after testing. Make IfcSpiral.Position mandatory. See linked 548 by @pjanck.

SergejMuhic avatar Mar 07 '23 16:03 SergejMuhic

I am okay to make IfcSpiral.Position mandatory, still would also be okay with the implicit rule already available that in the context of an IfcCurveSegment the IfcSpiral.Position is mandatory while we keep IfcSpiral as it is.

peterrdf avatar Mar 07 '23 19:03 peterrdf

Like this:

WHERE PositionOnSpiralExists: IF 'IFCSPIRAL' IN TYPEOF(ParentCurve) THEN EXISTS(ParentCurve\IfcSpiral.Position;

on IfcCurveSegment?

I must say, I would prefer making Position mandatory.

SergejMuhic avatar Mar 07 '23 19:03 SergejMuhic

Like this:

WHERE PositionOnSpiralExists: IF 'IFCSPIRAL' IN TYPEOF(ParentCurve) THEN EXISTS(ParentCurve\IfcSpiral.Position;

Quick note that this is not allowed. Where clauses can only take expressions, not statements (such if_stmt). So we'd have to rephrase that to

NOT 'IFC4X3_SOMETHING.IFCSPIRAL' IN TYPEOF(SELF.ParentCurve) OR EXISTS(SELF.ParentCurve\IfcSpiral.Position);

(need to review parenthesis as well, express is a bit picky on them).

I'm not so sure abt the usage of SELF, we don't have it on all of our clauses, but the standard says:

Domain rules (WHERE clause)

...

Rules and restrictions:

...

b) The keyword self (see 14.5) shall appear at least once in each domain rule ...


So to summarize we have the options (I tried to order them based on decreasing "safeness"):

  1. Return indeterminate in IfcCurveDim when IfcSpiral.Position is NIL
  2. Return 2 (?) in IfcCurveDim when IfcSpiral.Position is NIL
  3. Make IfcSpiral.Position non-optional in the context of IfcCurveSegment
  4. Make IfcSpiral.Position non-optional

I'm fine with all four options, you are the experts here, we will be making some similar schema changes anyway (#576).

aothms avatar Mar 08 '23 08:03 aothms

My vote goes for

Make IfcSpiral.Position non-optional in the context of IfcCurveSegment

I believe your proposal is almost complete, only missing parenthesis (looking at example of CorrectTypeAssigned):

WHERE PositionOnSpiralExists:  (NOT ('_SCHEMAIDENTIFIER_.IFCSPIRAL' IN TYPEOF(SELF.ParentCurve))) OR EXISTS(SELF.ParentCurve\IfcSpiral.Position);

pjanck avatar Mar 08 '23 08:03 pjanck

Quick note that this is not allowed. Where clauses can only take expressions, not statements (such if_stmt). So we'd have to rephrase that to

Yep, my bad. Was thinking in function terms first, then I added WHERE.

SergejMuhic avatar Mar 08 '23 09:03 SergejMuhic

@TLiebich this would be a good time to make your preference if any explicit

@peterrdf you said:

would also be okay with the implicit rule already available that in the context of an IfcCurveSegment the IfcSpiral.Position

Does this mean you prefer option option 3? I didn't find that "implicit rule already available".

@SergejMuhic I count you under option 4?

aothms avatar Mar 13 '23 08:03 aothms

I am in favor of option3, but of course also okay with option 4

peterrdf avatar Mar 13 '23 08:03 peterrdf

+1 for option 3 (still explicit but avoiding a schema change)

TLiebich avatar Mar 13 '23 11:03 TLiebich

@SergejMuhic I count you under option 4?

Definitely. If we are changing something like this, I would say make it consistent with the rest of the schema. Implementation will suffer one way or another as IfcSpiral was used in IfcCurveSegment 100% of the time in existing IFC4X3 files.

It was a nice idea with IfcSpiral being a bit different but it does not work as intended.

EDIT: With option 3 we are not fixing the problem. A sole IfcSpiral can still throw an exception with IfcCurveDim.

SergejMuhic avatar Mar 13 '23 12:03 SergejMuhic

Is there resolution for this issue? The Validatoin Service still generates issues regarding the IfcCurveDim function and IfcSpiral. I prefer Option 4, I guess schema change is not really a problem now?

BenzclyZhang avatar Jul 14 '23 07:07 BenzclyZhang

EDIT: With option 3 we are not fixing the problem. A sole IfcSpiral can still throw an exception with IfcCurveDim.

We can also combine my options 2 and 3 from above. So:

  1.    Return indeterminate in IfcCurveDim when IfcSpiral.Position is NIL
  2. > Return 2 (?) in IfcCurveDim when IfcSpiral.Position is NIL
  3. > Make IfcSpiral.Position non-optional in the context of IfcCurveSegment
  4.    Make IfcSpiral.Position non-optional

It ultimately depends on the conditions on by which IfcCurveDim is evaluated though. Sure, an implementer could call IfcCurveDim(SomeSpiral) directly in his own code, so it's best if the semantics are complete, but in regular schema usage I don't see a case where IfcCurveDim is evaluated on an IfcSpiral without the context of an IfcCurveSegment, because it wouldn't be a top level item in a IfcShapeRepresentation.

At this stage I really prefer making as few attribute type changes as possible, because they will affect code generation and variable types in statically typed languages, therefore probably in implementers having to adapt their code.

aothms avatar Jul 16 '23 08:07 aothms

what is the reason, that Position at IfcSpiral is optional? Other parameterized curves, like all conics have Position mandatory. When I look into the subtype IfcClothoid (and corresponding clothoid in STEP P42) it seems to me, that Position is essential - i.e. cannot be NIL. I also don't see any description to explain a default, in case of Position being NIL.

So I would also argue for option 4 (if I don't miss anything here). Contrary to my previous statement we have now a new situation where we accept minor schema changes for the ISO FDIS - so this one could be added.

TLiebich avatar Jul 17 '23 17:07 TLiebich

what is the reason, that Position at IfcSpiral is optional? Other parameterized curves, like all conics have Position mandatory.

Exactly. It was a lapsus in the design. We should correct it. The only reason I can give is that I always thought of it as in the context of IfcCurveSegment. But there is also IfcTrimmedCurve and then there are functions relying on the attribute. So, let's not fool ourselves, there is only one alternative really.

but in regular schema usage I don't see a case where IfcCurveDim is evaluated on an IfcSpiral without the context of an IfcCurveSegment,

We could argue the same for IfcLine and it still has a mandatory Pnt attribute.

SergejMuhic avatar Jul 19 '23 13:07 SergejMuhic

Ok option 4 is now by far the most favourite, it's also the easiest to apply so I'm happy :)

aothms avatar Aug 22 '23 12:08 aothms