Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE 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
Joined
Jul 19, 2017
Messages
2
Location
US
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!
 
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

Back
Top