SaveAs Activity
Purpose: This activity saves a SolidWorks document with a new file name and/or location. It can also be used to export the document to a different file format (e.g., STEP, IGES, PDF) by specifying a different file extension. This is useful for creating copies, exporting to different formats, or saving to a different location.
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"
Target folder path where the file should be saved. This is the directory where the new file will be created.
Type: string
Required: Yes
Example: C:\Exports or D:\Output\Parts
New file name with extension. Include the file extension to specify the output format (e.g., .STEP, .IGES, .PDF, .SLDPRT).
Type: string
Required: Yes
Example: Part1.STEP or Assembly1.SLDPRT or Drawing1.PDF
Output Properties
Indicates whether the file was successfully saved.
Type: bool
Note: Returns false if the document cannot be saved, if the target path is invalid, if the document ID is invalid, or if an error occurs during the save operation.
Usage Example
Scenario: Export a SolidWorks part to STEP format Configuration: - DocumentId: "doc-12345" - TargetFolderPath: "C:\Exports" - FileName: "MyPart.STEP" Result: - Success: true (if export was successful) Scenario: Save a copy with a new name Configuration: - DocumentId: "doc-12345" - TargetFolderPath: "C:\Projects\Backups" - FileName: "Part1_Backup.SLDPRT" Result: - Success: true (if save was successful)
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 target folder path is invalid or inaccessible,
Successwill be set tofalse - If the file format is not supported or cannot be exported,
Successwill be set tofalse - Any other unexpected errors will be caught and
Successwill be set tofalse
Always check the Success output to ensure the file was saved successfully before proceeding with other operations.
Supported Export Formats
.STEP/.STP- STEP format for CAD exchange.IGES/.IGS- IGES format for CAD exchange.PDF- PDF format for drawings.SLDPRT- SolidWorks Part format.SLDASM- SolidWorks Assembly format.SLDDRW- SolidWorks Drawing format- And other formats supported by SolidWorks export functionality
Important Notes
- The document must be open in SolidWorks and accessible via the DocumentId
- The target folder must exist and be accessible with write permissions
- If a file with the same name already exists in the target folder, it may be overwritten
- Use different file extensions to export to different formats (e.g., .STEP, .IGES, .PDF)
- The original document remains open and unchanged - this creates a new file
- For format conversion, ensure the source document type is compatible with the target format
- Some formats may require specific document types (e.g., PDF export typically requires a Drawing document)
Related Activities
- Save - Save a document to its current location
- OpenSolidWorksFile - Open a SolidWorks file
- GetActiveDoc - Get the active document ID
- GetFullPath - Get the current file path before saving