Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX attribute Information - Unit

Status
Not open for further replies.

lklo

Industrial
Nov 24, 2010
226
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
 
Replies continue below

Recommended for you

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
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor