Creating Lego compatible bricks using FreeCAD and Python
Thousands of different regular bricks (any width, any length, any height)
Thousands of different corner bricks
Thousands of different bricks with a hole in the middle
Thousands of pockets (open boxes) with studs
See also: https://www.printables.com/model/481897-different-bricks Video: https://youtu.be/ygqz-4S8DuU
There are some sample .stl files attached here, but the main idea is to run one of the Python scripts to generate the exact .stl files that you want.
In short:
- open the Python script in FreeCAD
- change the directory (folder) to your preferred export path
- run the script in FreeCAD
- Open the directory(folder) and find the .stl files
This is a must do or you get an error!!! This is a must do or you get an error!!! This is a must do or you get an error!!!
Somewhere around line 37 to 41 in the scripts there are lines like this:
### The directory to export the .stl files to
export_directory = "/home/paul/FreeCAD/generated_bricks/"
This is the location where the .stl files are written on your computer. This directory (or folder) must already exist before running the script!
You probably need to change this, for example (MS Windows, Ubuntu, Mac): export_directory = "C:" export_directory = "/home/bob" export_directory = "/Users/Alice"
Test that this works before changing the Python script.