ExportSheetMetalToDxf Activity

Purpose: This activity exports a Sheet Metal part to DXF format. The DXF file is typically used for manufacturing processes like laser cutting, plasma cutting, or other CNC operations. The exported file contains the flattened sheet metal geometry.

Input Properties

DocumentId

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

Type: string

Required: Yes

Example: "doc-12345"

OutputRootPath

Root output directory for the DXF file. This is the folder where the DXF file will be saved.

Type: string

Required: Yes

Example: "C:\Exports\DXF" or "D:\Manufacturing\Exports"

DxfFileName

Any specific DXF file name. By default, the activity will use the model name as the file name.

Type: string

Required: No

Example: "CustomName" or leave empty to use model name

Note: If not specified, the model name will be used as the DXF file name.

Output Properties

DxfFilePath

Full path of the exported DXF file, or null if export failed. If an error occurs, this will contain an error message string.

Type: string?

Note: Returns the full file path if export succeeds, or an error message (starting with "Error: " or "Unexpected error: ") if export fails.

Usage Example

Scenario: Export a Sheet Metal part to DXF format

Configuration:
- DocumentId: "doc-12345"
- OutputRootPath: "C:\Exports\DXF"
- DxfFileName: "" (empty, will use model name)

Result:
- DxfFilePath: "C:\Exports\DXF\PartName.dxf" (if export succeeds)

Scenario: Export with custom file name

Configuration:
- DocumentId: "doc-12345"
- OutputRootPath: "D:\Manufacturing\Exports"
- DxfFileName: "CustomPartName"

Result:
- DxfFilePath: "D:\Manufacturing\Exports\CustomPartName.dxf" (if export succeeds)

Error Handling

Important: The activity handles errors gracefully:

  • If InvalidOperationException occurs (e.g., document not found, invalid document type, or Sheet Metal features not present), DxfFilePath will contain: "Error: {exception message}"
  • If any other exception occurs, DxfFilePath will contain: "Unexpected error: {exception message}"
  • The activity does not throw exceptions - errors are returned in the DxfFilePath output

Always check the DxfFilePath output to verify if the export succeeded. If the path starts with "Error: " or "Unexpected error: ", the export failed.

Important Notes

  • The document must be open in SolidWorks and accessible via the DocumentId
  • The part must be a Sheet Metal part - use CheckIfSheetMetal to verify before exporting
  • The OutputRootPath directory must exist and be writable - the activity will not create directories
  • If DxfFileName is empty or not provided, the model name will be used as the file name
  • The exported DXF file contains the flattened sheet metal geometry suitable for manufacturing
  • Ensure the output directory has sufficient disk space for the DXF file
  • The activity does not register or capture document IDs - it only exports the existing document

Related Activities