# Can Patent-Disclosure-Skill Generate Patent Drawings from CAD Files?

> Explore patent-disclosure-skill's capabilities in generating patent drawings from CAD files. Understand how it aids AI line-art creation, not direct conversion.

- Repository: [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill)
- Tags: how-to-guide
- Published: 2026-09-05

---

**`patent‑disclosure‑skill` can read CAD files and produce orthographic projections to guide AI line‑art generation, but it does not convert CAD geometry directly into final patent drawings.**

The `handsomestWei/patent-disclosure-skill` repository provides a structured workflow for handling CAD assets during patent preparation. While it extracts and visualizes 3D geometry from native CAD files and STEP exports, the system explicitly treats these outputs as **reference material only**—never as the line‑art required for formal patent disclosures.

## How CAD File Handling Works in Patent-Disclosure-Skill

The skill implements a five-stage pipeline that strictly separates CAD processing from final image generation. Each stage enforces the boundary between raw geometry and disclosure-ready drawings.

### Stage 1: CAD File Detection and Scanning

The [`cad_scan.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cad_scan.py) tool walks the project directory tree to identify native CAD formats and STEP files. It generates a JSON hint file that guides downstream decisions.

```bash
python -m skills.patent-disclosure.tools.cad_scan \
    -r /path/to/project \
    --output cad_scan.json

```

In [`skills/patent-disclosure/tools/cad_scan.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/cad_scan.py), the scanner detects extensions like `.sldprt` and `.ipt` alongside standard `.step` or `.stp` files. The output JSON contains entries such as:

```json
{"path": "part.step", "kind": "cad", "action": "hint_export_step"}

```

This hint tells the agent whether STEP conversion is needed before proceeding.

### Stage 2: Optional STEP-to-View Conversion

When CAD file generation from STEP is enabled, [`step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/step_to_views.py) renders 2‑D orthographic projections. These outputs are explicitly tagged with `kind: cad` to prevent downstream misclassification.

```bash
python -m skills.patent-disclosure.tools.step_to_views \
    --input part.step \
    --output views/

```

The source code at [`skills/patent-disclosure/tools/step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/step_to_views.py) generates PNG/SVG projections but **never marks them as line‑art**. This distinction is critical: CAD views serve as visual references, not disclosure artifacts.

### Stage 3: Isolated CAD Environment Bootstrap

To avoid polluting the host system with heavy CAD dependencies, [`bootstrap_cad_venv.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/bootstrap_cad_venv.py) prepares a lightweight isolated Python virtual environment. Installation of CAD libraries requires explicit user authorization.

Source: [`skills/patent-disclosure/tools/bootstrap_cad_venv.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/bootstrap_cad_venv.py)

This opt‑in design ensures that users only incur CAD tooling costs when actively working with native geometry.

### Stage 4: Image Generation with CAD Scoring

The [`image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/image_gen.py) pipeline determines how each source contributes to final drawings. Its decision logic distinguishes three source types:

- **`kind: lineart`** — Clean line drawings used directly in disclosures
- **`kind: cad`** — CAD projections scored and optionally fed to `img2img` as guidance
- **Fallback** — Text‑to‑image (`txt2img`) when no suitable visuals exist

```bash
python -m skills.patent-disclosure.tools.image_gen \
    --config figure_plan.yaml \
    --sources cad_scan.json

```

In [`skills/patent-disclosure/tools/image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/image_gen.py), CAD projections may influence the generated line‑art through an image‑to‑image diffusion step, but they are **never inserted as final drawings**.

### Stage 5: Gatekeeping Enforcement

Two dedicated gatekeeper modules enforce the hard rule that **CAD cannot become line‑art**:

- [`design_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/design_lineart_gate.py) — Blocks `use_in_disclosure: true` for design figure candidates
- [`structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_gate.py) — Blocks `use_in_disclosure: true` for structural/schematic candidates

Both modules implement identical validation logic:

```python

# From tools/design_lineart_gate.py

if source.kind == "cad" and source.use_in_disclosure:
    raise ValueError("CAD projections cannot be used as line-art in disclosures")

```

