accessing bodies in assembly

accessing bodies in assembly

Anonymous
Not applicable
397 Views
2 Replies
Message 1 of 3

accessing bodies in assembly

Anonymous
Not applicable

is it possible to select the body of a part in an assembly using vba??

0 Likes
398 Views
2 Replies
Replies (2)
Message 2 of 3

t_stramr
Autodesk
Autodesk

Hi akosi,

 

Try to execute this code in VBA editor in oder to get surface bodies from component definition of active open document.

Similar approach is needed for other types of bodies. Look at componentdefinition VBA object for available methods.

 

Dim oFirstBody As SurfaceBody

Set oFirstBody = ThisApplication.ActiveDocument.ComponentDefinition.SurfaceBodies.Item(1)

 

 

For your exact case you need to get specific part instance from your assembly then to get comp definition for this instance and finally to get bodies from part definition.

I hope this will help you.

 

Thanks,

Robert

0 Likes
Message 3 of 3

philippe.leefsma
Alumni
Alumni

The question lacks too much context to be able to provide a usefull answer. You would need to specify what you mean by "select", do you want to prompt the user to select a part body from the assembly context? or simply "select" the body from API?

 

What do you want to do once you have selected the body? Do you want to use it in the assembly context, in which case you need to work at the proxy level, or you want for example to modify attributes in the actual part body, in which case you need the original body ...



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes