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!

CATIA SCRIPT FOR CHANGE COLORS

Status
Not open for further replies.

ciab

New member
Nov 15, 2016
5
IT
Hello everyone,
I created a script to change the colors of bodies but mistakenly I also changed all the other features.
this is the script text:

Sub CATMain()
'------------------------------------------------------
Dim sSel As Selection
Set sSel = CATIA.ActiveDocument.Selection

'show all MechanicalFeature
sSel.Search "CATPrtSearch.MechanicalFeature,all"
sSel.VisProperties.SetRealColor 210, 210, 255, 1
sSel.Clear

sSel.Search "CATPrtSearch.MechanicalFeature.Visibility=Invisible,all"
sSel.VisProperties.SetShow 0 '0visible
sSel.Clear

sSel.Search "CATProductSearch.Part.Visibility=Invisible,all"
sSel.VisProperties.SetShow catVisPropertyNoShowAttr
sSel.Clear

sSel.Search "CATAsmSearch.Product,all"
sSel.VisProperties.SetShow catVisPropertyShowAttr
sSel.VisProperties.SetRealColor Auto,Auto,Auto,Auto
sSel.VisProperties.SetRealOpacity 255, 1
sSel.Clear

sSel.Search "CATProductSearch.Part,all"
sSel.VisProperties.SetShow catVisPropertyShowAttr
sSel.VisProperties.SetRealColor 210, 210, 255, 1
sSel.VisProperties.SetRealOpacity 255, 1
sSel.Clear

'modify bodyfearure properties
sSel.Search "CATPrtSearch.BodyFeature,all"
sSel.VisProperties.SetShow catVisPropertyShowAttr
sSel.VisProperties.SetRealColor 210, 210, 255, 1 'grigio catia
sSel.VisProperties.SetRealOpacity 255, 1 '255 opaco-0 trasparente,
sSel.Clear
End Sub


Can you suggest me how can I reset all to the default colors? (In particular I need to reassign the original green color of constraints).
Thank you.
 
Replies continue below

Recommended for you

Hi Ferdo,
thank you for your answer. I tried your script indicated in the link above but the contraints color doesn't change.
Do you have another idea?
 
I have tried it now. It doesn't seem to work.
 
which constraints are you talking about? Assembly constraints? Sketch constraint?

What color are they after your script?

Can you upload a picture (plz use Upload image function) of the spec tree with the constraints?

Eric N.
indocti discant et ament meminisse periti
 
from what i can see it's the following code that change the color of sketch contraints

Code:
sSel.Search "CATProductSearch.Part,all"
sSel.VisProperties.SetShow catVisPropertyShowAttr
sSel.VisProperties.SetRealColor 210, 210, 255, 1

and I don't understand why you push a color to the instances when on the lines above you set everything to auto, an you started with setting the color of body to the color you want...

Changing instances color does affect sketch constraints and wireframe (they all go black)

to go back to normal do:
Code:
sSel.Search "CATProductSearch.Part,all"
sSel.VisProperties.SetShow catVisPropertyShowAttr
sSel.VisProperties.SetRealColor Auto, Auto, Auto, Auto



Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top