Skip to content

caid-technologies/Printability

Repository files navigation

Printability

Upload a CAD drawing. Get back a verdict: can it be made? If not, here is exactly what to fix.


Introduction

Every CAD design carries a hidden question: can this actually be made?

The answer often comes too late — when a print fails, a part is scrapped, or a manufacturer sends it back. A wall too thin. A hole too small. An overhang the printer cannot support. These issues are entirely predictable, and catching them early saves significant time, material, and cost.

Printability catches them before the machine ever starts.

It takes a three-view CAD drawing and DXF geometry file, runs them through a two-stage AI pipeline, and returns one of three verdicts: PASS, REVIEW, or FAIL. If the design fails, it does not just say what is wrong — it generates a fix pack with the exact parametric correction to apply. Thicken this wall to 1.2mm. Enlarge this hole to 12mm. Add supports at 45 degrees here.

The system supports seven manufacturing processes — from CNC machining and sheet metal to FDM, SLA, SLS, and SLM additive manufacturing. Each process has its own geometric thresholds, engineering standards, and failure modes built into the rules engine.

The pipeline is rule-driven, config-driven, and fully reproducible. Labels are generated programmatically from geometric analysis of DXF files — no manual annotation at any stage.

Printability is built for engineers, makers, and manufacturers who want to catch design problems early and fix them fast.


System Design

Input: orthographic view image (front / side / top) + DXF file
                        |
                        v
         +-----------------------------+
         |   DXF Feature Extractor     |
         |                             |
         |  Parse: LINE ARC CIRCLE     |
         |  LWPOLYLINE entities        |
         |  Extract: wall thickness,   |
         |  hole diameters, arc radii, |
         |  entity density, bbox area  |
         |  Unit normalisation to mm   |
         +-------------+---------------+
                        |
                        v
         +-----------------------------+
         |   POI1 — Stage 1 Model      |
         |                             |
         |  Multimodal fusion:         |
         |  image branch + DXF branch  |
         |  25+ geometric rules        |
         |  Engineering standards      |
         |                             |
         |  Critical hit  -> FAIL      |
         |  Score >= 2    -> FAIL      |
         |  Score = 1     -> REVIEW    |
         |  Score = 0     -> PASS      |
         +-------------+---------------+
                        |
           +------------+------------+
           |                         |
           v                         v
      [ PASS ]               [ REVIEW / FAIL ]
      Done.                          |
                                     v
                    +-----------------------------+
                    |   POI2 — Stage 2 Model      |
                    |                             |
                    |  ResNet-18 fine-tuned       |
                    |  Defect classification      |
                    |  on REVIEW and FAIL only    |
                    |                             |
                    |  OVERHANG_SUPPORT           |
                    |  THIN_WALL                  |
                    |  MIN_FEATURE                |
                    |  CLEARANCE                  |
                    |  TOLERANCE                  |
                    |  THERMAL_WARPING            |
                    |  LAYER_SHIFT_STRINGING      |
                    +-------------+---------------+
                                  |
                                  v
                    +-----------------------------+
                    |   Fix-Pack Generator        |
                    |                             |
                    |  fix_map.yaml lookup        |
                    |  Visual defect overlay      |
                    |  JSON correction report     |
                    |  Parametric fix applied     |
                    +-----------------------------+

POI1 — Stage 1

POI1 is the primary classification stage. It runs on every design and determines whether it is manufacturable.

Model Architecture

POI1 is a multimodal fusion model that processes the tri-view image and DXF geometry simultaneously.

Image branch
  Input: tri-view PNG (224 x 224, RGB, ImageNet normalised)
  Conv2d(3, 32, 3, stride=2) -> ReLU
  Conv2d(32, 64, 3, stride=2) -> ReLU
  AdaptiveAvgPool2d(1, 1)
  Flatten -> 64-dim image embedding

DXF branch
  Input: 512 tokens x 8 dims per file
  Token format: [type, x1, y1, x2, y2, radius, angle_start, angle_end]
  Entity types: LINE=1  CIRCLE=2  ARC=3  LWPOLYLINE=4
  Coordinates normalised to [0, 1] on bounding box
  Zero-padded to 512 tokens
  Mean pool over valid tokens
  Linear(8, 64) -> ReLU -> Linear(64, 128) -> ReLU
  128-dim DXF embedding

