Find object with same name as selected object
Find object with same name as selected object
(OP)
Hi guys,
I am still muddling thru... everything scripting related. hopefully this is an easy one...
What:
I attempted to create a simple script to select all parts with the same name as the one selected by the user.
I'm pretty sure I'm screwing up the way it searches. Any suggestions how make this work? (See image, orange is selected by user, and once script is run, the highlighted one will select also. however, if any part is selected, it will only highlight other parts with the same name)
why:
I am going to use this search module as part of a greater script to eventually change colors (as a few of you helped me before, tho I'm still in the works regarding that matter)
Thank you in advance for your support.
-Kyle

I am still muddling thru... everything scripting related. hopefully this is an easy one...
What:
I attempted to create a simple script to select all parts with the same name as the one selected by the user.
I'm pretty sure I'm screwing up the way it searches. Any suggestions how make this work? (See image, orange is selected by user, and once script is run, the highlighted one will select also. however, if any part is selected, it will only highlight other parts with the same name)
why:
I am going to use this search module as part of a greater script to eventually change colors (as a few of you helped me before, tho I'm still in the works regarding that matter)
Thank you in advance for your support.
-Kyle






RE: Find object with same name as selected object
I think you need to get the input from user with SelectElement2, then get selection.name from input and use it in a global search.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Find object with same name as selected object
'Preselect your part instance
Dim oSelection
Set oSelection = CATIA.ActiveDocument.Selection
Dim sNumber
sNumber = oSelection.item(1).value.name
oSelection.Clear
oSelection.search "Name =" & sNumber & ", all"