Search code examples
vbacatia

Catia V5 macro getting name of part where axis system is in


I want to get the name of the part where the axis system is in that I found using the following macro script:

'build query string
Dim sQuery
sQuery = "CatPrtSearch.AxisSystem.Visibility=Visible,all"

Dim Selection
Set Selection =CATIA.ActiveDocument.Selection  
Selection.Search sQuery

But I can't find a way to find the name of the part where the axis systems are in. Does someone have any idea on how I can get that information without user input.


Solution

  • Dim sQuery
    sQuery = "CatPrtSearch.AxisSystem.Visibility=Visible,all"
    
    Dim Selection
    Set Selection = CATIA.ActiveDocument.Selection  
    Selection.Search sQuery
    
    for i = 1 to Selection.Count2
       MsgBox Selection.Item2(i).Document.Name 'name of document  
       MsgBox Selection.Item2(i).LeafProduct.Name 'name of instance product  
    next