Fusion head
  Concat [64-dim image, 128-dim DXF] -> 192-dim
  Linear(192, 128) -> ReLU
  Linear(128, 3)
  Output: PASS=0  REVIEW=1  FAIL=2

Rules Engine

25+ geometric rules defined in rules/triview_rules_v1_0.yaml across 7 manufacturing profiles:

MP      Machined Parts
SM      Sheet Metal
IM      Injection Moulding
AP-FDM  Additive — Fused Deposition Modelling
AP-SLA  Additive — Stereolithography
AP-SLS  Additive — Selective Laser Sintering
AP-SLM  Additive — Selective Laser Melting

Geometric rules:

Rule ID Severity Description
A1_parse_ok critical DXF must parse without error and be non-empty
A2_no_degenerate critical No zero-length segments, NaNs, or self-intersections
A3_overlap_cleanup major No overlapping or duplicate entities above tolerance
A5_closed_loops major Closed profiles must close within tolerance
A6_unit_sanity major INSUNITS resolved and scale plausible
C1_iso273_clearance major Clearance holes near ISO 273 series
C2_iso286_fits major Hole and shaft fits coherent
D1_wall_min major Minimum wall thickness per profile
D2_hole_min major Minimum hole diameter per profile
E1_tiny_arc_limit minor Arc radii above profile minimum
E2_density_tail major Entity density not above calibrated p95 tail
G_AP_overhang major Overhang angle within profile maximum

Classification policy:

Any critical rule hit   ->  FAIL
Weighted score >= 2     ->  FAIL
Weighted score = 1      ->  REVIEW
Weighted score = 0      ->  PASS

Severity weights:  critical=5  major=3  minor=1

Profile thresholds:

Profile wall_min_mm hole_min_mm overhang_deg_max
MP 0.5 0.8
IM 1.2
AP-FDM 1.2 11.6 45
AP-SLA 0.8 0.6
AP-SLS 1.0 0.8
AP-SLM 0.8 0.8 45

Engineering Standards Checks

POI1 validates each design against international manufacturing standards using values from metadata.json:

Standard Field Threshold
ISO 10303 / ASME Y14.5 units mm only
ISO 286-1 scale 0.95 to 1.05
ASTM F2921-11 / ISO 52921 default_tolerance_mm 0.05 to 0.50 mm
ASTM F2921-11 / Stratasys min_clearance_mm >= 0.20 mm

DXF Feature Extractor

Parses raw DXF files using ezdxf. All coordinates normalised to millimetres using the DXF INSUNITS header.

Feature Description
parsed_ok DXF parsed without error
entities Total entity count
lines / arcs / circles / lwpolylines Entity type breakdown
zero_length_segments Degenerate geometry count
hole_diameters_mm All circle diameters in mm
tiny_arc_min_r Smallest arc radius in mm
total_len_mm Sum of all edge lengths
area_mm2 Bounding box area
density_entities_per_mm2 Geometric complexity density

Training Configurations

Config Epochs Batch LR Notes
config_small.yaml 2 32 0.001 Sanity check
config.yaml 10 32 0.001 Standard
config_master.yaml 1 8 0.0003 Mixed precision, MPS

Best checkpoint: runs/master_v1/model_best.pt


POI2 — Stage 2

POI2 runs only on designs flagged by POI1 as REVIEW or FAIL. It identifies the specific defect type and routes it to the fix-pack generator.

Model Architecture

ResNet-18 fine-tuned from ImageNet weights. Image-only input. The OTHER class is excluded from training — every prediction is a specific actionable defect.

Input: tri-view PNG (224 x 224, ImageNet normalised)
RandomHorizontalFlip augmentation during training
ResNet-18 backbone
Output: defect class

Defect Categories

Defined in rules/defects_po2_v1.yaml:

Defect Description
OVERHANG_SUPPORT Unsupported geometry exceeding profile angle maximum
THIN_WALL Wall below minimum printable thickness
MIN_FEATURE Feature below minimum printable resolution
CLEARANCE Insufficient clearance between adjacent features
TOLERANCE Dimensions outside manufacturable tolerance band
THERMAL_WARPING Geometry prone to warping from thermal gradients
LAYER_SHIFT_STRINGING Geometry prone to layer shift or stringing defects

