ExtractPartData Activity

Purpose: This activity extracts detailed metadata from a SolidWorks part document, including volume, custom properties, sheet-metal information, and other comprehensive part data. It returns all this information as a structured JSON string containing a PartData object.

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

Json

The extracted PartData serialized to a JSON string. Contains comprehensive part information including volume, surface area, custom properties, sheet-metal data, material, and more.

Type: string

Note: If an error occurs, the JSON will contain an error object with "Error" and "Status" properties.

Example: Contains structured data like volume, custom properties, material, sheet-metal status, etc.

Usage Example

Scenario: Extract comprehensive part data for analysis or reporting

Configuration:
- DocumentId: "doc-12345"

Result:
- Json: Contains PartData object with:
  - Volume information
  - Surface area
  - Custom properties
  - Material information
  - Sheet-metal data (if applicable)
  - And other part metadata

Next Steps:
Parse the JSON to access specific data fields, or use it for reporting, validation, or data analysis.

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 the JSON will contain: {"Error": "{error message}", "Status": "Failed"}
  • If JSON serialization fails, a JsonException will be caught and the JSON will contain: {"Error": "JSON serialization failed: {error message}", "Status": "Failed"}
  • Any other unexpected errors will be caught and the JSON will contain: {"Error": "Unexpected error: {error message}", "Status": "Failed"}

Always check the JSON output for an "Error" property before using the extracted data in subsequent activities.

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
  • This activity extracts comprehensive data including geometry, properties, and metadata
  • The JSON output is formatted with indentation for readability
  • Sheet-metal specific data is included if the part is a sheet-metal part
  • Volume and surface area calculations depend on the part being fully defined
  • Use this activity when you need all available part data in a single operation
  • This is more comprehensive than ExtractCustomProperties, which only extracts properties

Related Activities