SolidWorks Automation: Batch Custom Properties, Cut-Lists, and Production Drawings
How to build robust C# and VBA automation tools for SolidWorks assemblies to eliminate manual metadata entry, sync weldment cut-lists, and auto-export drawing packages.
Md Anamul Hasan
Mechanical Design Engineer & CAD Automation Specialist

The High Cost of Manual CAD Administration
In mechanical engineering design offices, engineers spend up to 25% of their working hours on administrative CAD tasks rather than geometry modeling:
- Manually opening hundreds of component files to verify part numbers and descriptions.
- Synchronizing weldment structural member cut-lists with ERP purchase descriptions.
- Printing drawing packages and exporting 1:1 DXFs for laser cutting.
By architecting direct automation via the SolidWorks Document Manager API and the SolidWorks COM API, we can reduce repetitive drawing package preparation from days to minutes.
1. Document Manager API vs. Full CAD Session Automation
When developing CAD automation, choosing the right API boundary is critical:
| Requirement | SolidWorks COM API | Document Manager API |
|---|---|---|
| Execution Mode | Requires active SolidWorks license & GUI/background process | Headless, standalone executable (no SolidWorks install needed) |
| Speed | 2–5 seconds per file open/save cycle | ~50 milliseconds per file |
| Geometry Changes | Full feature tree access, rebuilds, drawings | Metadata only (Custom properties, configurations, BOM tables) |
| Ideal Use Case | Automated DXF export, model regeneration | Fast batch property sync, BOM auditing before ERP import |
2. Batch Custom Property Synchronization Pattern
Below is a robust C# pattern for opening a SolidWorks part in silent batch mode, reading custom properties, and enforcing drawing block consistency:
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;
public class SolidWorksBatchSync
{
private SldWorks _swApp;
public SolidWorksBatchSync(SldWorks app)
{
_swApp = app;
}
public void UpdateComponentMetadata(string partPath, string partNumber, string material)
{
int errors = 0;
int warnings = 0;
ModelDoc2 doc = _swApp.OpenDoc6(
partPath,
(int)swDocumentTypes_e.swDocPART,
(int)swOpenDocOptions_e.swOpenDocOptions_Silent,
"",
ref errors,
ref warnings
);
if (doc == null)
throw new Exception($"Failed to open document: {partPath}. Error code: {errors}");
CustomPropertyManager propMgr = doc.Extension.get_CustomPropertyManager("");
propMgr.Add3("PartNumber", (int)swCustomInfoType_e.swCustomInfoText, partNumber, (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
propMgr.Add3("Material", (int)swCustomInfoType_e.swCustomInfoText, material, (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
propMgr.Add3("VerifiedDate", (int)swCustomInfoType_e.swCustomInfoText, DateTime.UtcNow.ToString("yyyy-MM-dd"), (int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
doc.Save3((int)swSaveAsOptions_e.swSaveAsOptions_Silent, ref errors, ref warnings);
_swApp.CloseDoc(partPath);
}
}
3. Weldment Cut-Lists and Automatic DXF Flattening
For sheet metal and structural frames, custom property automation must extend to cut-list item properties. Automating cut-list quantity rollups eliminates manual ordering mistakes on structural tubing, angle iron, and plate stock.
Practical Engineering Tools
To eliminate manual setup, review our validated production toolkits:
- Free Reference: Bolt & Screw Size Chart (ISO 261 / ASME B1.1)
- Production Suite: Bundle B1: SOLIDWORKS Automation Pack
Written by Md Anamul Hasan
Mechanical Design Engineer & CAD Automation Specialist
Specializing in mechanical design automation, CAD API scripting (SolidWorks, NX Open), and Teamcenter PLM workflow engineering.
Related Insights & Articles

How We Reduced Design Cycle Time by 92% with Siemens NX CAD Automation
A comprehensive engineering case study and guide on building robust, headless CAD automation pipelines with Siemens NX Open and .NET.

NX Open Automation: A Beginner’s Guide for Mechanical Engineers
Stop clicking the same 15 buttons. Learn how to leverage the Siemens NX Open API to automate repetitive CAD tasks and save hours.