Table of Contents

rebuild

Premium

Description

Force-rebuild and save selected locally cached SOLIDWORKS parts, assemblies, and drawings. Requires Premium and an installed, licensed SOLIDWORKS desktop application. Document Manager or eDrawings alone is not sufficient.

Important

Saving can upgrade files to the selected SOLIDWORKS version; choose -swversion deliberately.

Syntax

rebuild (-filePath <path> | -search <query>) [-swversion <year>]

Use -id as an alternative to -filePath for the same operand. A required target still needs one selector, even though each alternative is optional individually. See File IDs and paths for selection rules and command-specific exceptions.

Parameters

Parameter Alias Required Description
-filePath -f No Exact vault file path; absolute, current-folder-relative, or vault-root-relative. Quote paths with spaces.
-search -s No PDM search expression, including CSV query input. Use Recursive=true for subfolders. Edit=true is rejected.
-swversion -swv No Installed SOLIDWORKS release year, such as 2026. Defaults to the latest installed version.
-id No Positive PDM file ID instead of -filePath, identifying the same file that -filePath describes (including a macro, input CSV or existing output file). Requires a connected vault. Shared files with multiple locations require an exact -filePath. Resolving the ID itself does not download, check out or check in the file; the requested command still performs its normal operation.

Specify exactly one nonempty -filePath or -search. Parameter names and installed SOLIDWORKS years are available through autocomplete.

Examples

rebuild -filePath "My Assembly.sldasm" -swversion 2026
rebuild -f "\Projects\Design A\Bracket.sldprt" -swv 2026
rebuild -search "Name=%.sldprt;Locked=true;LockedOnComputer=BBS-Omen;Recursive=true" -swversion 2026
rebuild -search "<C:\Reports\rebuild-queries.csv>" -swversion 2026

Checkout, references, and saving

  • Files must already be checked out by the logged-in PDM user, on this computer, in the selected folder. Ownership is checked again immediately before saving.
  • Cache the working copies and required references first. The command does not download, check out, check in, or undo checkout. Missing or read-only local files fail without starting SOLIDWORKS.
  • A dedicated SOLIDWORKS instance opens each selected file, forces a rebuild, and silently saves that file. Open errors or warnings (including missing references), rebuild failure, and save errors are reported as failures. Save warnings are logged.
  • Rebuild uses the active configuration (or active drawing sheet), not every configuration/sheet. Assembly subassemblies may rebuild in memory, but referenced files are not automatically saved. Include any children that need saving as separate search targets; search order is not a dependency build order.
  • Existing user SOLIDWORKS windows are not attached to or closed. The SOLIDWORKS-hosted PDMShell add-in rejects this command; run it from standalone PDMShell, CLI, or MCP instead.

Batch results and cancellation

Individual file failures do not stop subsequent search matches. Duplicate paths are processed once per command. The output includes a per-file result and counts of files rebuilt/saved and failed. Any failure or incomplete search marks the command unsuccessful; it does not report successful completion for a partial failure. There is no CSV output report parameter.

Cancellation is checked between files, after rebuild, and before save. An in-progress SOLIDWORKS COM call is not forcibly interrupted, so cancellation may take time. Files already saved remain saved; changes are not rolled back.

See the SOLIDWORKS API references for ForceRebuild3 and Save3.

Search results report

Add -csv "C:\Reports\results.csv" when using -search to save operation results. The first columns are file ID, parent folder ID, file name and output, followed by status and error details. The report folder must exist. New vault reports are added to PDM; existing vault reports must be checked out by you on this computer and remain checked out. External reports are replaced. See CSV operation reports for command-specific outcomes.