Skip to content

Creating Lego compatible bricks using FreeCAD and Python

License

Notifications You must be signed in to change notification settings

paulcobbaut/FreeCAD-Brick

Repository files navigation

FreeCAD-Brick

Creating Lego compatible bricks using FreeCAD and Python cover_20230518_all

What kind of (Lego-compatible) bricks?

Thousands of different regular bricks (any width, any length, any height) regular_brick_cad

Thousands of different corner bricks corner_brick_cad

Thousands of different bricks with a hole in the middle holed_brick_cad

Thousands of pockets (open boxes) with studs pocket_brick_cad

Thousands of slopes slopes_brick_cad

See also: https://www.printables.com/model/481897-different-bricks Video: https://youtu.be/ygqz-4S8DuU

How to use the Python scripts?

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:

  1. open the Python script in FreeCAD
  2. change the directory (folder) to your preferred export path
  3. run the script in FreeCAD
  4. Open the directory(folder) and find the .stl files

Export directory(folder)

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.

About

Creating Lego compatible bricks using FreeCAD and Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages