SolidWorks macros automate sheet metal drafting tasks, saving a ton of time and cutting down on mistakes. We use SolidWorks API and a VBA editor to create and customize these macros the way we need.When macros are combined with DriveWorks and PDM, it creates a seamless sheet metal workflow that makes design to manufacture easier.
Table of Contents
Sheet metal drafting has many repetitive tasks which can be time-consuming and when done manually can introduce errors and inconsistencies in the design. Manually creating flat patterns are difficult. Preparing detailed drawings and exporting DXFs can also take a lot of time. Together, all these factors can negatively impact project timelines.
SolidWorks macros lets you automate the sheet metal drafting process using the SolidWorks API and VBA editor. You can use the API and VBA editor to develop custom programming solutions to automate actions and standardize processes. In a Product Data Management system, macros create connections from design to manufacturing.
Here we have shown step by step how to leverage SolidWorks macros for design automation to reduce your design time, avoid mistakes while maintaining quality across projects. We’ve also looked at custom feature patterns and how you can manage complex geometry to really optimize the entire workflow. This will help you see how to speed up your design process and be more productive.
SolidWorks macros are sequences of commands which you can execute for automating repetitive design tasks. You can set up these sequence of commands within SolidWorks.
There are two types of SolidWorks macros. The first is a recorded macro, which lets you records your actions to create a sequence, which can be repeated again and again. The second type of SolidWorks macro is where you use Visual Basic to program more complex sequences.
Custom SolidWorks macros are really the best choice for sheet metal design automation since they follow a standard workflow, which boosts productivity. With the macro editor, you can fine-tune and debug any script you write to make sure it runs flawlessly.
There are several tasks in sheet metal drafting, which can easily and quickly be automated by using macros. Here are some examples of such tasks:
Using SolidWorks macros for these repetitive tasks really helps you get through sheet metal drafting quickly without sacrificing accuracy.
Boost design speed with tailored CAD macros and automation tools
Start automating NOW »
There are lots of pre-made macros out there, but the real value of automation comes in the form of custom SolidWorks macros because you can build the solutions specific to your sheet metal drafting project. Here’s how you get started:
Following steps will help you create a simple and basic macro:
Accessing the VBA editor: Goto Tools 〉 Macro 〉 New to open the VBA editor. This is where you’ll write and edit your macro code.
Recording a macro: Recording a macro is useful in understanding the basic code structure that SolidWorks uses. Just do your actions in SolidWorks and the code gets generated in VBA once you stop recording. It’s a great way to get a starting point for your own custom macro.
Write basic VBA code: The basic operations includes declaring variables and setting references to SolidWorks objects. Implement the operations you require using structured programming. Binding variables early will give you better performance and a much faster execution time.
For example when you’re creating drawings from parts, a simple macro could do the work for you, like placing dimensions or creating views. If you want to add a dimension, you’d run code like View.InsertDimension.
Test, debug, save and run macro After you have written your code, you need to test it thoroughly. You’ll use the debug options in the VBA editor to find and fix errors. Once you’re happy with it, save the macro with a clear, descriptive name and the right file extension (.swp for SolidWorks macros).
SolidWorks API helps you access and control almost all the detailed aspects of your design in SolidWorks, like SolidWorks sheet metal bending techniques. You can call several objects and methods via the API and do this. Here are some useful ones:
The programming interface is used to write custom macros that automate tricky sheet metal processes. We also use design libraries to save and pull components for later reuse.
For more information on the SolidWorks API and everything it can do, just check out the official SolidWorks API documentation.
SolidWorks macros are a great way to automate the routine drafting tasks associated with sheet metal design. Following are three of the main ones:
Flat patterns are a two-dimensional representation of the three-dimensional part in a position where it is unfolded and they contain the dimensions and bend lines that allow the fabricator to cut and bend the material.
When you have to build a flat pattern manually, it can be a difficult, redundant and an error-prone process – especially with complicated parts to draft. SolidWorks CAD Automation with macros gives us an efficient way to pull flat pattern geometry right from the 3D model. This makes it accurate and dependable.
We can use the SolidWorks API and the GetFlatPattern method to automatically generate and save the flat pattern to a DXF or DWG file. Then it’s ready for CAM software or even printed templates. DriveWorks in SolidWorks can also use the sheets functionality and the flat pattern, which helps fabricators stay consistent with their design revisions.
Drawings typically include multiple projected views (isometric, front, top, section views), dimensions, annotations and BOM. With SolidWorks macros, you can automate the entire drawing generation process. If you take advantage of the API, a macro can do the following:
Using templates with correlating annotation capabilities reduces time spent on repetitive drafting tasks and makes it easier to handle repeatability with accuracy.
You’ll find that how you structure the VBA commands in SolidWorks helps you automate exports while making sure dimensions are scaled correctly for manufacturing.
In sheet metal processes, DXF files are used to send part geometry to CNC machines for cutting & bending sheet metal parts. When you have several sheet metal parts to work with, exporting DXF files one by one can be a real pain.
DXF file handling in SolidWorks lets you use macros to automate this by batch exporting DXF files for all the parts you’ve selected. It’s just a matter of configuring the macro to specify the output directory, file naming rules and DXF export options.
Once you get the batch export process under control, handing off technical specs from design to manufacturing gets a lot easier. This also cuts down processing time on multiple revisions.
Automating metal and wood furniture design for a US manufacturer
Design Automation for Metal and Wooden Furniture
CAD Customization of Metal and Wooden Furnitures
A US manufacturer of custom furniture specializing in metal and wood products, required to expedite their custom design process. The client wanted to reduce engineering lead times, and to increase design accuracy.
Hitech CADD Services developed a DriveWorks based CAD configurator using SolidWorks. This automated 3D modelling, manufacturing drawings of metal parts, and quotations. This CAD Configurator allowed sales engineers to input the customization requirements for proposals and obtain 3D design and manufacturing documentation very quickly.
The results were:
Macros can be a great way to automate basic tasks, but when it comes to getting the most out of SolidWorks macros, you need to follow the advanced SolidWorks sheet metal modeling tips using macros.
By directly accessing the SolidWorks API you get more control over the drawing elements. Rather than using recorded actions, you can use specific API calls to work with each component. Some examples of such API calls are:
When you get access and ability to adjust the properties of drawing elements (i.e. dimension text, annotation position) it gives you a lot more control over customization and automation.
Real world sheet metal parts often contain variations that can cause unexpected situations. To make the macros robust you can build error handling and logic into the macros.
For complicated drawings you can tweak and optimize macro speed in the following ways to avoid performance lags:
All of the above will help minimize processing time and wait time for the user. Once you have mastered these techniques you should be able to write and execute more complex macros faster.
Enhance SolidWorks with custom macros tailored for your needs.
Contact us »Macros are more useful when integrated with another system, here are two integrations:
DriveWorks is a design automation and sales configurator tool that is integrated with SolidWorks. By using DriveWorks design automation with SolidWorks custom macros you can create an intelligent process that automatically creates and modifies sheet metal drawings in SolidWorks using pre-defined parameters and design configurations.
Using DriveWorks effectively therefore allows rules based automation to trigger macros at certain points in the design process and perform drawing tasks with no human involvement. DriveWorks implementation experts can help you create this to reduce your design time.
For instance, when you configure sheet metal parts using a DriveWorks powered configurator, DriveWorks will create the 3D component in SolidWorks and immediately afterwards will trigger a macro to create the needed manufacturing drawings, including the flat patterns, dimensions and BOMs.
SolidWorks macros help in exchanging data with other manufacturing software.
By connecting SolidWorks macros into DriveWorks and other manufacturing programs you can create a fully automated sheet metal workflow from design to production.
DriveWorks powered automation for hollow metal doors & frames manufacturer, USA
Metal Frame 3D Modeling
Panel 3D Modeling in SolidWorks
A USA based hollow metal doors and frames manufacturer had challenges with fragmented design data transfer, undefined processes for custom orders and repetitive tasks that were causing delays and errors to customer service. They wanted faster delivery of designs for custom orders.
Hitech CADD Services developed a custom door configurator using DriveWorks collaborating with the clients design engineers. A team of 30 SolidWorks certified engineers created the custom design templates, a SQL database for management of design data, and created the final 3D CAD models and manufacturing drawings.
The final deliverables led to:
SolidWorks macros help you automate repetitive tasks in sheet metal design, making them essential tools for professional sheet metal design services. This lets you improve design efficiency, standardization and helps reduce errors. By taking care of flat patterns, detailed drawings and manufacturing files, macros free you up to focus on the more important parts of your workflow.
Once you understand the advanced methods and use macros with other systems like DriveWorks and PDM, you can really use it to its full potential. That’s where you’ll see the biggest benefits of sheet metal drafting automation.
Automate design configurations with expert DriveWorks solutions.
Learn more »You may also like
BIM-Based MEP Coordination for Multi-Trade Collaboration
How AI and ML are Shaping the Future of Scan to BIM
Cabinet Shop Drawings: A Detailed Guide