Save Activity
Purpose: This activity saves a SolidWorks document to its current location. It saves any changes made to the document since it was last saved or opened. Use this activity to persist modifications to the file.
Input Properties
The ID of the open SolidWorks document to save. This should be the document ID returned by activities like OpenSolidWorksFile or GetActiveDoc.
Type: string
Required: Yes
Example: "doc-12345"
Output Properties
Indicates whether the file was successfully saved.
Type: bool
Note: Returns false if the document cannot be saved, if the document ID is invalid, or if an error occurs during the save operation.
The full path where the file was saved. This will be the same as the original file path.
Type: string
Note: If the save operation failed, this will be an empty string. If successful, it contains the full file path.
Usage Example
Scenario: Save changes to a SolidWorks document Configuration: - DocumentId: "doc-12345" Result: - Success: true (if save was successful) - SavedPath: "C:\Projects\SolidWorks\Parts\MyPart.SLDPRT" Next Steps: Use the Success output to verify the file was saved before proceeding with other operations or closing the document.
Error Handling
Important: The activity handles errors gracefully:
- If the document ID is invalid or the document cannot be found, an
InvalidOperationExceptionwill be caught andSuccesswill be set tofalse - If the file is read-only or cannot be written to,
Successwill be set tofalse - Any other unexpected errors will be caught and
Successwill be set tofalse - When errors occur,
SavedPathwill be set to an empty string
Always check the Success output to ensure the file was saved successfully before proceeding with other operations.
Important Notes
- The document must be open in SolidWorks and accessible via the DocumentId
- This saves the file to its current location - use SaveAs to save with a new name or location
- If the file has not been saved before (new document), it may need to be saved using SaveAs first
- The file must have write permissions at the target location
- If the file is read-only, the save operation will fail
- All unsaved changes will be persisted when the save succeeds
- Use this activity after making modifications to ensure changes are not lost
Related Activities
- SaveAs - Save a document with a new name or location
- OpenSolidWorksFile - Open a SolidWorks file
- GetActiveDoc - Get the active document ID
- GetFullPath - Get the full file path before saving