I would like to select some products and get their names and part number.
I found how to do it for first selected product, but I need to select many products at once:
How can I do achieve this?
I found how to do it for first selected product, but I need to select many products at once:
Code:
Sub CATMain()
' Retrieve the selected component
Dim oSelection As Selection
Set oSelection = CATIA.ActiveDocument.Selection
Dim oProduct As AnyObject
On Error Resume Next
Set oProduct = oSelection.FindObject("CATIAProduct")
If (Err.Number <> 0) Then
MsgBox "No selected product"
Else
On Error Goto 0
' Read information on the component
Dim sTextString As String
sTextString = oProduct.Name & " / " & oProduct.PartNumber
msgbox sTextString
End If
End Sub
How can I do achieve this?