Issue with the function area(intersect) when the intersect is None or disabled

Alexander Fedotov

Issue with the function area(intersect) when the intersect is None or disabled

I have a parameter calculating an area of an intersect. The objects in the intersect can change dynamically (via EKL) and it may happen that there is be no intersect in some situations.
In such cases CATIA gives an error which is undesirable. To prevent this i try to foresee these use cases and disable the intersect object via EKL. That part works in terms of giving no errors.

 

Unfortunately the area() function is complaining if the intersect object is invalid. It seems the object loses the "Surface" type - it is a "Feature" and that triggers an error of the area(). 

 

Im looking for any way to handle it or a workaround to avoid errors. 

I tried:
- move area() to a different reaction which is triggered only when the intersect object is valid - it does not help.
- a dummy surface and "assemble()" it with the intersect - that also doesnt work, this time because of the assemble function expecting either curves or surfaces. 
- i can fake the intersect objects so that the intersect is still valid in these use cases and hide those fake objects from users but i really dont want to go that route. 

I hope there is some way to catch / disable errors like that or make the intersect stay a surface, just 0mm2 surface.

 

Balla Zoltan

RE: Issue with the function area(intersect) when the intersect is None or disabled
(in response to Alexander Fedotov)

Hi,

maybe you could create a Circle  using the Circle constuctors and use it as input for the Area Function in case you know the intersect will fail.

Alexander Fedotov

RE: Issue with the function area(intersect) when the intersect is None or disabled
(in response to Balla Zoltan)

Thank you for the answer. Let me make sure i understand correctly.

Do you suggest to do the intersect in the EKL only when the result will be valid instead of having it as an object in the tree ? I will need to try that.

So far my intersect is an actual object in the tree and all my attempts to provide another object as input to area() if the intersect was invalid / disabled failed. CATIA didn't care basically if the "bad" intersect was in the branch of code which was not used, it just gave an error.

Edited By:
Alexander Fedotov[Procter & Gamble] @ Mar 03, 2022 - 03:44 AM (IDLW)

Mahefa Ralijaona

RE: Issue with the function area(intersect) when the intersect is None or disabled
(in response to Alexander Fedotov)

Hi Alexander,

Could you try this? Add at the beginning of your code:

DisableErrors()

 

Then at the end of your code:

EnableErrors()

 

 

 

 

Alexander Fedotov

RE: Issue with the function area(intersect) when the intersect is None or disabled
(in response to Mahefa Ralijaona)

Hello

No, i know that one, it doesnt help in this case. But thanks.

Alex.