A code-driven approach to mechanical design without relying on GUI-based CAD workflows.
This repository explores a methodology for designing mechanical parts and assemblies
entirely through Python code using FreeCAD, focusing on:
| Language | GitHub Pages ๐ | GitHub ๐ป |
|---|---|---|
| ๐บ๐ธ English |
This repository explores a methodology for designing mechanical parts and assemblies
entirely through Python code using FreeCAD, focusing on reproducibility,
clarity of design intent, and automation.
๐ Persistent Identifier (DOI)
This work is published with a DOI via Zenodo (10.5281/zenodo.18134920)
and constitutes prior art for code-driven mechanical design methodologies.
Prototype fabrication โ machining โ dimensional measurement โ drawing.
Three-dimensional objects are projected onto two-dimensional drawings
using orthographic projection, and conversely, three-dimensional form
is reconstructed mentally from two-dimensional drawings.
This bidirectional translation constituted a core skill
for traditional mechanical designers.
From this perspective, it is understandable that
generative design or code-driven approachesโwhere the designer
does not directly manipulate geometryโcan feel intuitively
difficult to accept.
However, semiconductor layout design followed a similar trajectory.
There was a time when routing was performed manually,
with designers carefully accounting for process-specific behavior
based on experience and tacit knowledge.
As design rules were formalized and incorporated into PDKs,
the center of design activity shifted
from manual layout to logical description using Verilog.
Viewed in the context of technological history,
it may be unavoidable that mechanical design
will follow a comparable path.
Mechanical design should not be treated as a static artifact
(CAD data or drawings),
but as a reproducible, evolvable set of rules.
Full Code Mechanical Design shifts the core of mechanical design from
manual GUI operations to explicit, executable code.
In this approach:
This is not an efficiency improvement.
It is a structural transformation of mechanical design itself.
Once design logic is expressed as code,
there is no reason to return to GUI-driven workflows.
Traditional CAD workflows are heavily dependent on GUI operations,
feature histories, and constraint-based assemblies.
This project intentionally avoids those assumptions and adopts the following principles:
The goal is to preserve design intent and reproducibility directly in code.
This approach can be summarized as:
Mechanical Design as Code
โโ src/
โ โโ parts/ # Individual part generators (functions/modules)
โ โโ assembly/ # Assembly and layout definitions
โ โโ build.py # Entry point to generate the complete model
โโ README.md
โโ LICENSE
This repository includes a minimal working example that generates
a simple 3D mechanical model using FreeCAD in headless (non-GUI) mode.
โ ๏ธ Important
Do NOT use system Python.
You must use the Python interpreter bundled with FreeCAD.
cd src
"C:\Program Files\FreeCAD 0.21\bin\FreeCADCmd.exe" build.py
This will:
parts/assembly/.FCStd) as outputThe FreeCAD GUI is not required for model generation.
It may be used only to inspect the generated result.
cd src
freecadcmd build.py
This example is intentionally minimal.
Its purpose is not to demonstrate complex geometry,
but to prove that:
This repository currently focuses on defining the
conceptual and architectural principles
of Full Code Mechanical Design.
Python / FreeCAD implementation examples
will be added incrementally.
CAD is not a drawing tool.
It is an engine for executing design logic.
The following model was generated by running the provided Python code in FreeCAD
without any GUI-based modeling operations.
Figure 1. Mechanical assembly generated purely by Python code using FreeCAD as a geometry engine.
The following model demonstrates a purely geometric solid
generated from a continuous mathematical function,
without sketches, constraints, or GUI-based modeling steps.
Figure 2. A geometric solid generated from an explicit radius function
$r = f(z)$ using Python code and FreeCAD as a geometry engine.
This approach is directly analogous to modern SoC design workflows.
In this sense:
Full Code Mechanical Design is to mechanical engineering
what RTL is to SoC design.
By expressing geometry, constraints, and design decisions
entirely in code, mechanical design itself becomes
a reusable and evolvable intellectual property (IP).
The generated CAD model is only a byproduct.
The true asset is the executable design knowledge.
| Aspect | Conventional Workflow | Full Code Mechanical Design |
|---|---|---|
| Design authoring | GUI-based CAD operations | Python code |
| Dimensions | Fixed | Variables |
| Design intent | Implicit | Explicit |
| Design change | Manual edits | Logic change |
| Reusability | Low | High |
| Review | Drawings | Code + model |
| Scalability | Limited | High |
| Item | License | Description |
|---|---|---|
| Source Code | Apache License 2.0 | Free to use, modify, redistribute, with patent protection |
| Text Materials | CC BY 4.0 | Attribution required |
| Figures & Diagrams | CC BY-NC 4.0 | Non-commercial use only |
| Generated CAD Outputs | Same as source code | Derived from licensed code |
| External References | Original license applies | Cite properly |
This repository discloses a code-driven mechanical design methodology. The methodology itself is provided as prior art and may not be claimed as exclusive intellectual property by third parties.
This repository and its associated Zenodo record (DOI: 10.5281/zenodo.18134920) constitute a public disclosure of the Full Code Mechanical Design methodology.
Suggestions, improvements, and discussions are welcome via GitHub Discussions.