×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how to select body from components at assembly level

how to select body from components at assembly level

how to select body from components at assembly level

(OP)
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.

RE: how to select body from components at assembly level

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:
  • an error will be thrown
  • initially, the body will move to a different layer but NX will move it back when an update occurs
  • the body moves to a different layer causing it to be out of sync with the layer option

www.nxjournaling.com

RE: how to select body from components at assembly level

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)

RE: how to select body from components at assembly level

(OP)
Thanx Bleaker for your response. Even I solved this problem this way only.

RE: how to select body from components at assembly level

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources