HasFeatureTreeErrors Activity

Purpose: This activity checks if a SolidWorks part document has any feature tree errors. Feature tree errors can prevent accurate calculations, cause rebuild failures, or indicate design problems. Use this activity to validate part quality before performing operations that depend on a fully defined part.

Input Properties

DocumentId

ID of an open SolidWorks document. This should be the document ID returned by activities like OpenSolidWorksFile or GetActiveDoc.

Type: string

Required: Yes

Example: "doc-12345"

Output Properties

HasErrors

Indicates whether the part has feature tree errors. Returns true if errors are found, false if the part is error-free.

Type: bool

Note: If an error occurs during the check itself, this will be set to true as a safety measure, assuming errors exist if the check cannot be performed.

Usage Example

Scenario: Validate a part before calculating volume

Configuration:
- DocumentId: "doc-12345"

Result:
- HasErrors: false (part is error-free)

Next Steps:
If HasErrors is false, proceed with volume calculations or other operations. If true, investigate and fix errors first.

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 HasErrors will be set to true (assuming errors exist if check cannot be performed)
  • If the check itself fails for any reason, HasErrors will be set to true as a safety measure
  • This conservative approach ensures that operations dependent on error-free parts are not performed on potentially problematic documents

Always check HasErrors before performing operations that require a fully defined, error-free part (such as volume calculations).

Important Notes

  • The document must be a SolidWorks part document (not an assembly or drawing)
  • The document must be open in SolidWorks and accessible via the DocumentId
  • Feature tree errors can include missing references, failed features, over-defined sketches, and other modeling issues
  • Parts with errors may have incorrect mass properties, volume calculations, or may fail to rebuild
  • Use this activity as a quality check before performing critical operations
  • If HasErrors is true, open the document in SolidWorks to view and fix the specific errors
  • This is a validation step - always check for errors before volume, mass, or other calculations

Related Activities