Using VB Macro Automation API

The following procedure explains how to activate the VB Macro Automation API for 3DSearch.


Before you begin: Make sure to close the 3DSearch panel before using Search with VB Macro.
  1. Start CATIA.
  2. Create a macro library.
    1. In the Tools menu, select Macro, and click Macros...
      The Macros dialog opens.
    2. In the Library type list, select PLM VBA projects.
    3. Click Create new library...
    4. In the Name field, enter the name you want to assign to the macro library, or keep the default name.
    5. Click Finish.
    6. Close the Macro libraries dialog.
    7. Close in the Macros dialog.
  3. In the Tools menu, select to Macro, and click Visual Basic Editor...
    The Microsoft Visual Basic window opens.
  4. In the Project pane, right-click your created macro library, select Insert, and click Module.
  5. Right-click the created module, and click View Code.
  6. In the right pane, create and run a Sub CATMain.

    The search enables you to find PLM data in the database according to your criteria.

    Sub CATMain()
    'Retrieve the Search service from CATIA session
    Dim searchService As searchService
    Set searchService = CATIA.GetSessionService("Search")
    . . .
    IndexedSearch.Search
    End Sub

  7. Click the macro name, and click to run the macro.
    If data matching the search parameters is found, a window opens to display the search results.