Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Change color by name?

Status
Not open for further replies.

borisboris

New member
Joined
Mar 10, 2013
Messages
10
Location
FR
hi,

I would to make a macro to change CATPart(s) color in CATProduct according to their names.
I always have the same names and I'd like standardizing colors for every part (ex: "screw" in blue, "nut" in yellow, "washer" in green

Have you an idea?

Thank's!


time to loose:
 
Hi,

Bellow is a simple example, modify the code according to your needs

Code:
Language="VBSCRIPT"

Sub CATMain()

Dim productDocument1 As Document
Set productDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = productDocument1.Selection
selection1.Search "CATProductSearch.Part.PartNumber=screw*,all"

Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetRealColor 0,128,255,1

Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties
visProperties1.SetRealOpacity 255,1

selection1.Clear

End Sub

Regards
Fernando

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top