dsh-cad-design: A Parametric CAD Tool for DSH

Introduction

In the DeepSeek Harness (DSH) ecosystem, agents are usually proficient at handling text or general software code, but in the field of mechanical design, working with geometries and engineering files requires specific capabilities. The dsh-cad-design plugin integrates CadQuery and ezdxf to provide agents with parametric CAD design capabilities, enabling them to write modeling code, validate geometries, render previews, and export manufacturing files.

What Is This

dsh-cad-design is a parametric CAD toolkit designed for DeepSeek Harness. It allows agents to write CadQuery code to build 3D parts, or ezdxf code to generate 2D engineering drawings. This toolchain covers the complete workflow from code authoring, geometry validation, preview rendering, to file export.

Core Features

The plugin includes the following main features:

  • 3D Modeling: Based on CadQuery and the OpenCASCADE kernel, with native STEP export support.
  • 2D Drafting: Based on ezdxf, supporting the generation and export of DXF engineering drawings.
  • Geometry Validation: Uses the cad_validate tool to check the validity of code-generated geometries.
  • Preview Rendering: Uses cad_render to generate PNG or SVG preview images and provides factual data such as volume or bounding box.
  • File Export: Supports exporting to STEP, IGES, STL, 3MF (CadQuery), and DXF (ezdxf) formats.
  • File Conversion: Uses cad_convert to convert between different manufacturing formats.
  • Parametric Skills: Built-in cadquery-design skill (for 3D part design) and ezdxf-drafting skill (for 2D sketch drafting).

Installation and Configuration

Before using the plugin, the corresponding Python dependencies must be installed:

pip install cadquery    # 3D 建模依赖
pip install ezdxf matplotlib   # 2D 绘图及预览依赖

When installing the plugin, the --profile parameter must be explicitly specified. The web profile, which includes the web interface, is typically used:

dsh plugin --profile web add dsh-cad-design

After installation, the cad_doctor tool can be used to check the environment configuration and dependencies.

Configuration Example

The plugin configuration is located in the cordis.patch.yml file of the target profile. The following is a configuration snippet:

- insert:
    - id: cad-tools
      name: dsh-cad-design
      config:
        workDir: ''               # 默认为 <session cwd>/.dsh/cad
        timeoutSeconds: 120
        enableSkill: true
        backendPriority:          # 后端路由优先级
          - cadquery
          - ezdxf
        cadquery:
          enabled: true
          pythonPath: ''          # 留空则自动检测
        ezdxf:
          enabled: true
          pythonPath: ''

The environment variable DSH_CAD_PYTHON can also be used to override the default Python interpreter path.

Typical Usage

When a user issues a design instruction, the agent typically follows this workflow:

  1. Load the Skill: The agent loads the cadquery-design or ezdxf-drafting skill.
  2. Validate: Run cad_validate to validate the code and geometry results.
  3. Preview: Run cad_render to generate a preview image (PNG/SVG).
  4. Iterate: Adjust the code based on the preview until the design meets the requirements.
  5. Export: Run cad_export to export the file to STEP, DXF, or another supported format.

For example, if the user instruction is “Design an M8 hex-nut retainer, 3 mm wall, and export STEP”, the agent will complete the design following the steps above and output a retainer.step file.

Notes

  • Execution Permissions: The cad_* tools execute Python code locally. The plugin itself does not implement policy restrictions; when deployed in shared or untrusted environments, permission control should be combined with DSH’s tools/pre-execute hook.
  • Profile Requirement: Installing the plugin requires explicitly specifying --profile, and the profile must include an interface bundle (such as the web profile).
  • Ecosystem Distinction: There is another plugin named dsh-cad on npm, maintained by LAU-MARS. It is a CAD viewer plugin and is complementary to this plugin: this plugin is responsible for modeling and drafting, while that plugin is responsible for viewing models in the web interface.
  • Environment Requirements: Python 3.10+ and the corresponding pip packages (cadquery/ezdxf/matplotlib) are required.

Conclusion

dsh-cad-design brings parametric CAD capabilities into DSH agent workflows, enabling agents to move directly from code generation to manufacturing file output. For developers who need automated mechanical design pipelines, the plugin provides a complete toolchain from design to verification.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye