Introduction to the Scripting Interface
The Scripting Interface allows you to interact with eCADSTAR via the Component Object Model (COM) interface. It allows access to data in eCADSTAR Library Editor, eCADSTAR PCB Editor and eCADSTAR Schematic Editor using your own script or program. Highly customized reports can be created for Bill of Materials (BOM) and layers, for example. This provides greater flexibility when creating reports, compared to Report Generator. The scripting functionality uses eCADSTAR's part locking mechanism. This respects all instances of eCADSTAR Library Editor, rather than just the instance that created the lock.
The classes that can be accessed in eCADSTAR are shown in the Class Diagram for eCADSTAR Library Editor, Class Diagram for eCADSTAR Schematic Editor and Class Diagram for eCADSTAR PCB Editor Help topics. These diagrams show the structure of the classes and illustrates the relationship between them for each application. Click a class in the diagram to display its description on a separate page. This lists the members of each class, and describes their properties. For each class, the parent and child classes are listed in the Related topics section.
For a guide to using the Scripting Interface with various programming languages, see: Using the Scripting Interface. To download scripting examples for C#, C++ and for VBA macros in Excel, click: Scripting Examples. For a specified design, these provide a list of components and their associated parts.
If an earlier version of eCADSTAR is installed after a later version, then the scripting interface is regressed to the earlier version for both installed versions of eCADSTAR. To fix this issue, execute a repair install, or install the later version to restore the scripting interface to the latest version.
- No additional licence is required for the Scripting Interface.
- This feature is not available in eCADSTAR PCB Viewer or eCADSTAR Schematic Viewer.
- Note that .Net core, the default version of .Net for post-2017 products, does not support the IDispatch interface. This means that late binding is not possible to COM interface objects. Early binding must be used instead. In practice, this means that the object type must be specified. An example in VBA is shown below.
Imports eCSPCBCOM
Public Class Form1
Private Sub LaunchBtn_Click(sender As Object, e As EventArgs) Handles
LaunchBtn.Click
Dim DesignPath As String =
"C:\Users\autotest\Documents\variantdesign2021.pdes"
Dim App As PCBApplication 'Declare App explicitly as a PCBApplication type and not as an object
App = New PCBApplication() 'Allocate app
App.Visible = True
App.OpenDesign(DesignPath)
Dim Design As PCBDesign
Design = App.CurrentDesign()
DesignName.Text = Design.Name()
End Sub
End Class