Change color and layer
Change color and layer
(OP)
Let me start by saying I know nothing about scripting. I copied this out of the portable script center.
I'm looking for this script to do exactly what it does, except I want it to pick everything visible on my screen, as opposed to the user selecting a single face. Can this be done?
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
I'm looking for this script to do exactly what it does, except I want it to pick everything visible on my screen, as opposed to the user selecting a single face. Can this be done?
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





RE: Change color and layer
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set selection1 = partDocument1.Selection
selection1.Search "((CATGmoSearch.Surface + CATGmoSearch.Curve) - CATGmoSearch.Plane),scr"
End Sub
Regards,
Derek
Win XP64
21SP6/22SP4, 3DVIA Composer 2013X, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: Change color and layer
RE: Change color and layer