Explore Scripting for E3.series
Welcome to the dynamic world of scripting for E3.series, where customization and efficiency meet to transform your electrical design experience. Scripting for E3.series opens up endless possibilities, allowing you to automate routine tasks, tailor workflows, and extend the software’s functionality beyond its standard capabilities. Furthermore, by harnessing the power of scripting, you can significantly reduce manual effort, enhance accuracy, and accelerate project timelines. This guide will walk you through the essentials of scripting for E3.series, from setting up your environment to writing and testing your first script.
Understanding the Basics of Scripting for E3.series
First, let’s break down the basics of scripting for E3.series. E3.series is a prevalent electrical computer-aided design software with a powerful scripting interface. This scripting interface is built on Microsoft’s Common Object Model (COM) and utilizes Visual Basic procedures to accomplish various tasks. The supported scripting language is VBScript, widely used in the industry. Another popular language option is C#.
Moreover, by leveraging the benefits of automation, users can reduce their design time and increase productivity. Triggered scripts are another valuable feature that lets you automate actions based on specific events. Plus, you can easily create reports and tables that give you the insights you need, making decisions a breeze. Basically, the scripting interface in E3.series is super flexible and efficient, helping you smooth out the design process and tackle those tricky design challenges.
Setting Up Your Environment for Scripting
Having the right tools can make all the difference in publishing. Here are two integrated development environment (IDE) options to help you take your work to the next level:
- First up is Notepad++, an entry-level tool that’s perfect for beginners. It offers a simple interface and fundamental features that are easy to understand and use.
- If you’re looking for something more advanced, try VS Code. This powerful tool offers many features and customization options to help you work more efficiently and effectively.
Another handy tool to have installed is E3.TriggerManagement. E3.TriggerManagement is an additional tool that designers can use with E3.series. It lets you set up script files that automatically run on a specific action. With these scripts, you can create, modify, or delete object data at the project level. The triggers and scripts are organized in the registry and sorted according to “Current User” (HKCU) or “Local Machine” (HKLM). E3.TriggerManagement can automate additional object-level actions and establish data validation scripts. Overall, E3.TriggerManagement is a useful tool to optimize your E3.series workflow and ensure that all actions align with your company’s standards.
Writing Your First Script
This step can feel daunting for a newbie to scripting, with that overwhelming feeling of how to get started. Alternatively, you could be on the opposite side of the spectrum, filled with excitement to show off your scripting skills to the team. Whichever the case, we have some helpful steps to consider when writing your first script and an example to follow along.
The example script will list the names of all signals present in a project in the Messages window. For the most part, you can read scripts from top to bottom. Let’s take a look –
Dim e3, job, Device
'Start out connection to E3
Set e3 = ConnectToE3
'Create a Job Object to handle the open Project
Set job = e3.CreateJobObject
'Create a Signal Object to handle Signals in E3
Set Signal = job.CreateSignalObject
Dim SignalList, SignalCount
'Gather the Signal Ids
SignalCount = Job.GetSignalIds(SignalList)
'SignalCount will be set to the number of Signals found in the project. SignalList will be a list of all of the Ids of signals in the project.
'Here, we loop through the list of Signal Ids
For i = 1 to SignalCount - 1
'Set the SignalObject's Id equal to the next Signal Id in SignalList
Signal.SetId SignalList(i)
Dim Message
'Get the name of the Signal
Message = Signal.GetName
'Display the signal in E3 Messages window
e3.PutMessage(Message)
Next
'This function creates a Connection to E3. Copy and paste this function at the bottom of each new script you write for use with E3.series
function ConnectToE3
if InStr(WScript.FullName, "E³") then
set ConnectToE3 = WScript ' internal
else
strComputer = "."
set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colItems = objWMIService.ExecQuery("Select * from Win32_Process",,48)
ProcessCnt = 0
for each objItem in colItems
if InStr(objItem.Caption, "E3.series") then ProcessCnt = ProcessCnt + 1
next
set objWMIService = Nothing
set colItems = Nothing
if ProcessCnt > 1 then
MsgBox "More than one E3-Application running. Script can't run as external program." & vbCrLf &_
"Please close the other E3-Applications.", 48
WScript.Quit
else
set ConnectToE3 = CreateObject ("CT.Application") ' external
end if
end if
end function
- The first step is simple: open your IDE of choice, i.e., Notepad++ or VS Code. For this guide, we will assume Notepad++.
- Next, define the language so that Notepad++ recognizes and formats the code. You can do this by going into the Language menu, hovering over “V,” and selecting Visual Basic.
- Thirdly, you will declare variables at the top or throughout the code using the Dim statement for VBScript.
- An important piece to include is the ConnectToE3 function. This function finds and connects to your E3.series application. You will need this function in all your scripts interacting with E3.series. Copy and paste the function to the bottom of any new script you create. Note where the code reads e3 = ConnectToE3; this is where the connection happens.
- After that, you need to define our job object. In this case, the job object handles the currently opened project.
- From here, you can define other simple objects. In this example, we create a signal object. The signal objects handle signals in E3.series. Other common E3.series object types available that you may use are device, attribute, bundle, pin (both pins & wires), net segment, connection, and text.
- Once you have defined your variables and objects, you can specify commands. In our example, on line 16, we use SignalCount = Job.GetSignalIds(SignalList). This command will gather all the Signal IDs in the project and store them in SignalList. Additionally, it will store the number of signals found in SignalCount.
- Finally, you may want to do something with the objects. You can set, add, or remove attributes from objects, rename devices, and many more powerful functions as you learn. For our example, we want to get the name of each signal and print it in the Messages window of E3.series. In this example, we use a For loop, which increments with each execution and iterates through every signal in the SignalList. Each loop execution will print the signal name in the Messages window.
Congratulations, you have successfully executed a script!
Tips for Debugging and Testing Scripts
Debugging scripts for E3.series can be challenging, but here’s a handy tip to make tackling those errors easier. When diving into a new script and hitting a snag, pay attention to the line and character number. This information will help you pinpoint the location where the error occurred, making it easier to fix the issue. Additionally, testing it out is vital to ensure that the script is doing what you want. One way to do this is by creating a test project that is simple enough to check by hand. You can then run the script against this project to see if it behaves as expected. This approach not only saves time but also helps you to identify errors with ease.
Continuing Your Scripting for E3.series Education
Mastering scripting for E3.series is a journey of continuous learning and exploration. To support you on this path, I’ve compiled a list of invaluable resources that will deepen your understanding and enhance your scripting skills:
- E3.series Extensive Help File: Firstly, one of your primary go-to resources should be the extensive help file within E3.series itself. This comprehensive guide offers detailed insights into the classes and methods for scripting for E3.series. Undoubtedly, it’s an excellent starting point for understanding the framework and capabilities you have at your fingertips.
- Scripting Training Options: For those who prefer a more structured learning approach, Zuken offers specialized scripting training options. These sessions range from beginner to advanced levels, ensuring that there’s a course to fit your needs regardless of your current proficiency. These training sessions are invaluable for gaining hands-on experience under expert guidance.
- Zuken Community Scripting User Forum: Join the conversation in Zuken USA’s Community Scripting User Forum. This platform is an excellent place for sharing ideas, asking questions, and learning from the experiences of other E3.series users and our expert staff. The forum is not just a place to seek answers; it’s a community where you can contribute, share your scripting successes, and even learn from the challenges faced by others.
- Online Tutorials and Documentation: Besides the official resources, the internet is rife with tutorials, documentation, and user-generated content that can provide additional insights into scripting. Moreover, exploring these materials can offer new perspectives and techniques to enhance your scripting prowess.
You can use these resources to keep learning and improving your scripting skills in E3.series. That way, you can stay up-to-date with the latest practices and innovations. Whether you’re troubleshooting a complex script or looking to automate a new aspect of your design process, these tools and communities will support and guide your scripting journey.
Get Off on the Right Foot with Scripting
Scripting for E3.series can significantly enhance your electrical design workflows. It’s all about making those repetitive tasks a breeze, tweaking things just how you like them, and pushing what you thought the software could do to the next level. This guide has introduced the essentials of scripting for E3.series, from setting up the ideal environment to crafting your initial script. Getting into scripting doesn’t just make things faster; it cranks up your productivity and sparks innovation in your designs. Whether you’re just starting or looking to sharpen your skills, there’s a whole world of possibilities with E3.series scripting waiting for you. Go ahead, play with it, and see where scripting can take your projects!
Related Products and Resources
- Blog
- Blog
- Blog