Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

pcalonzi2

Mechanical
Feb 1, 2013
18
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
 
Replies continue below

Recommended for you

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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor