Solidwork api: retrieve the name of the selected body

Hello.

I'm looking for the code to retrieve the name of the body selected in a room.

in order to reselect it later.

Hello

The Solidworks API help is the essential tool when coding on SW.

Here's an example of a search: http://help.solidworks.com/SearchEx.aspx?q=bodies+name&sort=&version=2015&lang=english&prod=api

I think this example is particularly interesting: http://help.solidworks.com/2015/english/api/sldworksapi/get_bodies_in_components_example_vb.htm

See you.

1 Like

Hello

 

Here's a macro that should answer the question:

http://www.lynkoa.com/tutos/3d/api-solidworks-obtenir-le-nom-du-corps-depuis-l-interface-3d

 

The instruction to use is:

    Set swBody = swFace.GetBody

Thank you. Pl I will be able to improve my macro in addition with the selection of the face, no need to filter the selection of the body.