Every sheet metal shop with more than a handful of active parts runs into the same gap. The model changes — a bend radius is revised, a hole pattern shifts, a flange length is adjusted — and the SLDDRW already has everything: dimensions, bend notes, tolerances, title block, revision table. But the DWG that goes to fabrication is still sitting at the old revision. Someone has to open the drawing, let it rebuild, and export. Every time.
The forum question from August 2026 put it plainly: “Is there a way to alter the sheet metal model, but skip the SLDDRW file (possibly using the SLDDRW as hidden silent partner) which can then automatically update the dwg including all dimensions and labels?”
Yes. This is exactly how the API is designed to be used. The SLDDRW is a first-class SOLIDWORKS document — you can open it in the background, force it to rebuild against the current model state, and save it as DWG without a user touching the UI. This post covers three ways to build that pipeline, along with the gotchas that cause silent failures.
Why the SLDDRW and Not the Part File
The first question is always whether to skip the SLDDRW entirely and export the flat pattern directly from the part. IPartDoc.ExportToDWG2 with swExportToDWG_ExportSheetMetal does exactly that: it reads the flat pattern feature and writes DWG geometry including bend lines, hidden edges, and sketches. No drawing file required.
That path is covered in the SOLIDWORKS API DXF export guide. It is correct for fabrication shops that only need clean geometry for CAM nesting. It is wrong when downstream manufacturing requires a fully-dimensioned drawing: dimensions showing the flat blank size, bend angle callouts, material notes, first-article inspection dimensions keyed to GD&T datums, a revision table.
All of that lives in the SLDDRW. A drawing created once and maintained is the right source. The automation goal is to take a human out of the loop between “model saved” and “DWG updated.”
The Architecture
Three files, two paths:
SLDPRT ──references──▶ SLDDRW ──export──▶ .dwg
│ │
└── engineers edit this └── automation opens this silently,
rebuilds, saves as DWG, closes
The SLDDRW sits in the same network folder as the SLDPRT. After initial setup by the drawing author, it is never opened manually again. An automation process handles everything.
The pipeline has four steps regardless of which trigger approach you use:
- Detect that the model has changed (or run on schedule)
- Open the SLDDRW with
ISldWorks.OpenDoc7,IDocumentSpecification.Silent = True - Call
IModelDoc2.ForceRebuild3to update all drawing views against the current part state - Call
IModelDocExtension.SaveAsto write the DWG, then close and exit
Approach 1: Task Scheduler + Standalone VBA
This is the lowest-friction entry point. A standalone VBA project (compiled to .exe or run via a .bat wrapper) is scheduled by Windows Task Scheduler to run at a fixed interval — end of shift, every hour, or on demand.
The script creates its own SOLIDWORKS instance, does the work, and shuts down. It does not require SOLIDWORKS to already be running.
Option Explicit
Const DRAWING_PATH As String = "\\Server\Production\bracket\bracket.SLDDRW"
Const OUTPUT_PATH As String = "\\Server\DWG-Output\bracket.dwg"
Sub ExportSheetMetalDrawingToDWG()
Dim swApp As SldWorks.SldWorks
Set swApp = CreateObject("SldWorks.Application")
swApp.Visible = False ' Keep the window hidden
Dim spec As SldWorks.DocumentSpecification
Set spec = swApp.GetOpenDocSpec(DRAWING_PATH)
spec.Silent = True ' Suppress all dialogs (missing ref warnings, etc.)
spec.ReadOnly = False ' Must be writable to rebuild and save
Dim swDraw As SldWorks.ModelDoc2
Set swDraw = swApp.OpenDoc7(spec)
If spec.Error <> 0 Or swDraw Is Nothing Then
' Log to file here in production — Debug.Print is invisible in Task Scheduler
GoTo Cleanup
End If
' Update all drawing views to match the current sheet metal geometry
' Pass False to rebuild the active configuration only (sufficient for single-config drawings)
swDraw.ForceRebuild3 False
' Extension.SaveAs determines output format from file extension (.dwg = DWG)
Dim nErrors As Long, nWarnings As Long
Dim ok As Boolean
ok = swDraw.Extension.SaveAs( _
OUTPUT_PATH, _
swSaveAsCurrentVersion, _
swSaveAsOptions_Silent, _
Nothing, _
nErrors, nWarnings)
Cleanup:
If Not swDraw Is Nothing Then
swApp.CloseDoc DRAWING_PATH
End If
swApp.ExitApp
Set swApp = Nothing
End Sub
Batch variant: process all drawings in a folder
For a production folder with many parts, add timestamp comparison to avoid re-exporting unchanged drawings:
Sub BatchExportDWGs()
Dim swApp As SldWorks.SldWorks
Set swApp = CreateObject("SldWorks.Application")
swApp.Visible = False
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Const PROD_FOLDER As String = "\\Server\Production"
Const OUT_FOLDER As String = "\\Server\DWG-Output"
Dim folder As Object
Set folder = fso.GetFolder(PROD_FOLDER)
Dim f As Object
For Each f In folder.Files
If LCase(fso.GetExtensionName(f.Name)) = "slddrw" Then
Dim drawPath As String
drawPath = f.Path
' Mirror the folder structure under the output root
Dim outPath As String
outPath = Replace(drawPath, PROD_FOLDER, OUT_FOLDER)
outPath = Replace(outPath, ".SLDDRW", ".dwg")
outPath = Replace(outPath, ".slddrw", ".dwg")
' Skip if the DWG is already newer than the drawing
If fso.FileExists(outPath) Then
If fso.GetFile(outPath).DateLastModified >= f.DateLastModified Then
GoTo NextFile
End If
End If
' Ensure output directory exists
Dim outDir As String
outDir = fso.GetParentFolderName(outPath)
If Not fso.FolderExists(outDir) Then fso.CreateFolder outDir
Dim spec As SldWorks.DocumentSpecification
Set spec = swApp.GetOpenDocSpec(drawPath)
spec.Silent = True
spec.ReadOnly = False
Dim swDraw As SldWorks.ModelDoc2
Set swDraw = swApp.OpenDoc7(spec)
If spec.Error = 0 And Not swDraw Is Nothing Then
swDraw.ForceRebuild3 False
Dim err As Long, warn As Long
swDraw.Extension.SaveAs outPath, _
swSaveAsCurrentVersion, swSaveAsOptions_Silent, _
Nothing, err, warn
swApp.CloseDoc drawPath
End If
End If
NextFile:
Next f
swApp.ExitApp
Set swApp = Nothing
End Sub
Approach 2: C# FileSystemWatcher (Event-Driven)
Task Scheduler fires on a schedule. FileSystemWatcher fires the moment a part is saved. For shops where the DWG must be available within seconds of a model change, this is the right architecture.
A small C# console application — compiled once, installed as a Windows service or startup item — watches the production folder for SLDPRT changes. When a save is detected, it opens the corresponding SLDDRW and exports it.
using System;
using System.IO;
using System.Runtime.InteropServices;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
class DrawingExporter
{
static void Main()
{
string watchFolder = @"\\Server\Production";
string outputRoot = @"\\Server\DWG-Output";
using var watcher = new FileSystemWatcher(watchFolder)
{
Filter = "*.SLDPRT",
NotifyFilter = NotifyFilters.LastWrite,
EnableRaisingEvents = true,
IncludeSubdirectories = true
};
watcher.Changed += (_, e) => TryExport(e.FullPath, watchFolder, outputRoot);
Console.WriteLine("Watching for sheet metal part changes. Ctrl+C to exit.");
Console.ReadLine();
}
static void TryExport(string partPath, string watchRoot, string outputRoot)
{
string drawingPath = Path.ChangeExtension(partPath, ".SLDDRW");
if (!File.Exists(drawingPath)) return;
string outputPath = drawingPath
.Replace(watchRoot, outputRoot, StringComparison.OrdinalIgnoreCase)
.Replace(".SLDDRW", ".dwg", StringComparison.OrdinalIgnoreCase);
SldWorks? swApp = null;
try
{
swApp = (SldWorks)Activator.CreateInstance(
Type.GetTypeFromProgID("SldWorks.Application")!)!;
swApp.Visible = false;
var spec = (DocumentSpecification)swApp.GetOpenDocSpec(drawingPath);
spec.Silent = true;
spec.ReadOnly = false;
var swDraw = (ModelDoc2)swApp.OpenDoc7(spec);
if (spec.Error != 0 || swDraw is null)
{
Console.Error.WriteLine($"Open failed: {spec.Error}");
return;
}
swDraw.ForceRebuild3(false);
Directory.CreateDirectory(Path.GetDirectoryName(outputPath)!);
int errors = 0, warnings = 0;
bool ok = swDraw.Extension.SaveAs(
outputPath,
(int)swSaveAsVersion_e.swSaveAsCurrentVersion,
(int)swSaveAsOptions_e.swSaveAsOptions_Silent,
null, ref errors, ref warnings);
Console.WriteLine(ok
? $"Exported: {outputPath}"
: $"Failed (err={errors}, warn={warnings}): {outputPath}");
swApp.CloseDoc(drawingPath);
}
catch (COMException ex)
{
Console.Error.WriteLine($"COM error: {ex.ErrorCode:X} — {ex.Message}");
}
finally
{
swApp?.ExitApp();
if (swApp is not null) Marshal.ReleaseComObject(swApp);
}
}
}
FileSystemWatcher fires multiple times for a single save. SOLIDWORKS writes the SLDPRT in stages, and NotifyFilters.LastWrite can fire 2-4 times per save. Add a debounce: track the last export timestamp per file and skip if it ran within the past 5 seconds.
Approach 3: SOLIDWORKS PDM Task
For shops on PDM Standard or Professional, the cleanest integration is a PDM Task. The task host machine has SOLIDWORKS installed and runs the export automatically when a drawing reaches a specific workflow state — “Released”, “Approved for Production”, or whatever your lifecycle calls it.
Configure the task in PDM Administration:
- Task type: Command line or execute script
- Trigger: Workflow transition (e.g., Approved → Released)
- Document filter: File mask
*.SLDDRW - Command:
DrawingExporter.exe "%PathName%" "%FileName:~0,-7%.dwg"whereDrawingExporter.exeis the C# tool from Approach 2 compiled as a console app accepting two arguments
// Entry point for PDM task use
static void Main(string[] args)
{
if (args.Length < 2)
{
Console.Error.WriteLine("Usage: DrawingExporter.exe <drawing.SLDDRW> <output.dwg>");
return;
}
TryExport(args[0], args[1]);
}
static void TryExport(string drawingPath, string outputPath)
{
SldWorks? swApp = null;
try
{
swApp = (SldWorks)Activator.CreateInstance(
Type.GetTypeFromProgID("SldWorks.Application")!)!;
swApp.Visible = false;
var spec = (DocumentSpecification)swApp.GetOpenDocSpec(drawingPath);
spec.Silent = true;
spec.ReadOnly = false;
var swDraw = (ModelDoc2)swApp.OpenDoc7(spec);
if (spec.Error != 0 || swDraw is null) return;
swDraw.ForceRebuild3(false);
int errors = 0, warnings = 0;
swDraw.Extension.SaveAs(
outputPath,
(int)swSaveAsVersion_e.swSaveAsCurrentVersion,
(int)swSaveAsOptions_e.swSaveAsOptions_Silent,
null, ref errors, ref warnings);
swApp.CloseDoc(drawingPath);
}
finally
{
swApp?.ExitApp();
if (swApp is not null) Marshal.ReleaseComObject(swApp);
}
}
This integrates with the PDM batch plot workflow covered in the SolidWorks PDM batch plot guide — that guide handles the vault-side export, while this approach handles the per-transition export where the output needs to land outside the vault.
Critical Gotchas
Single-instance constraint
SOLIDWORKS allows only one running instance per machine. If an engineer has SOLIDWORKS open when your script fires, CreateObject("SldWorks.Application") attaches to the running interactive instance rather than creating a hidden background one. The swApp.Visible = False call is then ignored — and dialogs start appearing on the engineer’s screen.
Detect this before starting:
Dim existingApp As Object
On Error Resume Next
Set existingApp = GetActiveObject("SldWorks.Application")
On Error GoTo 0
If Not existingApp Is Nothing Then
' SOLIDWORKS is already running — log and exit instead of attaching
Exit Sub
End If
In production environments, schedule background runs outside working hours, or use a dedicated task host machine.
ReadOnly blocks the save
spec.ReadOnly = True lets the drawing open and rebuild in memory, but Extension.SaveAs silently fails (returns False) when the document is read-only. Always open with ReadOnly = False. The export does not modify the SLDDRW file — it writes to the DWG output path — so there is no risk of corrupting the drawing.
Path resolution inside the SLDDRW
SOLIDWORKS stores part references in the SLDDRW as relative paths from the drawing’s disk location. If bracket.SLDDRW and bracket.SLDPRT live in the same folder, this is transparent. If the SLDPRT has moved or been renamed without updating the drawing’s references, ForceRebuild3 will update the views but they will show imported geometry (the last-known state) rather than the current model. The drawing appears to export correctly but the DWG is stale.
Verify the reference chain before deploying: open the drawing interactively once and check that all views rebuild cleanly from the current part.
ForceRebuild3 scope
ForceRebuild3(False) rebuilds the active drawing sheet. For drawings with multiple sheets — a flat pattern view on Sheet 1 and a 3D isometric on Sheet 2 — the second sheet is not updated. Pass True to rebuild all sheets:
swDraw.ForceRebuild3 True ' All sheets
The trade-off is time: rebuilding all sheets on a complex 20-view drawing takes longer. For single-sheet manufacturing drawings, False is sufficient.
swSaveAsOptions_Silent is not optional
Without swSaveAsOptions_Silent, SOLIDWORKS raises a “Save this document?” dialog when the drawing has unsaved rebuild state. In an unattended process, that dialog hangs forever. The script appears to complete (the process is running) but the DWG is never written. This is the most common failure mode in initial deployments.
Flat Pattern DXF vs Annotated DWG
This pipeline produces the annotated DWG that mirrors the SLDDRW. If what your fab shop needs is clean flat pattern geometry for nesting — without dimensions, notes, or title blocks — batch DXF export directly from the assembly is faster and does not require a drawing file per part. CadShift handles that path: flat patterns from all sheet metal parts in an assembly in one pass, with bend lines, metadata layers, and quantity tracking from the BOM.
When downstream processes — inspection, first-article documentation, purchasing drawings — require the fully-annotated DWG, the SLDDRW pipeline above is the right tool. Both paths belong in a complete SolidWorks workflow automation stack — which approach you reach for depends on what the output is consumed by.