NX Journal read Attribute from Stock (routing)
NX Journal read Attribute from Stock (routing)
(OP)
Hy all together,
I´m new with NX Journaling and got a Problem by reading an Attribute from a part.
All the part attributes i can read with my Journal. But there are some attributes assingned to the stock (extrude) in the part.
I tried to read the Material Attribute (string) but it didn´t work.
Can sombody help me?
Thanks for helping me.
I´m using NX 9 with TC 10
I´m new with NX Journaling and got a Problem by reading an Attribute from a part.
All the part attributes i can read with my Journal. But there are some attributes assingned to the stock (extrude) in the part.
I tried to read the Material Attribute (string) but it didn´t work.
Can sombody help me?
CODE --> vb
Const aTitle As String = "MATERIAL"
Dim aInfo As NXObject.AttributeInformation
Dim aStrValue As String = "default value"
If workPart.HasUserAttribute(aTitle, NXObject.AttributeType.Any, -1) Then
'attribute exists, retrieve information
aInfo = workPart.GetUserAttribute(aTitle, NXObject.AttributeType.Any, -1)
Select Case aInfo.Type
Case Is = NXObject.AttributeType.Boolean
aStrValue = aInfo.BooleanValue.ToString
Case Is = NXObject.AttributeType.Integer
aStrValue = aInfo.IntegerValue.ToString
Case Is = NXObject.AttributeType.Real
aStrValue = aInfo.RealValue.ToString
Case Is = NXObject.AttributeType.String
aStrValue = aInfo.StringValue
Case Else
'add other cases as necessary
End Select
lw.WriteLine(ainfo.Title.tostring & " - " & aStrValue)
Else
'attribute does not exist
lw.WriteLine("attribute does not exist, creating it...")
'create string attribute
'workPart.SetUserAttribute(aTitle, -1, aStrValue, Update.Option.Now)
End If Thanks for helping me.
I´m using NX 9 with TC 10





RE: NX Journal read Attribute from Stock (routing)
Part
Body (Sheet or solid)
Face
Edge
etc
etc
Your code is only looking at the attributes attached to the part file hence the
workpart.getuserattribute function.
if you wanted to check the attribute of a body you could get all the bodies of the workpart:
CODE -->
I've not dealt with stock so I'm not sure what type of object you need but if it is an extrude it may be you need to replace
CODE -->
CODE -->
Mark Benson
Aerodynamic Model Designer
To a Designer, the glass was right on CAD.
RE: NX Journal read Attribute from Stock (routing)
thank you a lot.
Seems to be very easy but it´s not so easy to find in net.ref.
I will test this tomorrow in the mornig.
Hagen
RE: NX Journal read Attribute from Stock (routing)
www.nxjournaling.com
RE: NX Journal read Attribute from Stock (routing)
thank you very much.
I change my code this morning and it works well.
I know where attributes could be applied. It somethimes not easy using german Version of NX and Journal.
I will switch to english version.
Some attributes of routing mechnical parts are stored in configuration files of NX routing and set to the component by using routing function.
Hagen