Using the Scripting Interface with C#

The procedure is described below to enable the preview of all available functions and properties within the scripting interface in eCADSTAR. The procedure is also described for using C# scripts in eCADSTAR Library Editor, eCADSTAR Schematic Editor and eCADSTAR PCB Editor.

Referencing eCADSTAR

When using Visual Studio, add the reference for Type Libraries to the project as follows. This enables the preview of all available functions and properties within the scripting interface. The procedure is shown for both eCADSTAR Schematic Editor and eCADSTAR PCB Editor.

  1. In Visual Studio, select Add > Reference… on the Project menu.
  2. Select COM > Type Libraries.
  3. Select the following:
  4. In eCADSTAR PCB Editor, select eCSPCBCOM.
  5. In eCADSTAR Schematic Editor, select eCSSCHCOM.

eCADSTAR Library Editor

To launch a new instance of the application:

 

               var app = new eCSLECOM.LEApplication();
               app.OpenLibrary(libraryPath);

 

To connect to a running application instance:

 

               eCSLECOM.LEApplication app = null;
               try
               {
                   app = Marshal.GetActiveObject("eCADSTAR.LibraryEditor.Application") as eCSLECOM.LEApplication;
               }
               catch (COMException e){
                   // No instance running.
               }

   

eCADSTAR Schematic Editor

To launch a new instance of the application:

 

               var app = new eCSSCHCOM.SchApplication();
               app.OpenDesign(designPath);

 

To connect to a running application instance:

 

               eCSSCHCOM.SchApplication app = null;
               try
               {
                   app = Marshal.GetActiveObject("eCADSTAR.SchematicEditor.Application") as eCSSCHCOM.SchApplication;
               }
               catch (COMException e){
                   // No instance running.
               }

 

eCADSTAR PCB Editor

To launch a new instance of the application:

 

               var app = new eCSPCBCOM.PCBApplication();
               app.OpenDesign(designPath);

 

To connect to a running application instance:

 

               eCSPCBCOM.PCBApplication app = null;
               try
               {
                   app = Marshal.GetActiveObject("eCADSTAR.PCBEditor.Application") as eCSPCBCOM.PCBApplication;
               }
               catch (COMException e){
                   // No instance running.
               }