×
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

Automating setting part attributes at instance level.

Automating setting part attributes at instance level.

Automating setting part attributes at instance level.

(OP)
I am trying to do automatic assignment of part attributes but need them to be applied at the level above the part.

Normally I do this by right clicking on the object that I want to set the attribute to and then selecting properties. Then I go to the attributes tab and make sure that the context is set to instance.

The code in the link provided can set an attribute at the component context but I am having trouble figuring out how to make it happen for the instance. Any help would be appreciated.

http://www.nxjournaling.com/content/add-component-...

RE: Automating setting part attributes at instance level.

What version of NX are you using?

www.nxjournaling.com

RE: Automating setting part attributes at instance level.

(OP)
NX 9

RE: Automating setting part attributes at instance level.

The code in the link was written for NX 7.5, things changed a bit in NX 8. The following code will assign a single string attribute to the object (you'll need a reference to the instance). Change the title and string value as needed.

CODE

Dim myObject as NXObject
myObject = {reference to your object}

Dim objects1(0) As NXObject
objects1(0) = myObject
Dim attributePropertiesBuilder1 As AttributePropertiesBuilder
attributePropertiesBuilder1 = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, objects1, AttributePropertiesBuilder.OperationType.None)

attributePropertiesBuilder1.IsArray = False

attributePropertiesBuilder1.DataType = AttributePropertiesBaseBuilder.DataTypeOptions.String

attributePropertiesBuilder1.Title = "test"

attributePropertiesBuilder1.StringValue = "test value"

Dim nXObject3 As NXObject
nXObject3 = attributePropertiesBuilder1.Commit()

attributePropertiesBuilder1.Destroy() 

www.nxjournaling.com

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