I'm wondering about the example SelectComponentFaceByName given by Solidworks

Hello

In this example, two things concern me

SelectComponentFaceByName(componentName As String, faceName As String)

http://help.solidworks.com/2015/English/api/sldworksapi/Get_Component_Face_By_Name_Example_VB.htm

The first is that the returned side is not memorized so that it can be used to constrain it with another face

the second is that for me it doesn't depend on componentName

I have an idea for all this but I would like to have your opinion

 

Cdlt

AF

Hello

Actually I don't know if you've seen, but there are 2 subs:

"Main" which is the one thrown first

"SelectComponentFaceByName" which is called at the end of the "main".

So in fact the order is the opposite of the one displayed!

And it's well indicated what the macro does at the beginning:

'-----------------------------------------------------------------------------
' Preconditions:
install_dir\samples\tutorial\appearances\usb_flash_drive2.sldasm.
' 2. Open the Immediate window.
'
' Postconditions:
' 1. Selects a component.
' 2. Selects a face on that component and names it.
' 3. Traverses the component's body and gets each face
'    on that body.
' 4. When the selected face matching the named face is found,
'    prints the selected face's name to the Immediate window.
' 5. Examine the Immediate window.
'
' NOTE: Because the assembly is used elsewhere, do not save changes.
'-----------------------------------------------------------------------------

 

Ok I understood all this

If I follow what is indicated, apart from SideFace it only selects the face that I have named

you have to call the sub  in the following way if I look for the side side (which I took the precaution to name before launching the program)

    SelectComponentFaceByName componentName, "sided"

and it doesn't keep her in mind for a future constraint

I also indicate that if I write this

    componentName = "whatever"
    SelectComponentFaceByName componentName, "sided"

The same result is obtained

Thank you