I'm kind of new to SolidWorks API programming.
I need a method of determining if a face that is selected on a solid is 2D (i.e. a selected square that comprises a cube). I've done some research and noticed a couple commands that might be useful: isPlane and is3D, but it looks like I have to somehow convert what I have selected into either a "Surface" or an "IFace" (depending on which command I use) and I need help on how to convert the selected face into the proper type to work with those commands. Or, is there a simpler method for what I'm trying to accomplish.
Any help is appriciated.
UPDATE:
I think I have found a method for which I could use isPlane, but I'm not sure why one part of this isn't working. Here is what I have come up with:
Code Sample |
---|
'Declarations Dim isThisAPlane As Boolean Dim WorkFace As Face2 Dim WorkSurface As Surface Dim SelMgr As SldWorks.SelectionMgr 'Determine if the selected face is 2D |
The problem I'm having (aside from not understanding everything that's going on... I'm new at this) is that my line to get the face from what I have selected:
WorkFace = SelMgr.GetSelectedObjectsFace(1,0) 'gets the face from the selection
generates the following error when I run the macro:
What is it that I'm doing wrong?
Thanks for any help!
SolidworksApi macros