I have a assembly like:
RootProduct:
- SubProduct with Parts
- Part 1
- Part N
I'm writing code that check what type of item user selected and add new Part with my own parameters to the selected Product. And I have a problem with checking what user selected. If use code below:
InputType(0) = "Product"
Set ItemSelection = ActDoc.Selection
ItemSelection.Clear
SelStatus = ItemSelection.SelectElement2(InputType, "Choose Product", True)
If SelStatus = "Cancel" Then
Exit Sub
End If
If ItemSelection.Item(1).Type = "Product" Then
' add new Part
ElseIf ItemSelection.Item(1).Type = "Part" Then
MsgBox "It's Part. Script closed."
Exit Sub
End If
But problem is that in CATIA tree "Part" and "Product" have same type - Product.
May be exist another method how to check what type of data user selected? Thank you.