×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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?

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

(OP)
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" smile

TmpObject.Name didn't seem to work though.. sad

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources