I have a problem that how can I read the attribute of component part and create a note in drafting, let this note could update according to the attribute of component part(Children level)? For now, I found I only could read the attribute of top component part(Parent level), for example, I import <W@Material> in the note, it works but only for parent level, not for children level. I found someone use a good way to read the the attribute of children level like <W!66189@Material>, it works, and the number "66189" looks like a random number, every time to open the part, this number will be changed.
I'll be very appriciated if anyone could help me to achieve it?
I use NX6.0 to develop.
Thanks in advance!
Solved! Go to Solution.
I'm not shure if I got your question.
You should always be able to ask attributes on objects such as components and/or parts.
YourObject.GetStringAttribute() in NX6 or YourObject.GetUserAttributeAsString() in NX8 or later should work fine.
The magic numbers are internal references (tags) that are resolved by NX in your session.
I have a legacy function (since UGII aera) that updates notes with attribute values. All notes which needs an update by an attribute have the attribute title as name on the note element. So the program cycles through all the notes on a part/drawing sheet, reads the name of the note and gets the corresponding attribute value. This is used to set the note text.
Hope this helps
the magic number is a TAG (NXopen.Tag). Each NXOpen.TaggedObject has one.
A NXOpen.Assemblies.Component is derived from TaggedObject, so you can access the tag using
To form a reference text use something like (in C#)
To update note programmatically like mentioned in my previous reply you can
Hope this helps
It looks like there is a problem with special characters.
So I post an image to show the String.Format statement.