File Management Tools¶
Open, save, and manage SolidWorks documents. Load parts and assemblies, save-as with new names or paths, manage custom file properties, and convert between file formats.
Prerequisite: SolidWorks running. File-write operations need writable output paths.
Total tools in this category: 18
save_file¶
Save the current SolidWorks model.
Prerequisite: Active open document
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
force_save |
bool |
— | True |
Force save even if no changes |
file_path |
str? |
— | None |
Optional output path. If omitted, saves the current active document. |
Sample call:
save_as¶
Save the current model to a new location or format.
Prerequisite: Active open document, writable output path
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_path |
str |
✅ | `` | Full path for the new file |
format_type |
str |
— | solidworks |
File format (solidworks, step, iges, etc.) |
overwrite |
bool |
— | False |
Overwrite existing file |
Sample call:
get_file_properties¶
Get properties of the current SolidWorks file.
Prerequisite: Active document
Sample call:
get_model_info¶
Get compact metadata for the active SolidWorks document.
Prerequisite: Active document
Sample call:
list_features¶
List feature-tree entries for the active SolidWorks document.
Prerequisite: Active document
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
include_suppressed |
bool |
— | False |
Include suppressed features in the returned list |
Sample call:
classify_feature_tree¶
Classify the active model into a likely feature family using get_model_info and list_features.
Useful for routing between direct MCP modeling, VBA-backed workflows, assembly planning, and low-confidence “inspect more” cases before any write operations.
Prerequisite: Active document, unless you pass model_info and features explicitly
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
include_suppressed |
bool |
— | True |
Include suppressed features when reading the active model tree |
model_info |
Dict[str, Any]? |
— | None |
Optional pre-fetched model-info payload |
features |
List[Dict[str, Any]]? |
— | None |
Optional pre-fetched feature-tree payload |
Sample call:
list_configurations¶
List configuration names for the active SolidWorks document.
Prerequisite: Active document
Sample call:
manage_file_properties¶
Read, update, copy, move, rename, or delete file-related properties.
Prerequisite: Active document
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
operation |
str |
✅ | `` | Operation to perform (copy, move, delete, rename) |
source_path |
str? |
— | None |
Source file path |
file_path |
str? |
— | None |
Alternative file path |
target_path |
str? |
— | None |
Target file path (for copy/move/rename) |
properties |
Dict[str, Any]? |
— | None |
File properties to set |
parameters |
Dict[str, Any]? |
— | None |
Operation parameters |
include_system |
bool |
— | False |
Include system properties |
Sample call:
convert_file_format¶
Convert a SolidWorks file from one format to another.
Prerequisite: Valid source file path
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source_file |
str |
✅ | `` | Source file path |
target_file |
str? |
— | None |
Target file path |
source_format |
str? |
— | None |
Source file format |
target_format |
str |
✅ | `` | Target file format |
output_path |
str? |
— | None |
Alternative output path |
conversion_options |
Dict[str, Any]? |
— | None |
Conversion options |
quality |
str |
— | high |
Conversion quality |
units |
str |
— | mm |
Units |
invalid_format |
str? |
— | None |
Invalid format for testing |
Sample call:
batch_file_operations¶
Run a file operation across multiple files as a batch workflow.
Prerequisite: Writable directories
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
operation |
str |
✅ | `` | Operation to perform (copy, move, delete, rename) |
source_path |
str? |
— | None |
Source file path |
file_path |
str? |
— | None |
Alternative file path |
target_path |
str? |
— | None |
Target file path (for copy/move/rename) |
properties |
Dict[str, Any]? |
— | None |
File properties to set |
parameters |
Dict[str, Any]? |
— | None |
Operation parameters |
include_system |
bool |
— | False |
Include system properties |
Sample call:
load_part¶
Load (open) a SolidWorks part file.
Prerequisite: SolidWorks running, valid .sldprt path
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_path |
str |
✅ | `` | Full path to the .sldprt file |
Sample call:
load_assembly¶
Load (open) a SolidWorks assembly file.
Prerequisite: SolidWorks running, valid .sldasm path
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_path |
str |
✅ | `` | Full path to the .sldasm file |
Sample call:
save_part¶
Save the active SolidWorks part document.
Prerequisite: Active Part document
Sample call:
save_assembly¶
Save the active SolidWorks assembly document.
Prerequisite: Active Assembly document
Sample call:
pack_and_go_assembly¶
Copy a SolidWorks assembly and all its referenced parts to a self-contained folder — equivalent to the SolidWorks GUI Pack and Go operation.
The active assembly (or source_path) is opened, every referenced component is enumerated via the native SolidWorks IPackAndGo COM API, and all files are written into target_dir with internal paths rewritten so the copy opens without any dependency on the original file locations.
Prerequisite: SolidWorks running with the assembly loaded (or openable). target_dir must be writable.
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source_path |
str |
✅ | Absolute path to the source .sldasm file |
|
target_dir |
str |
✅ | Directory where the assembly and all referenced parts will be copied | |
export_preview |
bool |
— | True |
Export an isometric PNG preview next to the copied files |
overwrite |
bool |
— | False |
Overwrite files that already exist in target_dir |
Sample call:
{
"source_path": "C:\\Projects\\robot_arm.sldasm",
"target_dir": "C:\\Exports\\robot_arm_pkg",
"export_preview": true
}
Response fields:
| Field | Type | Description |
|---|---|---|
status |
str |
"success" or "error" |
file_path |
str |
Path to the copied root assembly file |
copied_file_count |
int |
Total number of files written |
copied_files |
list[str] |
Absolute paths of every copied file |
all_files_saved |
bool |
true when every per-file save status is swPackAndGoSaveStatus_Ok (0) |
save_status_warnings |
list[str] |
Human-readable description of any non-zero per-file statuses (empty list on full success) |
preview_image |
str? |
Path to the isometric PNG preview, or null if export was skipped or failed |
swPackAndGoSaveStatus_e reference (values reported in save_status_warnings):
| Code | Name | Meaning |
|---|---|---|
0 |
Ok |
File was written successfully |
2 |
FileAlreadyExist |
Target file already existed and was not overwritten |
3 |
MissingSource |
Source reference file could not be found |
All zeros in the per-file status array (all_files_saved: true) means SolidWorks confirmed every file was written successfully via its native Pack-and-Go engine.
list_open_documents¶
List every SolidWorks document currently open. Read-only — does not change which document is active. Use it to discover what is open (an assembly plus its parts, a drawing plus its model) before switching with activate_document.
Prerequisite: SolidWorks running
Parameters: none
Sample call:
Response fields:
| Field | Type | Description |
|---|---|---|
status |
str |
"success" or "error" |
documents |
list[dict] |
One {title, path, type, is_active} entry per open document |
count |
int |
Number of open documents |
activate_document¶
Switch which open document is the active one. Matches the argument against open documents by title, full path, or file name (case-insensitive), calls ActivateDoc3, and reads the active document back to confirm the switch took.
Prerequisite: The target document is already open
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
title_or_path |
str |
✅ | `` | Window title, full path, or bare file name of an open document |
Sample call:
save_body_as_part¶
Extract one solid body from the active multibody part into its own standalone .sldprt. Runs SolidWorks' Save Bodies on a single named body; the body is matched by name against the active part's solid bodies (the response lists every solid body found, so an unknown name reports the real options). Success is confirmed by the file existing on disk afterwards.
Prerequisite: Active multibody part
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body_name |
str |
✅ | `` | Name of a solid body in the active part, e.g. 'Boss-Extrude1' |
file_path |
str |
✅ | `` | Absolute path for the new .sldprt (parent directory must exist) |
Sample call: