Changing features ( like name, user added properties ) of components within a selected sub assembly
Changing features ( like name, user added properties ) of components within a selected sub assembly
(OP)
Good morning
CatiaV52012 CatScript.
Selections question..
I am working on a macro that prompts a user to select a sub-assembly and then loop thru its list of components/instances
renaming the part numbers to company preferences. So far so good... I was using this snippet here to do a rename.
MyObject.Products.item(InstanceCount).PartNumber = NewPartNum
where MyObject = a user selected sub assembly CATProduct.
Now I have been requested to change some more features like the name, and a few user added properties. This is where I am
running into some problems
How do I access features like name, nomenclature, user added properties of a component within a selected CatProduct?
Example
Product1
|--Part1
|--Part2
|--Part3
Product1 is selected by user. I want to change Part1.name, Part1.User defined property1, etc..
Seems like everything I'm trying is not working. Any helpful suggestions?
CatiaV52012 CatScript.
Selections question..
I am working on a macro that prompts a user to select a sub-assembly and then loop thru its list of components/instances
renaming the part numbers to company preferences. So far so good... I was using this snippet here to do a rename.
MyObject.Products.item(InstanceCount).PartNumber = NewPartNum
where MyObject = a user selected sub assembly CATProduct.
Now I have been requested to change some more features like the name, and a few user added properties. This is where I am
running into some problems
How do I access features like name, nomenclature, user added properties of a component within a selected CatProduct?
Example
Product1
|--Part1
|--Part2
|--Part3
Product1 is selected by user. I want to change Part1.name, Part1.User defined property1, etc..
Seems like everything I'm trying is not working. Any helpful suggestions?





RE: Changing features ( like name, user added properties ) of components within a selected sub assembly
Set TmpObject = MyObject.Products.item(InstanceCount)
TmpObject.Name = NewPartNum
TmpObject.ReferenceProduct.UserRefProperties.Item("Det").Value = "Yippee"
I tried to access a component thru the selection of its CatProduct but that didn't seem to
work so I tried ( see above ) to make a temporary object variable hold the object I wanted to change
and start changing things.
The assignment of "Yippee" worked. The user defined property was filled with "Yippee"
TmpObject.Name didn't seem to work though..