This policy is documented at [`skills/patent-disclosure/prompts/image_gen.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/image_gen.md), which explicitly states that `kind: cad` images are never treated as disclosure line‑art.

## What Patent-Disclosure-Skill Actually Delivers

Understanding the boundary between CAD processing and final output helps set accurate expectations:

| Capability | Status | Notes |
|:-----------|:-------|:------|
| Read native CAD files (SolidWorks, Inventor, etc.) | ✅ Supported | Via [`cad_scan.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cad_scan.py) detection |
| Export/parse STEP geometry | ✅ Supported | Via [`step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/step_to_views.py) |
| Generate 2‑D orthographic views from CAD | ✅ Supported | PNG/SVG projections with `kind: cad` tag |
| Produce AI-guided line‑art influenced by CAD | ✅ Supported | Via `img2img` scoring in [`image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/image_gen.py) |
| **Direct CAD-to-patent-drawing conversion** | ❌ **Not supported** | Explicitly blocked by gatekeepers |

The system is architected to **extract CAD geometry for reference purposes** while mandating that final patent drawings originate from AI generation pipelines.

## When to Use CAD Files with Patent-Disclosure-Skill

- **Use CAD as visual reference** when describing complex 3D shapes in disclosure text
- **Enable STEP parsing** when orthographic views help the AI understand spatial relationships
- **Expect AI-generated line‑art** regardless of CAD input quality

The workflow assumes that patent drawings require cleaned, standardized line‑art that automated CAD projection cannot guarantee. Gatekeepers enforce this standard by construction.

## Limitations and Design Rationale

The explicit prohibition against direct CAD-to-line‑art conversion stems from patent office requirements:

- **Line weight and styling** — Patent figures require consistent, regulation-compliant strokes
- **Annotation handling** — CAD metadata (dimensions, part numbers) must be removed or standardized
- **Claim correspondence** — Drawings must align precisely with claim language, not engineering geometry

By routing all final images through `img2img` or `txt2img` pipelines, the skill maintains human‑reviewable control over these compliance factors.

## Summary

- **Patent-disclosure-skill reads CAD files** through [`cad_scan.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cad_scan.py) and optional STEP parsing
- **Orthographic views are generated** by [`step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/step_to_views.py) but tagged as `kind: cad`
- **Gatekeepers block CAD from becoming line‑art** in both design and structure pipelines
- **Final drawings are AI-generated** via `img2img` or `txt2img`, with CAD serving as scored reference material only
- The architecture intentionally prevents direct CAD-to-patent-drawing conversion to ensure compliance and quality control

## Frequently Asked Questions

### Can I upload a SolidWorks file and get patent drawings automatically?

No. The skill will scan `.sldprt` files and can generate 2‑D views if you enable STEP parsing, but you cannot use those views directly as patent drawings. The system requires running the AI image generation pipeline ([`image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/image_gen.py)) to produce final line‑art, with CAD serving as reference material only.

### What happens if I try to mark a CAD projection as final line‑art?

The gatekeeper modules ([`design_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/design_lineart_gate.py) and [`structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_gate.py)) will raise a `ValueError` with the message "CAD projections cannot be used as line‑art in disclosures." This enforcement is automatic and cannot be bypassed through configuration.

### Why doesn't the skill convert CAD directly to patent-ready line‑art?

Patent drawings must meet specific regulatory standards for line weight, annotation, and claim correspondence that automated CAD projection cannot guarantee. The architecture prioritizes AI-generated line‑art with human-reviewable pipelines over direct CAD conversion that might produce non-compliant figures.

### What CAD formats are supported for reference extraction?

The [`cad_scan.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cad_scan.py) tool detects native formats including SolidWorks (`.sldprt`, `.sldasm`), Autodesk Inventor (`.ipt`, `.iam`), and standard STEP (`.step`, `.stp`) files. Actual geometry processing requires STEP conversion, as native CAD formats are only flagged for export hints rather than parsed directly.