Bonjour, Je débute en vbscript sur Catia. Je n'arrive pas avec le code suivant à sélectionner le Main Part Body d'une CATPart afin de lui appliquer un layer + couleur CATProduct1 | -- CATPart1 | |-- PartBody | -- CATPart2 | |-- PartBody | -- CATPart3 | |-- PartBody | -- .......
........
Sub CATMain()
Set documents1 = CATIA.Documents
For i = 1 To documents1.Count
myPart = documents1.Item(i).Name
If Mid(myPart, Len(myPart) - 7) = ".CATPart" Then
nom = Mid(myPart, 1, Len(myPart) - 8)
Set partDocument1 = documents1.Item(i)
Set product1 = partDocument1.GetItem(nom)
nom_fichier = product1.PartNumber
' Retrieve main partbody from CATPart
Set Body1 = partDocument1.Part.MainBody
Body1Name = Body1.Name
MsgBox Body1.Name
Set selection1 = CATIA.ActiveDocument.Selection
'Set selection1 = documents1.Item(i).Selection.Add(Body1)
selection1.Add product1.Products
Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties
visProperties1.GetLayer layertype,
'visProperties1.SetRealColor 128, 64, 64, 4
selection1.Clear
End If
Next i
End Sub
Merci d'avance pour votre aide