Catia V5 VBA: Get partnumber in selected part

Viewed 591

I want to create a macro get properties of part & product in my design. I need to get partnumber of part. When i selected in Tree or selected with "Product selection". It works with the same code:

 Dim objSel
 Set objSel = Catia.ActiveDocument.Selection
 parNo= objSel.Item(1).Value.PartNumber

But it's not convenient. I want to get PartNumber when I select any object (Edge, plane, surface...). By all the way, how can I get it?

Thanks & Best regards,

1 Answers

If you are selecting in an assembly you can use Leafproduct instead of Value

parNo = objSel.Item(1).LeafProduct.PartNumber
Related