×
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 Journal read Attribute from Stock (routing)

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?

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)

Attributes can be stored against many different types of objects including:
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 -->

For Each my_body As Body In theSession.Parts.Work.Bodies
aInfo = my_body.GetUserAttribute(aTitle, NXObject.AttributeType.Any, -1)
etc etc


Next 

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 -->

For Each my_body As Body In theSession.Parts.Work.Bodies 
with

CODE -->

For Each my_feat As Features.feature In theSession.Parts.Work.features 
in my little snippet above.

Mark Benson
Aerodynamic Model Designer

To a Designer, the glass was right on CAD.

RE: NX Journal read Attribute from Stock (routing)

(OP)
Hy Mark,

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)

You will first need to determine where the attribute has been applied. In the case of an extrude, the attribute may be applied to the feature itself or the resulting body. I'm not familiar with the routing application, so I don't know where it applies attributes. You can check by right clicking on the feature/body, choosing properties, and checking the attributes tab.

www.nxjournaling.com

RE: NX Journal read Attribute from Stock (routing)

(OP)
Hy Mark and cowski,

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

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