×
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

Stumped on Attributes and Expressions (Setting an attribute of a component within an assembly)

Stumped on Attributes and Expressions (Setting an attribute of a component within an assembly)

Stumped on Attributes and Expressions (Setting an attribute of a component within an assembly)

(OP)
Hi Everyone,

I am stumped on a tricky little project I am working. So far I have figured out how to use ug_setStringAttrValue_(...) to set an attribute on a part within my design. I know I can use interpart expressions but the complication is I am trying to setup seed parts that will be duplicated quite regularly and I am trying to avoid having to fix broken links everytime we copy the seed. Here is my demo Structure:

ASSY1
|-1234.prt ("Component Name" = "A")
|-1234.prt ("Component Name" = "B")
|-5678.prt ("Component Name" = "C")


Right now, I have the following expression inside of ASSY1 and it works:
test = ug_setStringAttrValue_("1234", "PART_ATTRIBUTE", "FUNCTION", "TESTVALUE", "TOOL_DESIGN")

However, instead of assigning attributes to the part, I want to assign the attribute to the component name = A. I tried a few things so far and not much has worked.

test = ug_setStringAttrValue_("A", "COMPONENT_ATTRIBUTE", "FUNCTION", "TESTVALUE", "TOOL_DESIGN") (Failed, Part Not Loaded)

Then I found this set of commands:
ug_hostpointerToString(ug_askPartOccOfInstance("A"))
AM I on the right track trying to get the part occurance of Instance "A"?

Is this possible with expressions and attributes or do I need to write some nx/open code?
Any help would be greatly appreciated. It has been a fun Sunday afternoon project.... Thank you!!


Thanks,
-Patrick
Molex INC.

Thank you,
-Pat

RE: Stumped on Attributes and Expressions (Setting an attribute of a component within an assembly)

My understanding is that Molex is running NX 8.5. If this is true, then why are you using the Expression KF attribute functions, such as 'ug_setStringAttrValue...'? These routines, while they technically can still be used, have been replaced with explicit Attribute Expression functions as of NX 8.0. If you're still using these all-but-obsolete KF routines, you're making extra work for yourself. I would recommend that you review the Attribute routines for linking to Expressions and the Expression routines for linking to Attributes.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Stumped on Attributes and Expressions (Setting an attribute of a component within an assembly)

(OP)
Thanks john.

Yes, we are using 8.5 I aware of using the tools in the new properties menu to set attributes but I am trying to auto some things for creating seed files based off a master assembly. That's why I was using the old call so as to avoid linked expressions that won't update when we clone the seed.

Thanks,
-Pat

Thank you,
-Pat

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