GetFullPath Activity

Purpose: This activity gets the full file path of a SolidWorks document using its document ID. It returns the complete path including drive, directory, and file name, which is useful for file operations, saving, or referencing the file location.

Input Properties

DocumentId

Enter the document ID of the SolidWorks file to get the full path. This should be the document ID returned by activities like OpenSolidWorksFile or GetActiveDoc.

Type: string

Required: Yes

Example: "doc-12345"

Output Properties

FullPath

Returns the full file path of the SolidWorks document, including drive, directory, and file name.

Type: string

Note: If an error occurs, this will contain an error message starting with "Error: " or "Unexpected error: "

Example: C:\Projects\SolidWorks\Parts\Part1.SLDPRT

Usage Example

Scenario: Get the full file path of an opened SolidWorks document

Configuration:
- DocumentId: "doc-12345"

Result:
- FullPath: "C:\Projects\SolidWorks\Parts\MyPart.SLDPRT" (or error message if failed)

Next Steps:
Use the FullPath output for file operations, copying files, or saving to a different location.

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 returned as: "Error: {error message}"
  • If the document full path is null, an ArgumentNullException will be caught and returned as: "Error: {error message}"
  • Any other unexpected errors will be caught and returned as: "Unexpected error: {error message}"

Always check the FullPath output to ensure it doesn't start with "Error:" before using it in file operations.

Important Notes

  • The document must be open in SolidWorks and accessible via the DocumentId
  • This returns the complete file path including drive, directory, and file name
  • Use GetFileName activity if you only need the file name without the path
  • The path format follows Windows file system conventions (e.g., C:\Path\To\File.SLDPRT)
  • This is useful for file operations, copying files, or when you need to reference the file location
  • If the file has not been saved yet, the path may be empty or indicate an unsaved document

Related Activities