How to determine the kind of object selected by the user?
joshtargo
Member Posts: 695 EDU
I need to get a direction vector. if the user selects an edge I can do it, if they choose a face i think i can use the normal to do it, but how do i determine the type of object the user selected so i can apply different code?
this is to align a new mate connector's Z axis.
this is to align a new mate connector's Z axis.
0
Comments
-
If you use something like this in your precondition (see docs https://cad.onshape.com/FsDoc/library.html#QueryFilterCompound)
annotation { "Name" : "Direction", "Filter" : QueryFilterCompound.ALLOWS_DIRECTION || BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 } definition.myDirection is Query;
then later you can use the https://cad.onshape.com/FsDoc/library.html#extractDirection-Context-Query
e.g.var extDir = extractDirection(context, definition.myDirection);
...then it works very cleanly.0 -

