Creating Wire References
Using Macros

The wire reference creation will be done using a VisualBasic macro (.CATScript extension).
This macro calls an Electrical Library method. This method needs two arguments:
  • The catalog in which the wire references will be stored
  • A neutral file in which the wire references are described (CSV file defined in Excel).
    The default column separator used by Electrical Library for CSV files is the semi-colon ";".
aprereq.gif (1223 bytes) Copy the following files in your c:\Temp from the samples folder and uncheck the Read-only attribute:
  • CreateWires.CATScript
  • WiresDefinition.csv
  • CatalogOfWires.catalog
If you work on Unix platform, make sure you modify the paths consequently in the CreateWires.CATScript document.
aprereq.gif (1223 bytes) The script below is given as an example of the macro:
Wire creation and storage in catalog


Sub CATMain()

  'Definition of input data
  'WARNING: Define the absolute path of the inputs
  '(csv file and catalog)

  csvFile = "c:\Temp\ListOfWires.csv"

  catalogfile = "c:\Temp\CatalogOfWires.catalog"

  'Open Catalog

  Dim Catalog As Document

  Set Catalog = CATIA.Documents.Open(catalogfile)

  'Get the "ElectricalLibrary" workbench

  Dim Wkb As Workbench

  Set Wkb = Catalog.GetWorkbench("ElectricalLibrary")

  'Create the wires references and store them in the catalog

  Wkb.CreateWiresIntoCatalog csvFile, catalogfile

End Sub

aprereq.gif (1223 bytes) A CATIA session is running. In order to launch the macro:
  1. Select the Tools > Macro > Macros... item.

    The dialog box opens:
  2. Click Select... and choose the CATScript file.

  3. Edit it and update the csvFile and catalogfile variable with the corresponding paths, if need be.

  4. Then run it!
    Once the macro performed, the result looks like this:
    if a mapping has been defined, the Reference tab will display this information.

Other views are available giving more information if attributes have been defined in the catalog:
  • The Reference tab displays the wire references attributes
  • The Keywords tab
  • The Preview tab shows the wire references with a graphical representation
  • The Generative Data tab.

For more information, refer to the Component Catalog Editor User's Guide.