×
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

Changing the color of a surface with a formula

Changing the color of a surface with a formula

Changing the color of a surface with a formula

(OP)
Hello:

This may sound like a simple question but the subject has never came up with me.

I can change a value with a formula but can I change the color of a surface with a formula?

If this can be done please post a sample of the syntax so I may apply it to my part.

Thank you in Advance
 

RE: Changing the color of a surface with a formula

You need the KWA license for this and it would go in a rule or reaction.

`Geometrical Set.1\Extrude.1` .Color = "Blue"


Scripting can change to colors too.  Here is a sample script (Thank Ferdo and his portable script center for this)

Sub CATMain()

Dim partDocument1 As Documents
Set partDocument1 = Catia.ActiveDocument

Dim part1 As Parts
Set part1 = partDocument1.Part

Dim selection As Selection
Set selection = Catia.ActiveDocument.Selection

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

'~ setup filter
      ReDim sFilter(0)
         MsgBox "Select a Face"
         sFilter(0) = "Face"
         sStatus = Selection.SelectElement2(sFilter, "select a Face", False)

Dim Obj As VispProperties
Set Obj = Selection.VisProperties

Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties

'~ change layer
 visProperties1.SetLayer catVisLayerBasic, 200

 '~ change colour
Obj.SetRealColor 100,10,255,0
Obj.SetRealLineType 4,0
Obj.SetRealWidth 100,0

part1.Update



End Sub





Regards,
Derek
 

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