Bonjour,
J ai fait un macro qui me renomme tous les Products sur un arbre composer de WP et Part.
Le premier niveau se passe très bien mais, même si mes valeurs sont reconnues aucune modification ne s'effectue.
Voici mon scrpit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Sub catia_models_list()
 
Dim objRootProductDoc As ProductDocument
Dim mySel As Selection
Dim myProduct As Product
Dim i As Integer
 
        Set objRootProductDoc = CATIA.ActiveDocument
        Set mySel = CATIA.ActiveDocument.Selection
 
    mySel.Search ("'Assembly Design'.Product,sel")
         For i = 1 To mySel.Count
         Set myProduct = mySel.Item(i).Value
         Set product2 = myProduct.Item
 
                If Right(myProduct.Name, 2) Like ".*" Then
                lenght = Len(myProduct.Name) - 2
                string1 = Left(myProduct.Name, lenght)
               ' string1 = myProduct.Name
 
myProduct.Name = string1
 
        End If
    Next
 
End Sub
Si quelqu'un peu m'aider

merci