CheckFileType Activity
Purpose: This activity returns the SolidWorks file type for a given document ID. It can identify whether the document is a Part, Assembly, Drawing, ImportedPart, or Unknown type.
Input Properties
The document ID returned by OpenSolidWorksFileActivity or GetActiveDoc. This identifies the SolidWorks document to check.
Type: string
Required: Yes
Example: "doc-12345"
Output Properties
The document's type as a string. Possible values are: "Part", "Assembly", "Drawing", "ImportedPart", or "Unknown".
Type: string
Note: If an error occurs, this will contain an error message starting with "Error: " or "Unexpected error: "
Usage Example
Scenario: Check the type of an opened SolidWorks document Configuration: - DocumentId: "doc-12345" Result: - FileType: "Part" (or "Assembly", "Drawing", "ImportedPart", "Unknown", or error message) Next Steps: Use the FileType output to determine which type-specific activities can be used with this document.
Supported File Types
Part- SolidWorks Part files (.SLDPRT)Assembly- SolidWorks Assembly files (.SLDASM)Drawing- SolidWorks Drawing files (.SLDDRW)ImportedPart- Imported part files (STEP, IGES, etc.)Unknown- File type could not be determined
Error Handling
Important: The activity handles errors gracefully:
- If the document ID is invalid or the document cannot be found, an
InvalidOperationExceptionwill 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 FileType output to ensure it doesn't start with "Error:" before using it in conditional logic or subsequent activities.
Important Notes
- The document must be open in SolidWorks and accessible via the DocumentId
- Use this activity to determine which type-specific operations are available for a document
- Part-specific activities should only be used with "Part" type documents
- Assembly-specific activities should only be used with "Assembly" type documents
- Drawing-specific activities should only be used with "Drawing" type documents
- If the file type is "Unknown", some operations may not be available
Related Activities
- OpenSolidWorksFile - Open a SolidWorks file to get a DocumentId
- GetActiveDoc - Get the active document ID
- GetFileName - Get the file name of a document
- GetFullPath - Get the full file path of a document