Meccano is a Python library for modeling and programmatically generate mechanical pieces inspired by the Meccano system, such as strips, plates, hinges, and springs. The project provides classes and utilities to create, extrude, and manage geometric and mechanical components programmatically.
Pieces can be exported to STL format for 3D printing or further processing in CAD software. The library is designed to be used with FreeCAD, a powerful open-source parametric 3D CAD modeler.
- Compatible with FreeCAD 1.0.2
- Define and extrude custom mechanical pieces
- Manage geometries and constraints
- Ensure you have Python 3.11+ installed.
- FreeCAD must be installed and accessible in your Python environment.
- Insall the library using uv:
uv pip install .
Import and use the library in your Python scripts:
import FreeCAD as App
from meccano.pieces.l_shaped import Hinge
# create a new FreeCAD document
app = App.newDocument()
# Define a meccano part
hinge= Hinge(n_rows_x=2, n_columns=2, n_rows_z=2).build(app)
doc.saveAs('hinge')
Parts or assemblies can be exported from FreeCAD in STL format using the mesh workbench, and further processed for 3d-printing. Here you see a screenshot from the CURA software:
meccano/
: Core librarysketch_geometry.py
: Geometry and measurements utilitiespieces/
: Mechanical piece classes (e.g., FlatStrip, Plate, Hinge, Spring)
test/
: Unit tests for the libraryrequirements.txt
: Python dependenciespyproject.toml
: Project metadata
Run tests using pytest:
pytest
All code is licensed under the Apache License 2.0. See the LICENSE file for details.