×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NX attribute Information - Unit

NX attribute Information - Unit

NX attribute Information - Unit

(OP)
Hi -

I am trying to extract the "unit" from a NX Part attribute.
It seems like regarding the documentation - it should be possible to ask for the Unit - but I am not sure how to - and to extract the unit as a string...

code start:
theSession.ListingWindow.Open()
For Each a_part As Part In theSession.Parts
theSession.ListingWindow.WriteLine(a_part.Leaf & " attributes:")
For Each attr_info As NXObject.AttributeInformation In
a_part.GetAttributeTitlesByType(NXObject.AttributeType.Any)
theSession.ListingWindow.WriteLine(attr_info.Title & " = " & a_part.GetStringAttribute(attr_info.Title))
'theSession.ListingWindow.WriteLine(a_part.GetStringAttribute(attr_info.unit) ' seems not to work
Next
theSession.ListingWindow.WriteLine("")
Next
code end:

Maybe one of you have a suggest or a solution - or just a hint - which can guide me in the direction of success..

Lklo

RE: NX attribute Information - Unit

attr_info.Unit returns a Unit type of object. Try accessing the Unit's .Abbreviation or .Name property.

CODE

writeline(attr_info.Unit.Abbreviation)
writeline(attr_info.Unit.Name) 

www.nxjournaling.com

RE: NX attribute Information - Unit

(OP)
Hi Cowski -

Thank you for your fast reply...
I just tried to "play" with your solution - but it seems like it still not possible for me to extract the Unit of part attribute..
I will try again tomorrow.....

lklo

RE: NX attribute Information - Unit

(OP)
Hi Cowski -

I did figure it out using the attr_info.Unit.Name.
I just needed to build in a small exception, so only if the attribute has a unit, program should ask for the unitname.
Thanks again...
lklo

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources