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

DocumentId

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"

TargetFolderPath

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

FileName

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

Success

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 InvalidOperationException will be caught and Success will be set to false
  • If the target folder path is invalid or inaccessible, Success will be set to false
  • If the file format is not supported or cannot be exported, Success will be set to false
  • Any other unexpected errors will be caught and Success will be set to false

Always check the Success output to ensure the file was saved successfully before proceeding with other operations.

Supported Export Formats

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