Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching the color of the selected face

Status
Not open for further replies.

Jeoy

Automotive
Jan 3, 2019
3
0
0
CN
Hi Guys,
Is someone know how to searching the color of the selected face?
I write one as below, but it always shows mistake at last two line. Could someone please help? Many thanks.
Sub CATmain ()
Dim objSel As Object
Dim varFilter(0) As Variant
Dim strReturn As String
Dim strMsg As String

strMsg = "After clicking OK, select what color you want to changing"
MsgBox strMsg, 64, "Instructions"

Set objSel = CATIA.ActiveDocument.Selection
objSel.Clear
varFilter(0) = "AnyObject"
strReturn = objSel.SelectElement2(varFilter, "Select any object in the active document…", False)

CATIA.DisplayFileAlerts = False

Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties

Dim r, g, b

r = CLng(0)

g = CLng(0)

b = CLng(0)

visProperties1.GetRealColor r, g, b

Set productDocument1 = CATIA.ActiveDocument
Set selection1 = productDocument1.Selection

selection1.Search "(Topology.CGMFace & Color=visProperties1.GetRealColor r, g, b),all"

End Sub
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top