Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Changing features ( like name, user added properties ) of components within a selected sub assembly

Status
Not open for further replies.

JayEnn1

Automotive
Sep 29, 2015
50
US
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?
 
Replies continue below

Recommended for you

I think I stumbled upon a solution

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

Part and Inventory Search

Sponsor

Top