×
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

change color surfaces

change color surfaces

change color surfaces

(OP)
hello
I need to change the tangent surfaces only selecting only one surface, I wrote this macro but doesn't work fine, it shows me all surfaces selected but doesen't change the color on the screen!!
someone can help me?
Thanks



Sub CATMain()

Dim InputObjectType(0)
Set Document = CATIA.ActiveDocument
Set Selection = Document.Selection
Dim prtPart As Part
Set prtPart = CATIA.ActiveDocument.Part
Dim oHSF As HybridShapeFactory
Set oHSF = prtPart.HybridShapeFactory

InputObjectType(0) = "Face"
Status = Selection.SelectElement2(InputObjectType, "Select a face", True)
If (Status = "cancel") Then Exit Sub
Set FirstFace = Selection.Item(1).Value
Selection.Clear

Dim newelement1 As HybridShapeExtract
Set newelement1 = oHSF.AddNewExtract(FirstFace)
newelement1.PropagationType = 2
newelement1.ComplementaryExtract = False
newelement1.IsFederated = False

prtPart.UpdateObject newelement1

Selection.Add newelement1


Set visPropertySet1 = Selection.VisProperties
visPropertySet1.SetRealColor 255, 0, 0, 0
Selection3 = Clear


End Sub

RE: change color surfaces

you script change the color of a new GSD element HybridShapeExtract. This does not change the solid in any way.

not sure what you want to achieve with

CODE -->

Selection3 = Clear 

you need to look at your options to do what you want:

check the B-Rep definition of the extract to find the face of the solid (hard to code, not sure if possible)
or
sew the extract on the solid then color the new solid feature (easiest)
or
get area, Cog of each face (and any other valuable info to identify a face) from the extract and cycle thru the solid to find the same face, then select and change color (the one you really want but might be slow, try to run in batch and see if faster)


maybe someone does have a better idea?

Eric N.
indocti discant et ament meminisse periti

RE: change color surfaces

(OP)
I need to change color in a mould ( solid body) to differentiate the matching surfaces to part surfaces without manually select.
I'm not an expert in VB code!!! I'm trying to assemble part of code.

RE: change color surfaces

i know that in Core and Cavity you have Face Color Editor, a function that will just do what you need. you select one face, it does propagate in tangency then you pick a color. Check online doc.

Eric N.
indocti discant et ament meminisse periti

RE: change color surfaces

(OP)
Yes! I know that fuction, unfortunately I don't have Core and cavity in my catia!

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! Already a Member? Login


Resources

White Paper - PLM and ERP: Their Respective Roles in Modern Manufacturing
Leading manufacturers are aligning their people, processes, and tools from initial product ideation through to field service. They do so by providing access to product and enterprise data in the context of each person’s domain expertise. However, it can be complicated and costly to unite engineering with the factory and supply chain. Download Now
White Paper - Medical Device Design Control
Medical device product development is a highly integrated and regulated process. Implementation of a requirements tracking solution requires attention to a variety of nuanced topics. When presented with the task of tracking the many concept relationships in a project of this type, the initial software solution of choice tends to be a two-dimensional text systems. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close