packandgo
Description
The packg command performs a SOLIDWORKS Pack and Go operation on:
- A single assembly file
- Multiple assemblies discovered via directory search
- A CSV file containing a list of assembly paths
This command launches SOLIDWORKS, executes Pack and Go for each assembly, and saves the results into a specified output directory.
By default, only .sldasm files are processed.
Syntax
packg -source -directory [-search] [-includedrawings] [-recursive] [-prefix] [-suffix] [-timeout]
Parameters
| Parameter | Alias | Required | Description |
|---|---|---|---|
-source |
No | Single file path, CSV file containing complete assembly path names, or directory of assemblies to pack and go. | |
-directory |
-dir |
No | Where to Pack and Go the SOLIDWORKS documents. This supports dynamic placeholders against the search results. |
-search |
No | Search query for the source parameter. Default value is .sldasm$. Supports regex. | |
-includedrawings |
No | Includes related drawing files when processing SOLIDWORKS documents. | |
-recursive |
No | When used with search, includes matching files in subfolders. | |
-prefix |
No | Text to add before the generated file name. | |
-suffix |
No | Text to add after the generated file name. | |
-timeout |
No | In seconds. Default is 30 seconds. SOLIDWORKS timeout. |
More about parameters
source
Single assembly file, directory of assemblies, or CSV file containing assembly paths.directory
Destination folder where Pack and Go results will be saved.
Supports placeholders:- $filename
- $fileNameWithoutExtension
- $directory
- $date
- $year
search
Search pattern applied when source is a directory.
Default value is\.sldasm$. Supports regular expressions.includedrawings
Includes associated drawing files (.slddrw) in the Pack and Go operation.recursive
Searches subdirectories when source is a directory.prefix
Adds a prefix to all generated file names.suffix
Adds a suffix to all generated file names.timeoutSOLIDWORKS startup and pack and go timeout in seconds. Default is 30.
Examples
Example 1: Pack a Single Assembly
## Packs a single assembly and saves results to D:\Packages
packg -source "C:\Projects\Top.sldasm" -directory "D:\Packages"
Example 2: Pack All Assemblies in a Directory
## Packs all assemblies (*.sldasm) in the specified folder
packg -source "C:\Projects" -directory "D:\Packages"
Example 3: Recursive Directory Search
## Searches subfolders and packs all assemblies found
packg -source "C:\Projects" -directory "D:\Packages" -recursive
Example 4: Use Regex Search
## Packs only assemblies that start with TOP_
packg -source "C:\Projects" -search "^TOP_.*\.sldasm$" -directory "D:\Packages"
Example 5: Pack Assemblies from CSV
## Reads assembly paths from a CSV file and packs each one
packg -source "C:\Batch\assemblies.csv" -directory "D:\Packages"
Example 6: Include Drawings
## Includes associated drawing files in Pack and Go
packg -source "C:\Projects\Top.sldasm" -directory "D:\Packages" -includedrawings
Example 7: Prefix and Suffix
## Adds prefix and suffix to all packed files
packg -source "C:\Projects\Top.sldasm" -directory "D:\Packages" -prefix "SW_" -suffix "_Release"
Example 8: Increase SOLIDWORKS Timeout
## Allows more time for SOLIDWORKS to launch
packg -source "C:\Projects" -directory "D:\Packages" -timeout 300
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.