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