Continue to Site

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: Geometrical set Lines and curves color

Status
Not open for further replies.

JORGEGSilva

Mechanical
Jul 22, 2022
2
Hello.
I'am trying to create a macro to change the line color in a geometrical set but can't figure out to acess the property that i want.
I have a set of lines that are inside a geometrical set, but they are white i want to change them to another color.
when selecting the geometrical set and acessing to its graphical properties when i change the color in lines and curve color, it changes the color of all the lines inside(what i want) but i'am not being able to acess to that property by macro. can someone help?
example in attachement.
 
 https://files.engineering.com/getfile.aspx?folder=2f9608c4-7dd0-4ba5-bd87-35b5dd28c2ac&file=Snapshot_2022-07-22_191538.jpg
Replies continue below

Recommended for you

Not easier to add your lines to selection and use visproperties.SetRealColor ?
 
Like TudorM said,

You have to go with visproperties.

Then you have access to graphic properties.

CNEXT_sTDAvZzHsi_kttnir.png


Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
Here an example of changing a color of selected elements.

Code:
Sub CATMain()

On Error GoTo 0

Dim InputObjectType(0)

Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument

Dim Selection As Selection
Set Selection = partDocument1.Selection

Dim shapeFactory1 As Factory

RED = 175
GREEN = 255
BLUE = 175

If (Selection.Count < 1) Then
   MsgBox "      Nenhum elemento seleccionado !" + Chr(10) + Chr(10) + "     Seleccione os elementos, e repita o comando.    "
   
    Exit Sub
End If

Dim MyPropSet As VisPropertySet
Set MyPropSet = Selection.VisProperties

MyPropSet.SetRealColor RED, GREEN, BLUE, 0

End Sub

Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor