SolidWorks Open Document
Open and activate a SolidWorks document by file path.
Prerequisites
- SolidWorks 2024+ with SwpilotCLI add-in installed
- .NET 8+ Runtime on the system
- A valid
.sldprt,.sldasm, or.slddrwfile path
What this Skill does
- Connects to the running SolidWorks instance
- Opens the specified file silently (no dialogs)
- Activates the document so it becomes the active doc
Quick start
# Open a part
dotnet run --project ./sup_tools/swpilotcli-open-doc/scripts/OpenDoc/OpenDoc.csproj -- "C:\path\to\part.sldprt"
# Open an assembly
dotnet run --project ./sup_tools/swpilotcli-open-doc/scripts/OpenDoc/OpenDoc.csproj -- "C:\path\to\assembly.sldasm"
# Open a drawing
dotnet run --project ./sup_tools/swpilotcli-open-doc/scripts/OpenDoc/OpenDoc.csproj -- "C:\path\to\drawing.slddrw"
Expected output:
成功開啟: C:\path\to\part.sldprt
Return codes
| Code | Meaning |
|------|---------|
| 0 | Success |
| 1 | General error |
| 2 | Cannot connect to SolidWorks |
| 3 | File path argument missing |
| 4 | OpenDoc failed (check error code in output) |