# How to Build Projects with text-to-cad: Examples and Templates Explained

> Explore text-to-cad project examples and templates. Generate industrial-grade STEP, STL, and GLB files using Python scripts from the earthtojake/text-to-cad repository.

- Repository: [earthtojake/text-to-cad](https://github.com/earthtojake/text-to-cad)
- Tags: examples-and-templates
- Published: 2026-09-13

---

**The earthtojake/text-to-cad repository ships with a collection of runnable example models and a complete project scaffold that demonstrates how to generate industrial-grade STEP, STL, and GLB files from pure Python scripts.**

The earthtojake/text-to-cad open-source framework enables engineers to author parametric CAD parts using Python code rather than traditional GUI-based modeling. To accelerate adoption, the repository includes concrete **projects built with text-to-cad**, ranging from standalone mechanical components to complex multi-part assemblies with automated build pipelines.

## Running the Example Model Collection

The `models/examples/src/` directory contains a curated library of standalone part scripts that execute immediately without configuration. According to the catalog in [`models/examples/src/README.md`](https://github.com/earthtojake/text-to-cad/blob/main/models/examples/src/README.md), these scripts demonstrate the typical workflow for a text-to-cad part by generating multiple artifact formats from a single execution.

Each example—such as [`mounting_plate.py`](https://github.com/earthtojake/text-to-cad/blob/main/mounting_plate.py), [`cam_follower_roller.py`](https://github.com/earthtojake/text-to-cad/blob/main/cam_follower_roller.py), and [`spur_gear.py`](https://github.com/earthtojake/text-to-cad/blob/main/spur_gear.py)—produces **STEP**, **STL**, **3MF**, and **GLB** files in the project root directories. These outputs illustrate how the framework handles industrial-grade geometry exchange formats alongside web-ready meshes.

```bash

# Build a single mechanical part from the examples collection

python models/examples/src/mounting_plate.py

# Verify the generated artifacts in respective folders

ls STEP/mounting_plate.step
ls STL/mounting_plate.stl
ls GLB/mounting_plate.glb

```

## Creating Multi-Part Assemblies with the Project Scaffold

For **projects built with text-to-cad** that require assembly logic, the repository provides a full project template at [`skills/cad/references/project-template.md`](https://github.com/earthtojake/text-to-cad/blob/main/skills/cad/references/project-template.md). This scaffold defines a minimal yet fully functional layout including source scripts, a helper library, `.gitignore`, `.gitattributes`, and dedicated directories for generated artifacts.

The template demonstrates hierarchical composition: a root [`src/assembly.py`](https://github.com/earthtojake/text-to-cad/blob/main/src/assembly.py) script imports sub-assemblies (plate, frame, brackets) and generates a unified STEP file representing the complete mechanical system. This structure shows how parts reference shared helpers and how the build system automatically manages output directories.

```bash

# Create a new project from the scaffold template

cp -r skills/cad/references/project-template.md my_project/
cd my_project

# Install the text-to-cad runtime in editable mode

pip install -e .

# Build the full assembly (plate → frame → brackets)

python src/assembly.py

# Generate a visual snapshot of the resulting STEP file

cadgen step snapshot STEP/assembly.step tmp/assembly.png

```

## Generating CAD Artifacts from Python Scripts

The text-to-cad build system relies on Python decorators and explicit export functions to transform code into geometry. In the project template, individual part definitions use the `@step` decorator to register exportable geometry, while assembly scripts orchestrate multiple components into unified files.

Running any script in the examples or scaffold automatically creates organized output directories:
- `STEP/` for precise B-Rep geometry suitable for manufacturing
- `DXF/` for 2D profile exports
- `STL/` and `GLB/` for additive manufacturing and visualization pipelines

The framework handles file versioning and binary management through `.gitattributes` configurations, ensuring that imported source files remain in version control while generated binaries are correctly tracked via Git LFS or excluded entirely.

## Summary

- **Example models** in `models/examples/src/` provide standalone scripts (mounting plates, gears, rollers) that generate STEP, STL, 3MF, and GLB files immediately upon execution.
- **Project scaffold** at [`skills/cad/references/project-template.md`](https://github.com/earthtojake/text-to-cad/blob/main/skills/cad/references/project-template.md) offers a complete multi-part assembly template with helper libraries, assembly scripts, and Git configuration.
- **Build workflow** involves running Python scripts directly (e.g., `python src/assembly.py`) to produce organized artifact directories without manual CAD software interaction.
- **Code-driven geometry** uses decorators like `@step` to define exportable parts, enabling version-controlled parametric design.

## Frequently Asked Questions

### What types of CAD files can text-to-cad projects generate?

According to the earthtojake/text-to-cad source code, projects can generate **STEP** files for precision manufacturing, **DXF** files for 2D profiles, and mesh formats including **STL**, **3MF**, and **GLB** for additive manufacturing and web visualization. The example scripts in [`models/examples/src/mounting_plate.py`](https://github.com/earthtojake/text-to-cad/blob/main/models/examples/src/mounting_plate.py) demonstrate outputting all four formats simultaneously.

### How do I run a single example part in text-to-cad?

Execute any Python script in the `models/examples/src/` directory directly from the command line. For example, running `python models/examples/src/mounting_plate.py` triggers the build system, which calculates geometry and writes files to `STEP/`, `STL/`, `3MF/`, and `GLB/` directories in your project root without requiring additional configuration.

### Where is the project template for multi-part assemblies located?

The complete project scaffold is documented in [`skills/cad/references/project-template.md`](https://github.com/earthtojake/text-to-cad/blob/main/skills/cad/references/project-template.md). This file defines the directory structure, helper library patterns, and the root [`src/assembly.py`](https://github.com/earthtojake/text-to-cad/blob/main/src/assembly.py) script that composes sub-assemblies into unified CAD files. You can copy this template to initialize new text-to-cad projects with proper Git attributes and build conventions.

### What is the purpose of the @step decorator in text-to-cad projects?

The `@step` decorator, as implemented in the project template's [`src/plate.py`](https://github.com/earthtojake/text-to-cad/blob/main/src/plate.py), marks Python functions that return geometry intended for STEP file export. This declarative approach allows the build system to identify exportable parts automatically, ensuring that running `python src/assembly.py` correctly serializes each component into the appropriate CAD format while maintaining parametric relationships between parts.