Training Configuration

batch_size:  16
epochs:      5
train split: 80%
val split:   10%
test split:  10%
device:      mps

Results

From demo_bundle_v2/metrics/poi2_eval.json:

Metric Value
Total samples evaluated 5,743
Agreement rate 74.3%
Mean confidence 0.741
Median confidence 0.741
REVIEW samples 1,476
FAIL samples 4,267

Fix-Pack Generator

Every defect identified by POI2 is mapped to a concrete parametric fix from rules/fix_map.yaml:

Rule Fix Action Parameters
D2_hole_min Enlarge holes min_diameter_mm: 12.0
A1_tiny_arc_r_mm Increase fillet radius min_radius_mm: 3.0
O1_overhang_max Add tree supports max_angle_deg: 45
W1_thin_wall Thicken wall min_mm: 1.2
C1_clearance_min Increase clearance min_mm: 0.3
B1_bridge_len_max Add ribs every_mm: 20, rib_thickness_mm: 2.0
S1_slot_width_min Widen slot min_mm: 0.6
F1_text_size_min Enlarge text min_height_mm: 3.0, min_stroke_mm: 0.6
fallback_fail Add auto supports type: auto
fallback_review Round sharp edges min_radius_mm: 0.8

Dataset

Split Samples
Train 21,600
Val 2,700
Test 2,700
Total 27,000

Split method: deterministic SHA-256 hashing on sample ID. Labels generated programmatically by the rules engine — no manual annotation.


Demo

cd demo_bundle_v2
streamlit run app/app.py

Shows for each sample: original input, repaired output, defect overlay, side-by-side comparison, POI2 recommendations, and evaluation metrics.

Sample IDs: 100041, 100063, 100129


Project Structure

cad_intel/
  code/
    model_def.py                         POI1 fusion model architecture
    poi1_dataloader.py                   Dataset and DataLoader for POI1
    dxf_feature_extractor.py             DXF geometric feature extraction
    dxf_to_mesh.py                       DXF to mesh conversion
    label_from_rules_v2.py               Rule-based label generation
    enrich_labels.py                     Label enrichment pipeline
    make_labels.py                       Batch label generation
    split.py                             Train / val / test split
    validate_pairs.py                    Image-DXF pair integrity check
    rules_loader.py                      YAML rule engine loader
    poi1_extra_checks_with_standards.py  Engineering standard checks
    test_pipeline_one.py                 End-to-end pipeline test
    poi2/
      build_labels_po2_v2.py             POI2 label construction
      poi1_to_handoff.py                 POI1 to POI2 handoff
      poi2_train.py                      POI2 training script
  rules/
    triview_rules_v1_0.yaml              25+ geometric rules
    defects_po2_v1.yaml                  POI2 defect definitions
    fix_map.yaml                         Defect to fix mapping
  dataset/triview_20K/
    images/  dxf/
    labels.csv  labels_rules.csv  labels_enriched.csv
    label_map.csv
    train.txt  val.txt  test.txt
    metadata.json
  train_master.py
  train_master_progress.py
  config_master.yaml  config.yaml  config_small.yaml  config_poi2.yaml
  demo_bundle_v2/
    app/app.py
    inputs/  repaired/  overlays/  previews2d/  poi2/
    metrics/
      poi2_confusion.csv
      poi2_eval.json

Environment Setup

conda create -n cadintel python=3.10
conda activate cadintel
conda install pytorch torchvision -c pytorch
pip install ezdxf pyyaml numpy pillow pandas matplotlib tqdm streamlit shapely trimesh

python -c "import torch; print('MPS:', torch.backends.mps.is_available())"

Training

POI1:

python train_master.py --config config_master.yaml --save runs/exp1

POI2:

cd code/poi2
python poi2_train.py --labels <labels_csv> --images_dir <images_dir> --out_dir <out_dir>

Citation

@misc{priya2026cadintel,
  title     = {Cadintel: AI-Native CAD Printability Intelligence and Fix-Pack Generation},
  author    = {Priya, Shreya},
  year      = {2026},
  publisher = {CAID Technologies},
  url       = {https://github.com/caid-technologies/Cadintel}
}

Caid Technologies Shreya Priya — Robotics Engineer & Researcher

About

CAD printability analysis

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors