Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX11-Journal to add attribute to component 1

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
I am looking to have the user select a component, then have a box pop up that has two attributes for the user to fill in and when they hit OK it will add those two attributes to the component that was selected.

This would only add the attributes at the assembly level for that component of course.

Attribute Titles to add...

SPOT_ID
ZONE_STA_ROBOT

User would fill in the values

So far all I am finding is to change attributes for any components found with particular identifiers. I cant find anything that lets one choose the component and just add new attributes.

Any help is appreciated.
 
Replies continue below

Recommended for you

In case someone is interested in figuring this out.... This is what I am trying. As far as I know, I may be waaayyyy off base. lol

I have a journal that someone once made for me that pops up a window with particular attribute titles and lets the user fill them in and hit OK. Then it will add those attributes to the work part.

I found a journal that allows the user to select a component and it will extract a few attributes and write them into the info window.

I am trying to combine these two. Since the first journal is much more involved and actually is a combination of 3 .VB and a .dlx file, I decided to bring the single journal to select a component into the larger one.

I placed it in position so the entire thing runs. It will ask the user to select a component. Once the component is selected, it will pop up a window for the attributes to be filled in. The problem is it is not writing the attributes to the component at the assembly level. It is still writing the attributes to the assembly properties.

I have no idea whether I need to change something in the the added portion or change something in the original code to get the attributes to write to the selected components properties.

I have attached all 4 files that one needs to have to make it work. The "TAG Attributes" VB file is the one I am working on and is the one that needs to be ran. Unfortunately there are a couple places where paths also need to be updated when you place them in a folder. If you happen to have an R: drive and it would be easier to create the path I had them, it is R:\hms_tools\NX11\Tooling\Journals\TAG-attributes\"all four files go here"

Also, the portion of code I added is surrounded by '************** To help identify what was added. There is a section of code in the SUB and one function added.
 
 https://files.engineering.com/getfile.aspx?folder=17d676ee-6d86-40fa-b9cf-3465b4e517f5&file=TAG_Attributes.zip
The function "apply_cb" calls the "createAttribute" sub and passes in "bodyPart" as the target; "bodyPart" is just another reference to the current display part (most likely your top level assembly). In these calls to "createAttribute", you will need to pass in your component of interest. Which leads us to the component variable: "theComponent" is currently declared inside of sub "New", which means when sub New is done executing, "theComponent" will go out of scope and will no longer be available for use. I suggest moving the variable declaration to the 'class member' section (after the class declaration, but before Sub New); this will make it available anywhere in the class. Keep the call to "SelectComponent" where it is in Sub New.

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

Part and Inventory Search

Sponsor