A collection of Python scripts for FreeCAD to generate 3D-printable objects.
Generates customizable rounded-rectangle keyring tags that automatically adapt their length to fit your text. Perfect for creating personalized keyrings via 3D printing.
Features:
- Auto-sizing tag length based on text width
- Rounded corners for printing
- Built-in hole for key rings
- Exports to 3MF format for slicing and printing
- Batch processing support
- Works in both CLI (headless) and GUI (macro) modes
Headless mode (CLI):
Using the keytag shell wrapper (Linux/macOS):
# Single tag
./keytag "MyText"
# Custom output file
./keytag "MyText" custom_output.3mf
# Batch processing
for text in Alice Bob Charlie; do
./keytag "$text"
doneOr directly with freecadcmd:
# Single tag
TAG="MyText" freecadcmd keyring_tag.py
# Custom output file
TAG="MyText" OUT="custom_output.3mf" freecadcmd keyring_tag.pyGUI Macro mode:
- Open FreeCAD
- Edit
TAG_TEXTvariable in the script to your desired text - Go to
Macro → Execute Macroand select this file - The output will be saved to
./keyrings/tag.3mf
Edit these variables in the script to adjust dimensions:
MIN_TAG_LENGTH = 30.0 # Minimum tag length in mm
TAG_WIDTH = 12.0 # Tag width in mm
TAG_THICK = 1.6 # Tag thickness in mm
CORNER_R = 3.0 # Rounded corner radius in mm
HOLE_DIA = 4.0 # Key ring hole diameter in mm
TEXT_SIZE = 6.0 # Font size in mm-
FreeCAD with Python 3 support (tested with FreeCAD 0.19+)
-
Font files: One of the following fonts must be installed:
- DejaVu Sans (recommended) - usually pre-installed on Linux
- Liberation Sans
- Free Sans
- Arial / Helvetica (macOS/Windows)
Most Linux distributions include DejaVu fonts by default. On macOS and Windows, system fonts are typically available.
The script creates output files in the following structure:
FreeCadScripts/
├── keyring_tag.py (this script)
├── keyrings/ (auto-created, contains output .3mf files)
│ ├── mytext.3mf
│ └── ...
└── README.md
Output files are created in the keyrings/ subdirectory relative to the script's location.
TAG- Text to display on the tag (default: "TAG")OUT- Output file path (default: auto-generated from tag text)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to fork, modify, and submit pull requests.
- FreeCAD
- Python 3.6+