Site icon BLUE BYTE SYSTEMS INC.

SOLIDWORKS Macro: Export Part and Assembly to IGES File

SOLIDWORKS Macro_ Export Part and Assembly to IGES File and An illustration of a computer screen displaying the SolidWorks logo in red. An orange arrow points from the screen to a 3D model of a mechanical part and an IGES file icon, indicating data export. Surrounding the screen are icons of code brackets and a gear, symbolizing programming and design. A gray 3D cube and a blue mechanical component are also shown, representing 3D modeling. The background is light, suggesting a tech-focused environment.

An illustration of a computer screen displaying the SolidWorks logo in red. An orange arrow points from the screen to a 3D model of a mechanical part and an IGES file icon, indicating data export. Surrounding the screen are icons of code brackets and a gear, symbolizing programming and design. A gray 3D cube and a blue mechanical component are also shown, representing 3D modeling. The background is light, suggesting a tech-focused environment.

Description

This SOLIDWORKS macro provides a fast and efficient way to export active documents to the IGES file format (.igs). Designed for SOLIDWORKS parts and assemblies, this macro automatically saves the exported IGES file to the same directory as the original document, using the same filename. With the ability to export part and assembly to IGES file, this is an ideal solution for you if you are someone who frequently needs to save their CAD files in a universal format for compatibility with other CAD software.

https://bluebyte.biz/wp-content/uploads/2025/09/Save_as_IGES.mkv

System Requirements

Pre-Requisites

Note

Results

Note

VBA Macro Code

' Disclaimer:
' The code provided should be used at your own risk.  
' Blue Byte Systems Inc. assumes no responsibility for any issues or damages that may arise from using or modifying this code.  
' For more information, visit [Blue Byte Systems Inc.](https://bluebyte.biz).

Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

    ' Initialize SolidWorks application and active document
    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    
    ' Exit if no document is active
    If Part Is Nothing Then Exit Sub
    
    ' Get the path of the active document
    Dim Path As String
    Path = Part.GetPathName
    
    ' Exit if the active document is a drawing (since IGES export is not supported for drawings)
    If Part.GetType = swDocDRAWING Then
        Exit Sub
    End If
    
    ' Prepare the path for the IGES file by replacing the extension
    Dim Extension As String
    Extension = Mid(Path, InStrRev(Path, "."))
    Path = Replace(Path, Extension, ".igs")
    Extension = ".igs"

    ' Export the file as IGES
    longstatus = Part.SaveAs3(Path, 0, 0)

    ' Notify the user about the saved file location
    MsgBox "Saved " & Path, vbInformation
End Sub

You can download the macro from here.

Custom Modification

Need to customize the macro? Or do you wish to incorporate it with another workflow process? At Blue Byte Systems Inc., we specialize in doing just that, whether you need to export part and assembly to IGES file or adapt the macro for other tasks. Please reach out to us, and we will develop a custom macro designed to meet your specific needs!

Ready to be more productive with a custom macro? Click here to contact us!

Exit mobile version