Design Reuse in SOLIDWORKS Electrical (Part 3)
Previously I went over the ways that we have used macros for the last couple years, creating a user library of circuits that allow you to quickly finish your system designs by utilizing the work you put in on previous projects. Macros are a very powerful tool, especially when combined with the intelligence that SOLIDWORKS Electrical brings, renumbering components and wires, in a way that can’t be accomplished with simple drawing blocks that engineers have traditionally used to try to accomplish the same thing.
SOLIDWORKS introduced a new feature in 2017, though, that takes these macros even further. We now have the ability to specify in an excel spreadsheet which macros should be used on which page, and by importing that excel sheet SOLIDWORKS Electrical will draw the schematics for you! This is huge. I know of companies that have written programs to accomplish this because they want to be able to allow someone without a real in-depth knowledge of the engineering sub-circuits to be able to just specify which modules need to be used, and get the schematic generated. The excel sheet we use for SOLIDWORKS Electrical will act like a configurator so someone can specify modules that need to be included in the machine build.
Getting Started
On the import export tab, select the dropdown for excel automation and select create new excel file for automation. After you set up the excel file it creates, you won’t have to create a new excel file all the time.
To really make the excel sheet powerful, you’re going to want to link it to the SQL database, similar to how I taught in a previous blog, although you’ll be doing it through excel rather than MS Access. In excel go to the data tab and click From Other Sources > From SQL Server. You won’t need to link everything, just the database tew_App_macro, and select table tew_project. Make sure you put it on a new sheet. Also, if you are following the gif below, your SQL server name will probably differ.
From there you can utilize your super excel skills to create dropdown lists on the first sheet of the workbook so that someone can select with macros should be inserted. The first 4 columns (C,D,E,H) in the generated workbook are required. That is the macro name, the insertion point, and what page it should be inserted on. If you have multiple books in your project you’ll want to specify the book number as well (column K). Pick the macros you want SOLIDWORKS Electrical to use, tell it the coordinates to insert them and which page.
Once you have all your macros selected then you can import that excel workbook through Import/Export, Excel Automation. It will create pages and insert macros exactly where you told it to.
One thing to note is the insertion point in the excel sheet is telling it where to place the macro based on the insertion point you have defined in that macro. So you’ll want to take a look at the macros you created, though opening them in the macro library manager. If your insertion points are on the ends of wires, you’d have to specify the exact point all the wires need to be. However, if you move the insertion point to 0,0. Then inserting the macro at 0,0 will put the wires and components on the page exactly where they were when you created the macro.