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!

Change color by name?

Status
Not open for further replies.

borisboris

New member
Mar 10, 2013
10
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:
 
Replies continue below

Recommended for you

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