Using the Scripting Interface with C++

The procedure is described below to perform referencing within the eCADSTAR Scripting Interface. The methods for getting or setting of the COM properties are also described, and the procedures are provided for using C++ scripts in eCADSTAR Library Editor, eCADSTAR Schematic Editor and eCADSTAR PCB Editor.

Referencing eCADSTAR

To view the functions and properties that are available within the scripting interface, the #import file must be executed as described below. For more information, see #import Directive (C++).

In eCADSTAR Schematic Editor

                   #import "C:\Program Files\eCADSTAR\eCADSTAR 2019.0\bin\eCS_scm.exe"

In eCADSTAR PCB Editor

                   #import "C:\Program Files\eCADSTAR\eCADSTAR 2019.0\bin\eCS_pcb.exe"

 

This also introduces the smart pointer (_com_ptr_t) definition for each interface. For example, ISchApplicationPtr for ISchApplication. For more information, see: _com_ptr_t Class.

 

C++ Property

The two methods for getting or setting COM properties are described below. The first method uses standard C++, whereas the second method uses the Visual C++ property extension. When using the Visual C++ property extension, the COM property getters and setters are used like a member variable. For more information, see: property (C++).

 

               // Standard C++ way
               long sheetNumber = 0;
               sheet->get_Number(&sheetNumber);

 

               // Using C++ property
               sheet->Number;

 

Library Editor

Launch a new instance of eCADSTAR Library Editor as follows.

 

               ILEApplicationPtr app;
               app.CreateInstance(__uuidof(LEApplication));
               app->OpenDesign(argv[1]);

 

Connect to a running instance of eCADSTAR Library Editor as follows.

 

               ILEApplicationPtr app;
               app.GetActiveObject(__uuidof(LEApplication));

 

eCADSTAR Schematic Editor

Launch a new instance of eCADSTAR Schematic Editor as follows.

 

               ISchApplicationPtr app;
               app.CreateInstance(__uuidof(SchApplication));
               app->OpenDesign(argv[1]);

 

Connect to a running instance of eCADSTAR Schematic Editor as follows.

 

               ISchApplicationPtr app;
               app.GetActiveObject(__uuidof(SchApplication));

 

PCB Editor

Launch a new instance of eCADSTAR PCB Editor as follows.

 

               IPCBApplicationPtr app;
               app.CreateInstance(__uuidof(PCBApplication));
               pp->OpenDesign(argv[1]);

 

Connect to a running instance of eCADSTAR PCB Editor as follows.

 

               IPCBApplicationPtr app;
               app.GetActiveObject(__uuidof(PCBApplication));