Exporting a hundred drawings to PDF before a design review is one of those tasks that eats an afternoon. With SolidWorks PDM, there are three ways to automate it: the built-in Batch Plot tool, the SolidWorks Task Scheduler, and a custom API script that talks to both PDM and SolidWorks. They’re not equivalent — each has hard limits that determine which one fits your situation.
What SolidWorks PDM Batch Plot Actually Does
SolidWorks PDM Professional includes a Batch Plot tool accessible from the Windows Explorer PDM client. Right-click a folder or a selection of .slddrw files → Batch Plot. The tool opens SolidWorks in the background (PDM handles the license check), iterates through the selected drawings, and exports them to a configured output path.
Batch Plot is the lowest-friction option — no scripting, no Task Scheduler setup. But it has real limitations that frustrate teams the first time they try to use it at scale:
- Requires SolidWorks installed on the machine running the export. It’s not a standalone vault operation.
- Files must be checked in. Checked-out or locally modified drawings are skipped without clear error messages in some PDM versions.
- Configuration control is limited. If a drawing references multiple configurations, Batch Plot exports the default configuration. Exporting specific configurations requires the Task Scheduler or API.
- Sheet range selection is basic. You can’t easily filter to only sheet 1 of multi-sheet drawings without additional setup.
- Output path naming is rigid. The default naming matches the source filename. Custom naming (including revision, part number, or project code from drawing properties) requires the API or a post-processing rename step.
- Error handling is minimal. If a referenced model is missing or a drawing fails to open, Batch Plot may silently skip the file or produce an empty PDF.
For small batches (under 50 drawings) with predictable references and simple PDF output, the built-in Batch Plot is fine. For larger operations, you’ll outgrow it quickly.
The SolidWorks Task Scheduler Approach
SolidWorks Task Scheduler (installed alongside SolidWorks, separate executable) provides more control over batch operations and integrates with PDM without requiring full API access.
To set up a PDM-aware batch plot via Task Scheduler:
- Open Task Scheduler (Start → SolidWorks Tools → Task Scheduler, or
SWTaskScheduler.exe). - Create a new task: Print/Export → select Export Files.
- Set the input source to a PDM vault folder path (PDM must be mapped as a local working folder).
- Choose export format (PDF, DXF, DWG, STEP, etc.) and output path with naming tokens.
- Schedule: immediate, one-time, or recurring.
Task Scheduler operates through the SolidWorks Task Host — it spawns a separate SolidWorks session and processes files sequentially. This avoids the COM apartment threading issues that plague in-process API scripts run under the user’s interactive session.
Advantages over Batch Plot:
- Supports scheduled recurring exports (e.g., nightly release packet generation)
- Naming tokens include
$PRP:(custom property values from title block),$CONFIGURATION,$REVISION - Sheet export control: can be configured per task
- Runs unattended (useful for overnight processing)
- Logs export results with success/failure per file
Limitations:
- Still sequential — processing 500 drawings is 500× the per-file SolidWorks open/export/close cycle
- No PDM workflow state awareness — it doesn’t know whether drawings are Released vs In Design, just whether the file exists
- Referenced model files must be present in the local working folder or get-from-vault must run first
- Custom post-processing (conditional naming by PDM state, multi-format batch, vault checkin of outputs) requires API work
Practical tip: Before running Task Scheduler on a PDM folder, use Get (PDM right-click → Get) to ensure the latest versions of all drawings and their referenced models are in the local working folder. Task Scheduler reads local files, not directly from the vault database.
Automating Vault Exports via the PDM API
For vault-aware, state-filtered, configurable exports, the combination of the SolidWorks PDM API and the SolidWorks Application API is the right approach.
The PDM API (EdmLib.dll, COM-based) lets you enumerate vault contents, read file states and custom properties, and control check-in/check-out. The SolidWorks API (SldWorks.dll) lets you open files and drive the actual export. Combining them gives you complete control.
Step 1: Connect to the Vault
using EdmLib;
IEdmVault5 vault = new EdmVault5();
vault.LoginAuto("YourVaultName", 0); // 0 = current window handle
LoginAuto uses the PDM client’s cached credentials, so no password handling in code. This requires the PDM client to be installed and logged in on the machine.
Step 2: Filter Drawings by State
IEdmFolder5 rootFolder = vault.GetFolderFromPath(@"\\YourVaultName\Products\Assemblies");
// Enumerate all files recursively
IEdmPos5 filePos = rootFolder.GetFirstFilePosition();
while (!filePos.IsNull)
{
IEdmFile5 file = rootFolder.GetNextFile(filePos);
// Filter: only .slddrw files in "Released" state
if (!file.Name.EndsWith(".slddrw", StringComparison.OrdinalIgnoreCase)) continue;
IEdmState5 state = file.CurrentState;
if (state.Name != "Released") continue;
string localPath = file.GetLocalPath(0); // 0 = top-level vault folder
ExportDrawing(localPath, file);
}
Step 3: Get the File (Ensure Local Working Copy)
void EnsureLocal(IEdmFile5 file)
{
if (!file.IsLocked)
{
// Get latest version to local working folder
file.GetFileCopy(0, (int)EdmGetFlag.EdmGet_Simple, null, null);
}
}
EdmGet_Simple fetches the latest version of the file and its references (if the vault is configured for automatic reference getting).
Step 4: Open in SolidWorks and Export
using SldWorks;
using SwConst;
void ExportDrawing(string localPath, IEdmFile5 edmFile)
{
SldWorks.SldWorks swApp = (SldWorks.SldWorks)Activator.CreateInstance(
Type.GetTypeFromProgID("SldWorks.Application"));
swApp.Visible = false;
int errors = 0, warnings = 0;
ModelDoc2 doc = swApp.OpenDoc6(
localPath,
(int)swDocumentTypes_e.swDocDRAWING,
(int)swOpenDocOptions_e.swOpenDocOptions_Silent,
"", ref errors, ref warnings);
if (doc == null || errors != 0) return;
// Read custom property for output filename
ModelDocExtension ext = doc.Extension;
string partNumber = ext.CustomPropertyManager[""].Get2("PartNumber", false, out string resolvedVal, out bool linked);
string revision = ext.CustomPropertyManager[""].Get2("Revision", false, out resolvedVal, out linked);
string outputPath = $@"C:\ReleasePacket\{partNumber}_Rev{revision}.pdf";
// Export all sheets to PDF
int pdfErr = 0;
doc.Extension.SaveAs(outputPath,
(int)swSaveAsVersion_e.swSaveAsCurrentVersion,
(int)swSaveAsOptions_e.swSaveAsOptions_Silent,
null, ref pdfErr, ref warnings);
swApp.CloseDoc(doc.GetPathName());
}
The key difference from Task Scheduler: you can read custom properties (part number, revision, project code) and build output filenames from them, filter by PDM state, and route different drawing types to different output folders — all in code, without post-processing renaming.
Handling Referenced Models
The most common failure mode in vault export scripts: the drawing opens but views show as broken (gray cross-hatch or “?”) because referenced .sldprt or .sldasm files aren’t in the local working folder.
PDM’s EdmGet_Simple flag retrieves the file you asked for but not its references. To get references too:
// Get file with all referenced models
IEdmFile5[] refs = file.GetUsedFileArray(0); // 0 = all versions
foreach (IEdmFile5 refFile in refs)
{
refFile.GetFileCopy(0, (int)EdmGetFlag.EdmGet_Simple, null, null);
}
file.GetFileCopy(0, (int)EdmGetFlag.EdmGet_Simple, null, null);
Alternatively, configure the PDM client to automatically get references when getting files: Administration tool → Vault Settings → Local Working Folders → Get All Referenced Files.
SolidWorks Task Host: The Third Path
If you need unattended automation without writing API code, the SolidWorks Task Host (SWBoost.exe) provides a middle path. It’s the same infrastructure that Task Scheduler uses internally, but can be invoked via command line with an XML task definition file:
<!-- task.xml -->
<SWTaskSchedulerTask>
<TaskType>Export</TaskType>
<InputFiles>
<Folder>C:\PDM_Working\Products\Assemblies</Folder>
<Extensions>.slddrw</Extensions>
</InputFiles>
<ExportOptions>
<Format>PDF</Format>
<OutputFolder>C:\ReleasePacket</OutputFolder>
<NamingConvention>$FILENAME_$PRP:Revision</NamingConvention>
<Sheets>All</Sheets>
</ExportOptions>
</SWTaskSchedulerTask>
Invoke via Task Scheduler’s Import function or via CI/CD pipeline scripts. This approach integrates with your build system without writing a full C# application — the Task Host handles the SolidWorks lifecycle.
What CadShift Adds to the Picture
The PDM Batch Plot and Task Scheduler workflows export standard SolidWorks PDF output — the drawing as-is, no additional processing. For teams that need:
- DXF export with bend lines and metadata layers for sheet metal parts
- BOM quantities embedded in the output DXF or PDF
- Per-body DXF for multi-body parts where each body goes to a separate file named by its cut-list properties
- Custom layer mapping for laser or waterjet programs
…these require the SolidWorks export API to be involved in every file, not just the drawing. CadShift’s batch export handles this for sheet metal and DXF workflows — it reads the PDM custom properties for naming and runs the full export pipeline including flat pattern validation.
Choosing Your Approach
| Requirement | Use |
|---|---|
| Occasional batch export, under 50 files, simple PDF | PDM Batch Plot (built-in) |
| Scheduled nightly exports, naming from custom properties | Task Scheduler |
| State-filtered export (Released only), vault checkin of outputs | PDM API + SolidWorks API |
| DXF with bend lines, BOM data, or metadata layers | CadShift or custom API integration |
| CI/CD integration (scripted, no UI) | Task Host XML + command line |
The most common mistake: starting with PDM Batch Plot for a 20-file test, then trying to scale it to 500 files and discovering the silent error handling and missing configuration control too late. If your release process runs weekly or the drawing count exceeds 100, write the API script once and don’t look back. The PDM API is COM-based and the SolidWorks API is 25+ years mature — the building blocks are stable.
For teams building their first vault export automation, the SolidWorks API in-process vs standalone post covers which API pattern applies to vault-connected automation — the answer is almost always standalone, not in-process, for reliability.