US$0.00
0

SolidWorks Macro to Export Sheet Metal to DXF in SOLIDWORKS

Description

The macro processes an active SOLIDWORKS assembly file (.SLDASM) in a systematic fashion, finds each sheet metal part, and exports its corresponding flat pattern geometry to a DXF file. 

System Requirements

  • SOLIDWORKS Version: SOLIDWORKS 2017 or higher
  • VBA Environment: Pre-installed in SOLIDWORKS (To access, select Tools > Macro > New or Edit)
  • Operating System: Windows 7, 8, 10, or higher

Pre-requisites

In order to run the macro, the following requirements must be met:

  • The active document must be an assembly document (.SLDASM) inside SOLIDWORKS.
  • The components in the assembly must have valid sheet metal parts created with a formed flat pattern. 
  • In order to run the macro, SOLIDWORKS must be installed and opened on the computer.

Results

  • A DXF file is generated for each distinct sheet metal part that we process, which contains the flat pattern.  
  • The DXF files are placed in the unique directory intended for their SOLIDWORKS part file source.  
  • The macro calls the ExportToDWG2 method so that the flat pattern can be issue accurate and complete with bend lines.

Steps to Set Up the Macro

  1. Register Macro File: Either from SolidWorks opened already or not, go to Tools > Macro > New…
  2. Name Macro File: To help identify your macro in the future, a good practice is to name the macro something relevant. For example, if you are creating a SolidWorks macro to export sheet metal to DXF in SOLIDWORKS, you might call the file “BatchSheetMetalDXF.swp”. Once you have named the macro, you can hit save. A new editor window for your VBA editor should open automatically.
  3. Paste the code: Download the VBA code we have provided for you below and place it in your editor.
  4. Run Macro: Exit out of your editor and save your work when prompted. With a Sheet Metal assembly active (the sheet metal option should check under “View>Hide/Show>Sheet Metal”), you are now able to run your macro via Tools > Macro > Run, or via your previously assigned shortcut.

VBA Macro Code

Macro

You can download the macro from here.

Need Customization & Expert Support?

Our specialized team at Blue Byte Systems Inc. develops custom macros and add-ins to meet these advanced workflow needs.

Author

Amen Jlili

Amen Jlili is the founder and technical director of Blue Byte Systems Inc., a software company in Vancouver, Canada, specializing in automating SOLIDWORKS and PDM. With over a decade of experience, he has authored several courses and open-source frameworks related to the SOLIDWORKS API. His leadership ensures that Blue Byte Systems prioritizes customer satisfaction and delivers high-quality software and CAD design solutions.
0
    0
    Your Cart
    Your cart is emptyReturn to Shop
    ×