SolidWorks Automation (API/Macros), PDM, Simulation, Motion, Rendering, and Troubleshooting

SolidWorks · API · PDM · Troubleshooting

Overview

The gap in SolidWorks productivity between large enterprises and SMB manufacturers is not about modeling skill — it comes down to automation, data management, and incident response. Repetitive tasks get handled by macros, design data is controlled in PDM, analysis, animation, and rendering drive verification and communication, and when errors surface, recovery is systematic. This guide covers macros/API (VBA, VB.NET, C#), PDM (vault, check-out, Version/Revision, Workflow), SimulationXpress/Simulation, Motion Study, Rendering (PhotoView 360 / Visualize), the most common troubleshooting (Rebuild/Dangling/Mate/File Repair), and 2024/2025 new features (Detailing Mode, Component References, Configuration Publisher) from a practical standpoint. For shortcuts see 01-shortcuts-ui.md; for assembly and performance fundamentals see 03-assembly.md.

1. Macros and the API

1.1 Start by Recording a Macro

Menu path: Tools → Macro → Record. Your UI actions are recorded as VBA code, and pressing Stop saves a .swp (source) / .swb (binary) file. Press Alt+F11 to open the built-in Visual Basic Editor and edit it.

Note A recorded macro hardcodes absolute paths, model names, and selection order. Shipping it as-is means it will not work on other PCs. A recording is only a starting point — always refactor into variables and error handling.

1.2 Choosing an API Language

LanguageProsCons
VBABuilt into SolidWorks, stored in the file, easy entryDated debugger, limited error handling
VSTA (VB.NET/C#)Modern .NET, built into SolidWorksDistribution is relatively more involved
External .NET Add-in (C#)Free-form UI, flexible distributionRequires a separate Visual Studio install
Standalone EXEDeployable to many PCs, schedulableNeeds SolidWorks running to connect

1.3 API Object Model

SldWorks (top-level application)
  └── ModelDoc2 (common to parts/assemblies/drawings)
        ├── PartDoc
        ├── AssemblyDoc
        ├── DrawingDoc
        ├── FeatureManager
        ├── SketchManager
        └── SelectionMgr

Most real-world macros read or create features via SldWorks → ModelDoc2 → FeatureManager.

1.4 Minimal VBA Example — Create a Box

Sub CreateBox()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Set swApp = Application.SldWorks
    Set swModel = swApp.NewPart
    swModel.SketchManager.InsertSketch True
    swModel.SketchManager.CreateCornerRectangle 0, 0, 0, 0.1, 0.1, 0
    swModel.FeatureManager.FeatureExtrusion3 True, False, False, _
        0, 0, 0.05, 0, False, False, False, False, _
        0, 0, False, False, False, False, 1, 1, 1, 0, 0, False
End Sub

Creates a 100mm × 100mm × 50mm extruded box. The argument order for FeatureExtrusion3 comes up a lot, so keep the API Reference in Help bookmarked.

1.5 Real-World Automation Scenarios

  • Bulk BOM export to Excel: Open every .sldasm in a folder, pull the BOM sheet → save as a combined Excel.
  • Bulk drawing PDF conversion: An overnight task converts hundreds of .slddrw files to PDF/A.
  • Pack & Go automation: Scan per-project folders and package with all references.
  • Bulk Custom Properties updates: Update Material, Revision, and Drawn By across thousands of parts to a rule.
  • Automatic part numbering: Populate Custom Properties per PLM rules + rename files.

1.6 Macro Distribution

  • .swb binaries protect the source but are hard to edit or share.
  • Place .swp files in a company shared folder and surface them as Macro Feature buttons on the CommandManager for accessible shared macros.
  • In a PDM environment, store macros in the Vault as well for revision control.

2. PDM — Product Data Management

2.1 PDM Standard vs Professional

ItemStandardProfessional
User countUp to 10Unlimited
DatabaseSQL Express (2GB limit)Full SQL Server
Workflow statesUp to 10Unlimited
Custom ColumnsLimitedUnlimited
Web ClientNoYes
ReplicationNoYes (multi-site)
Task SchedulerNoYes

Standard comes bundled with SolidWorks Professional; upgrade to Professional as Simulation and Workgroup needs grow.

2.2 Check-Out / Check-In Basics

  • Check-Out: Acquire edit rights on a file. Other users cannot modify.
  • Check-In: Upload to the Vault after editing, creating a new Version.
  • Undo Check-Out: Discard edits and keep the previous Version.
  • Get Latest: Grab a read-only latest copy without a Check-Out.

2.3 Version vs Revision — Often Confused

  • Version: The internal number (1, 2, 3…) that auto-increments on every Check-In. Tracks every minor change.
  • Revision: The external number (A, B, C or 1, 2, 3) formally approved at a Workflow Transition. The value shown in BOMs and drawings.

A designer can save ten times and only the Version increments to 10 — the Revision stays put. Revision changes only through a release-approval event.

2.4 Workflow

  • State: In Progress → Under Review → Approved → Released → Obsolete.
  • Transition: conditions for moving between states (permissions, required properties, quantity checks, etc.).
  • On Transition, automatic actions fire: Revision increment, Custom Property update, email notifications, Dispatch scripts.
Tip Files in the Released state become read-only. To edit them again, issue an ECO (Engineering Change Order) that walks the Workflow back, which is the only way to make Check-Out possible again.

2.5 PDM Best Practices

  1. Enforce naming conventions via Dispatch. Check-Ins are blocked when a filename violates the rule.
  2. Required Custom Properties. Reject Check-Ins missing Description, Material, or Designer.
  3. Automate the Revision Table. A Workflow Transition automatically adds a row to the drawing's Revision Table.
  4. Use History. Gets, Check-Outs, and Check-Ins are all logged for audit trails.
  5. Separate User/Group permissions. Approver, designer, and buyer permissions are split to protect released files from corruption.
  6. Task Scheduler (Professional only) — overnight automated PDF/STEP conversion and backup. Feature expansion in 2025.

3. SimulationXpress / Simulation

3.1 SimulationXpress

Included by default in SolidWorks Standard. Supports single-body parts + linear static analysis only. The available conditions are essentially limited to Fixtures and Force/Pressure. Multi-body, assembly, nonlinear, thermal, and dynamic studies are not possible.

3.2 Additional Studies in Simulation Premium/Professional

  • Static: Linear static (includes the SimulationXpress scope).
  • Frequency: Natural frequency / mode analysis.
  • Buckling: Buckling.
  • Thermal: Steady-state / transient thermal.
  • Drop Test: Drop impact.
  • Fatigue: Fatigue life.
  • Nonlinear: Large deformation / nonlinear materials (Premium).
  • Dynamic: Time-domain dynamic analysis (Premium).

3.3 Mesh

TypeCharacteristics
Standard MeshUniform size. For simple geometry.
Curvature-based MeshSize auto-adjusts to curvature. Recommended default.
Blended Curvature-basedSmooth transitions. Good when body count is low.
Draft Quality1st-order (linear) elements. Fast but inaccurate.
High Quality2nd-order elements. Accurate but slow.
Tip Thin plates need at least two elements through the thickness. Just one produces inaccurate bending results.
Tip Refine locally with Mesh Control at stress-concentration sites (holes, fillets, sharp edges). There is no need to refine globally. Mesh convergence is considered achieved when the Energy Norm Error plot is under 10% in the region of interest.

3.4 Boundary Conditions and Loads

  • Fixture: Fixed Geometry, Roller/Slider, Fixed Hinge, Reference Geometry, Symmetry.
  • Load: Force, Torque, Pressure, Gravity, Bearing Load (cosine cylindrical distribution), Remote Load (force transmitted from a remote point).
Note Overusing Fixed Geometry adds constraints that do not exist in reality, artificially inflating stresses. Pick a boundary condition close to the actual support situation.

3.5 Interpreting Results

  • Von Mises Stress: Equivalent stress. Suited to ductile materials.
  • Principal Stress (P1/P3): Principal stresses. Suited to brittle materials.
  • Displacement: Displacement. Always annotate the visual exaggeration factor.
  • Factor of Safety (FOS): Allowable stress / applied stress. Aim for 3 or more under general static loads and 5 or more under cyclic/dynamic loads.
Note The infinite stress at a sharp edge is a numerical singularity. It is not a real stress but a mesh-convergence error, and it resolves once a fillet is added and the analysis rerun.

4. Motion Study

4.1 Three Levels

LevelCapabilityLicense
AnimationMate/Explode-based animation. No physics.Standard
Basic MotionGravity, springs, motors, some contact. Approximate physics.Standard
Motion AnalysisFull dynamics. Forces, moments, inertia, dampers, contact.Premium

4.2 Motor / Spring / Gravity / Contact

  • Rotary Motor: Axis + RPM or angular velocity (°/s). Functions: Constant, Distance, Oscillating, Segments, Expression, etc.
  • Linear Motor: Linear direction + velocity/acceleration.
  • Linear Spring: Between two points. Free length and spring constant (N/mm). Setting the free length different from the Mate neutral state lets you represent preload.
  • Torsion Spring (Motion Analysis only): Rotation axis, torque-angle.
  • Gravity: Direction (X/Y/Z) and magnitude (default 9.81 m/s²).
  • Contact: Collision and friction between Solid Bodies. Friction Coefficient (Coulomb friction), Restitution Coefficient (0–1, elastic rebound).

4.3 Best Practices

  1. Disable Lightweight. Motion Analysis requires fully resolved state.
  2. Simplify Mates. Motion Analysis turns every Mate into an equation, so more Mates means slower solves.
  3. State Initial Conditions explicitly. Manage each component's initial velocity/position via Fixed/Float.
  4. Tune Step size. The default is coarse; use 0.01 s or smaller for precision.
  5. Motion → Simulation linkage. Loads extracted from Motion can be fed into Simulation for time-varying-load structural analysis.

5. Rendering

5.1 From PhotoView 360 to Visualize

Note PhotoView 360 was discontinued after 2023 SP5. From 2024 on, SOLIDWORKS Visualize is the official rendering tool. Existing PhotoView scenes do not migrate to Visualize automatically, so they need rework.

5.2 SOLIDWORKS Visualize

  • A separate application (can be installed alongside). Bundled with SolidWorks Professional and above.
  • GPU-accelerated (NVIDIA RTX recommended). Based on CUDA/OptiX.
  • Editions: Standard / Professional / Connected.

Professional adds: keyframe Animation, physics-based Simulation (gravity, collisions), automatic Turntable/Explode animation, PLM Design Data integration.

5.3 Appearance / Scene / Lighting

  • Appearance: Part Level / Body Level / Feature Level / Face Level — four tiers. Priority goes Face > Feature > Body > Part.
  • Scene: Basic (simple backgrounds), Studio (HDRI-based). Custom .hdr supported.
  • Lighting: Ambient, Directional, Point, Spot, HDR Environment. A single HDRI is often more realistic than three point lights.

5.4 Render Output Best Practices

  1. Camera composition is 70% of quality. Place the subject at the one-third point of the frame.
  2. Use Depth of Field to focus on the subject and blur the background.
  3. Lock in consistency with a company-standard materials library.
  4. A Turntable animation is powerful for product promotion. One click in Visualize.
  5. PNG supports an alpha (transparent) channel. Essential for catalog compositing.

6. Troubleshooting

6.1 Rebuild Error Resolution Order

  1. Work from the topmost error. Upstream feature errors cascade downstream.
  2. Right-click the error icon → check the specific message in What's Wrong?.
  3. Ctrl+Q Force Rebuild — surfaces hidden errors or clears them automatically.
  4. Re-select references with Edit Feature.
  5. Last resort — delete the feature and recreate it.

6.2 Dangling Dimension / Relation

  • Yellow = the reference entity is lost.
  • Inside sketch edit, Display/Delete Relations → set the filter to Dangling.
  • Drag the red handle to reattach to a new entity, or delete entirely and re-constrain.

6.3 Mate Errors

  • Mate conflicts or lost references in the assembly.
  • MateXpert auto-diagnoses — it proposes the offending Mates and suggests fixes.
  • For Over-defined states, remove Mates one at a time to narrow down the conflict.

6.4 File Repair

  • After a crash, the Recover documents dialog appears automatically on restart.
  • In the File Open dialog, pick Open and Repair from the bottom-right dropdown.
  • SolidWorks Explorer: Right-click in Windows Explorer → safely perform reference fixes, Pack & Go, and Rename.

6.5 Common Errors and Fixes

SymptomCauseFix
"Unable to create feature"Self-intersection, zero thicknessCheck the sketch, reduce the fillet radius
"Zero thickness geometry"Fillet/Shell produced zero thicknessReorder features
Shell failsSmall fillet / sharp edgeAdjust Fillet order, set Multi-thickness
Mate "Over-defined"Duplicate/conflicting MatesRun MateXpert, remove unneeded Mates
Drawing doesn't updateReference path changedPack & Go or File → Find References
"Missing file"Filename/path changedReconnect via Browse, Check-In to PDM
Large assembly unresponsiveOut of memoryLightweight, SpeedPak, Defeature

6.6 Data-Loss Prevention

  1. Auto-save at 10 minutes or less (Tools → Options → System Options → Backup/Recover).
  2. Keep 5 or more backups.
  3. Periodic project backups via Pack & Go.
  4. Dual-backup with Windows File History, OneDrive, or Dropbox.
  5. Overnight automated backups via the PDM Task Scheduler (Professional only).

7. 2024 / 2025 New-Feature Summary

7.1 SolidWorks 2024

  • Active Section View — move the section plane dynamically on a drawing.
  • Improved Assembly change detection — on large assemblies, only the changed portion is rebuilt.
  • Hole Wizard 30% faster.
  • MBD Auto-Balloon — automatic numbering on 3D PMI.
  • Toolbox Contextual Toolbar — faster access.

7.2 SolidWorks 2025

  • Detailing Mode improvements — edit drawings of large assemblies without Resolving. Load times shrink from minutes to seconds.
  • Component References — tag each instance individually when the same part serves multiple purposes (e.g., "LEFT", "RIGHT").
  • Copy with Mates expanded — includes Advanced and Mechanical Mates (Slot, Width, etc.).
  • Configuration Publisher update — refined web interface.
  • Large Design Review (LDR) — Component Preview Window, Breadcrumbs navigation.
  • Defeature Silhouette — optimized for 3D-print export.
  • Sheet Metal relief automation — improved corner-relief algorithm.
  • PDM Task Scheduler expansion — overnight automated PDF/STEP conversion.

7.3 3DEXPERIENCE Works (2025)

  • AI Copilot — natural-language commands (e.g., "Add M8 hole 10mm from the edge").
  • Generative Design — specify load and weight targets → AI proposes optimized geometry.
  • Cloud BOM — real-time sharing across design, purchasing, and manufacturing departments.

Field Checklist

  • At least one candidate repetitive task identified for macro automation
  • Recorded macros refactored to remove absolute paths and names
  • Policy established for checking design files into the PDM Vault
  • Team members differentiate Version and Revision in usage
  • Revision and Custom Properties auto-update on Workflow Transition
  • Simulation boundary conditions reflect real support situations
  • Stress singularities resolved by adding fillets
  • Before Motion Analysis, Lightweight disabled and Step size tuned
  • Rendering environment migrated to Visualize (PhotoView dependency removed)
  • Auto-save interval and backup count at 10 min / 5 or more
  • Rebuild errors handled from What's Wrong? in top-down order
  • Detailing Mode used to edit large-assembly drawings (2025)
Bookmark this site!
PC: Ctrl + D
Mobile: Browser menu → Add bookmark