Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to select body from components at assembly level

Status
Not open for further replies.

yadvdinesh

Aerospace
Apr 13, 2015
31
I want to select only the bodies of the individual components from a component assembly so that those bodies can be moved to a particular layer. I am writing an NXOpen application using C++ language for the same. Can anyone plz guide me how to approach. I am trying to use Component->prototype->owningPart->body Collection sequence but unable to select bodies.
 
Replies continue below

Recommended for you

You can't move component bodies to different layers in the assembly willy nilly; the component layer option plays a part in what is and is not allowed. When you add a component to an assembly you basically have two different layer options: "original" and "as specified". If you use the "original" option, the component body layers in the assembly will map to the body layers in the part (a body on layer 2 in the part file will show up on layer 2 in the assembly). The "as specified" option will place all the component geometry on the specified layer in the assembly. So if the part has a body on layer 2 and you use "as specified, layer 5", the body will show up on layer 5 in the assembly even though it is on layer 2 in the part.

I've not tested moving bodies in the assembly to different layers, but I imagine one of three things happening:
[ul]
[li]an error will be thrown[/li]
[li]initially, the body will move to a different layer but NX will move it back when an update occurs[/li]
[li]the body moves to a different layer causing it to be out of sync with the layer option[/li]
[/ul]

www.nxjournaling.com
 
AFAIK, Component->Prototype->OwningPart is actually the assembly "part" that (normally) doesn't have any solid geometry. To get the bodies you can try casting the Component->Prototype object to Part and get the bodies from it, i.e.:

NXOpen::part *part = dynamic_cast<NXOpen::part*>(component->Prototype());
NXOpen::BodyCollection *bodies = part->Bodies();

Of course, the bodies you get this way are from prototype part of the component. Moving the component bodies around the layers seems to get reset on reload/update.

(Bit of a necropost, sorry)
 
Thanx Bleaker for your response. Even I solved this problem this way only.
 
If you have a reference to the component and the prototype body, you can use UF_ASSEM_find_occurrence to get the corresponding instance body in the assembly (unless the body gets promoted in the assembly).

Changing the layer of this body may not have the intended effect...

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor