OpenSolidWorksFile Activity
Purpose: This activity opens a SolidWorks file in the local SolidWorks application. It supports opening part files (.SLDPRT), assembly files (.SLDASM), and drawing files (.SLDDRW). The activity returns a document ID that can be used to reference the opened document in subsequent activities.
Input Properties
The full file path of the SolidWorks file to open.
Type: string
Required: Yes
Example: C:\Projects\MyPart.SLDPRT
Output Properties
Returns the document ID of the opened SolidWorks document. This ID can be used to reference the document in other activities.
Type: string
Note: If an error occurs, this will contain an error message starting with "Error: "
Usage Example
Scenario: Open a SolidWorks part file Configuration: - FilePath: "C:\Projects\MyAssembly\Part1.SLDPRT" Result: - DocumentId: "doc-12345" (or error message if failed) Next Steps: Use the DocumentId in subsequent activities to work with the opened document.
Supported File Types
.SLDPRT- SolidWorks Part files.SLDASM- SolidWorks Assembly files.SLDDRW- SolidWorks Drawing files
Error Handling
Important: The activity handles errors gracefully:
- If the file cannot be opened, the
DocumentIdoutput will contain an error message - If SolidWorks is not running, the activity will attempt to start it
- If the file path is invalid, an error message will be returned
Always check the DocumentId output to ensure the file was opened successfully before using it in subsequent activities.
Important Notes
- SolidWorks must be installed and licensed on the machine running the workflow
- The file path must be accessible from the server/workflow execution environment
- If a file is already open in SolidWorks, the activity will reference the existing document
- The
DocumentIdis unique for each opened document session - Use the
DocumentIdin other SolidWorks activities to perform operations on the opened document - Remember to close documents when done to free up resources
Related Activities
- Save - Save the opened document
- SaveAs - Save the document with a new name
- GetActiveDoc - Get the currently active document
- SwxCleanupActivity - Close documents and clean up resources