cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a list of Bodies in Step file, SNAP or VB.NET, NX 11

Valued Contributor
Valued Contributor

Normally with an NX assembly, I can use

For Each child As Component In comp.GetChildren()

To get a list of Part available in the assembly. However, when I am dealing with a step file with stucture like the attached email, I have a problem extract the list of bodies (I just want to get Body(1), Body(2), ..., Body(8).

 

Capture.PNG


Please help me

4 REPLIES

Re: How to get a list of Bodies in Step file, SNAP or VB.NET, NX 11

Siemens Phenom Siemens Phenom
Siemens Phenom

First of all, SNAP and VB.NET are complementary, not alternatives. You write VB code that calls SNAP functions. SNAP can't do anything without VB (or some other .NET language).

 

Reagrding your question ...

 

You cycle through the bodies in a part named "myPart" using code like

 

For Each solidBody as Snap.NX.Body in myPart.Bodies

Quite often "myPart" is just the work part, of course, so then it's:

 

For Each solidBody as Snap.NX.Body in Snap.Globals.WorkPart.Bodies

 

山田
yamada

Re: How to get a list of Bodies in Step file, SNAP or VB.NET, NX 11

Valued Contributor
Valued Contributor

 

Thanks - I have another question which is related to the question above (if I need to add another topic, please let me know).  I would like to get the the name 

 

Body(1)
Body(2)
...
Body(8)

However, if I use 

solidBody.ToString or SolidBody.Name

Then I get result like "Body 123435" or Blank instead of Body (1).  What should I use?  I try to play with getStringAttributes with Object Name but it won't help either.

 

 

 

 

 

 

Re: How to get a list of Bodies in Step file, SNAP or VB.NET, NX 11

Legend
Legend

I think what you are after are feature names.  Cycle for Features in the part and use GetFeatureName() for each feature.

 

 

Re: How to get a list of Bodies in Step file, SNAP or VB.NET, NX 11

Valued Contributor
Valued Contributor

Thanks - I will try later as the company only has a limited # of licenses so...there is often a person who steals my section.