I have a bunch of ImportedCurves - several hundred to a few thousand - in a Part file. Basically a bunch of rays in a lens.
Given a 2D Plane cutting across these ImportedCurves, I want to create a point cloud where the ImportedCurves pierce the 2D Plane.
I'm using an existing VB.NET AddIn to develop this tool - no issues there.
The current approach is to open a 2D sketch on the 2D Plane, add a Point, then add a Relation of sgATPIERCE to an Imported Curve - obviously with some sort of iteration through all the curves.
Could do the same thing with a 3D sketch by adding a Point, then adding a Coincident relation between the Point, an ImportedCurve and the 2D Plane... again with some sort of iteration (I can figure out the iteration part).
The problem I'm having is that not every ImportedCurve pierces the 2D Plane, and ModelDoc2.SketchAddConstraints doesn't give feedback as to whether adding the relation succeeds or not. That's my fundamental question - is there a way to programmatically tell whether or not the desired relation was successfully added?
I guess I could add the Points way off in space, then manually go back after the fact and box select/delete the 'leftover' points that don't get the Pierce relation - but I'm hoping for a more elegant way.
Is there a fundamentally better way? For example - is there a way to tell whether an ImportedCurve pierces a Plane or not, independent of trying to add a constraint?
Any other thoughts/ideas?