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