Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Select components and get attributes

Status
Not open for further replies.

xrowex

Marine/Ocean
Jul 19, 2017
2
Hey guys/gals! I am trying to create a journal in NX 8.5 and I am working with ReUse Design Elements. I am guessing these are considered components. I am having trouble figuring out the VBA code to prompt the user to select multiple components and write them to a text file. Links to help or code examples? Thanks!
 
Replies continue below

Recommended for you

So I got the code to select multiple components and get a certain attribute but one of my attributes is on the Design Element. How can I go from a Component level to a Design Element level?[ul]
[li][/li]
[/ul]
 
Well I did this some time ago. I can't remember exactly how I looped through an assembly with each object as a Design Element but I think I do. In order to query the design element you will need to load a subset into NX, and from there you can loop through the subset by doing something like this:

Code:
Dim S as Subset = part.ComponentAssembly.RootComponent.Subset
In this case "part" is equivalent to the work part loaded.

Once you have the subset you can query it for Design Elements:

Code:
Dim DesignElements as PDM.DesignSubordinateRevision() = S.GetDesignSubordinateRevisionMembers()

Then you can loop through DesignElements() and process each one. For the most part they are treated as components when it comes to querying attributes.

Check the NXOpen API docs for the subset class to see other similar calls you can make like the one above.

Sorry I didn't lay out all of the code, but that should be enough to get you started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor