HagenT
Mechanical
- Dec 1, 2015
- 14
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:
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