AnsweredAssumed Answered

API VBA - is a body flat Face coplanar with a Refplane ?

Question asked by Regis WACHEUX on Aug 1, 2013
Latest reply on Dec 15, 2017 by Swme Eng



In a local sub , I would need to test if a flat face of a body is coplanar with a plane, and select it.

I can not find the correct library to make this test directly. Does it exist ?


In API VBA, we can create a RefPlane coincident from a body Face, but can this be "reversed" as a test condition ?


The IFace2 IsCoincident Method does not work for testing a plane and face coplanarity.


Some workarounds tests imply to modify the type of one of the item :

For example create a RefPlane from the flat face (RefPlaneFeatureData Distance) , and test both planes parallel and coincident (GetRefPlaneParams)....

Or to zero offset a surface from the body face, then get the sketch from the face to be projected on the RefPlane, then create a surface on the plane from that sketch, then test both surfaces (CoEdge)....


As some studies have up to 70 faces coplanar to a plane to be selected, I would prefer to use a clean method which does not imply the creation of temporary features when traversing all the bodies faces ( sketches / surfaces / Refplane...), as these features have also to be deleted when leaving the macro, There could be a risk of deleting something else.


Does a cleaner method than the workarounds exist ? If you have hints or ideas of API libraries and methods that I can have a look into, let me know I am interested....


Thanks in advance.