﻿# CAD-Coder: from an image to CadQuery, with separate code and geometry checks

CAD-Coder produces editable CadQuery scripts. Understand its 100-example validity result, scale-normalized overlap and separate CAD execution stages.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/cad-coder-image-cadquery-validity-solid-metrics/
Language: en

## An image becomes an editable program

CAD-Coder generates CadQuery Python from an input image. Its output is a program describing a solid, rather than only a rendered preview or a textured mesh. That representation makes later inspection and editing possible, but does not establish that the inferred object has the dimensions or functional features required by an engineer.

The [paper](https://arxiv.org/html/2505.14646v1) fine-tunes a vision-language model using GenCAD-Code. Its reported 100% valid syntax rate applies to 100 test examples. Validity means scripts execute without errors; the reported best-aligned solid overlap is 0.675. Scale normalization and alignment are part of that overlap metric, so it does not verify absolute dimensions. Shape overlap is calculated over successful scripts.

## Dataset size and evaluated scope differ

The [dataset repository](https://github.com/anniedoris/GenCAD-Code) describes approximately 163k image/CadQuery pairs derived from DeepCAD and separately provides real photographs of printed objects. Its generation workflow converts existing CAD commands into scripts and connects those scripts to rendered images. These origins matter when deciding what a successful test says about an unfamiliar photograph.

A production assessment should separate familiar prismatic shapes from components whose function depends on hidden geometry. For example, a visually plausible housing can still have an incorrect internal cavity. That is an illustrative engineering failure mode, not a measured CAD-Coder result. A single image also cannot supply a reliable scale unless additional information establishes it. Record which requirements are visible, specified separately or unresolved.

## Code generation is only one execution stage

The [model repository](https://github.com/anniedoris/CAD-Coder) separates response generation, creation of CAD/STEP artifacts and geometric evaluation. Its instructions use distinct model and geometry environments because of dependency conflicts. The documented inference route targets the evaluation subset; live chat support remains listed as future work. Repository availability therefore should not be presented as a finished interactive CAD application.

For a local evaluation, preserve the original response, extracted script, execution outcome and exported artifact together. A missing import, geometry-kernel failure and geometrically wrong but executable solid are different outcomes. Counting only exported files would hide some of these distinctions. Generated Python also needs an execution policy appropriate to the environment; obtaining code from a model does not make its behavior self-validating.

## Generalization requires a separate check

The paper's experiments with unseen fillet operations expose a limitation: the original model failed, while a lower-learning-rate variant succeeded with a prescriptive prompt but was not robust to more abstract requests. This is narrower than broad competence with arbitrary CAD operations.

For a proposed use, assemble examples of the required operations and evaluate them independently. Inspect hole placement, wall thickness, connectivity and units against an explicit specification. Changing a prompt or model variant creates a new condition to document; it should not inherit an older validity score automatically.

## Match validation to the deliverable

The existing [shape-and-paint explanation](/journal/fg2-hunyuan3d2-shape-texture-dependency-boundary/) distinguishes geometry from appearance. CAD-Coder adds another boundary: editable source code must produce the intended solid. A pleasing preview is insufficient evidence of successful editing or dimensional correctness.

The [reproducible-stack guide](/journal/software-stack-reproducibility/) explains why exact model revisions and dependencies belong with results. For CAD-Coder, retain the CAD runtime and export settings as well. Useful evidence would report script success, geometric checks and manual corrections separately. That proposed report would show where image-to-code assistance saves work without turning the authors' small benchmark into a guarantee for manufacturing-ready designs.
