×
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

CATIA SCRIPT FOR CHANGE COLORS

CATIA SCRIPT FOR CHANGE COLORS

CATIA SCRIPT FOR CHANGE COLORS

(OP)
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.

RE: CATIA SCRIPT FOR CHANGE COLORS

(OP)
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?

RE: CATIA SCRIPT FOR CHANGE COLORS

(OP)
I have tried it now. It doesn't seem to work.

RE: CATIA SCRIPT FOR CHANGE COLORS

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

RE: CATIA SCRIPT FOR CHANGE COLORS

from what i can see it's the following code that change the color of sketch contraints

CODE --> 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 --> 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

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