'CATScript   http://ww3.cad.de/foren/ubb/Forum137/HTML/001678.shtml#000012

Sub CATMain()

Set oMainProduct = CATIA.ActiveDocument.product

Dim oMainProducts As Products
Set oMainproducts = oMainProduct.Products

Umbenennen oMainProducts

End Sub

Sub Umbenennen(oProducts As Products)

Dim oPartName As String
Dim oName As String
Dim i As Long

For x = 1 to oProducts.Count

Set oInstance = oProducts.Item(x)
oNumber = oInstance.PartNumber
oName = oInstance.Name

i=0
Do

On Error Resume Next

i = i+1

If i>5000 Then  ' Zahl soll angepasst werden
Exit Do
End If

oInstance.Name = oNumber & "." & i

If Err.Number = 0 Then

Umbenennen oProducts.Item(x).ReferenceProduct.Products
Exit Do
ElseIf Err.Number = -2147467259 Then
Err.Clear
Err.Number = 0
Else
Exit Do
End If
Loop
If oInstance.Products.Count > 0 Then
Umbenennen oInstance.Products
End If
Next

End Sub