Skip to content

moritzmhmk/gridfinity-build123d

Repository files navigation

Gridfinity for build123d

This project provides a Python package to create Gridfinity compatible parts with build123d.

Installation

pip install git+https://github.com/moritzmhmk/gridfinity-build123d

Usage

Basic usage

For simple designs the Bin component can be used.

Basic bin

import gridfinity as gf

# A simple 1x1 bin with a height of 3 units
bin = gf.Bin(grid=[[True]], height=3*7)

1x1 Bin 1x1 Bin

Compartment

A negative volume can be provided to create a more complex compartment. For some common use cases the SubdividedCompartment from the extra module can be used.

import gridfinity as gf

# A 1x1 bin with a subdivided compartment with scoop and label
grid = [[True]]
compartment = gf.extra.SubdividedCompartment(
    grid,  # use same grid
    height=3*7-7,  # usually height of bin minus 1 unit
    div_x=1,
    div_y=2,
    with_label=True,
    scoops=["back"]
)
bin = gf.Bin(
    grid=grid,
    height=3*7,
    compartment=compartment
)

Negative volume and bin with compartment Negative volume and bin with compartment

Bin shape

The library allows for the definition of arbitrary shapes via the grid layout.

import gridfinity as gf

# Two odly shaped bins
grid_g = [
    [True, True, True],
    [True, False, True],
    [True, True, True],
    [False, False, True],
    [True, True, True],
]
grid_f = [
    [True, True, True],
    [True],
    [True, True],
    [True],
    [True],
]
bin_g = gf.Bin(grid=grid_g, height=3*7)
bin_f = gf.Bin(grid=grid_f, height=3*7)

Bins with irregular shape Bins with irregular shape

Advanced usage

For more complex use cases creating a custom component from the building blocks might be necessary.

import build123d as bd
import gridfinity as gf

grid = [[True]]
height = 3*7
base = gf.Base(grid=grid)
grid_sketch = bd.extrude(gf.GridSketch(grid, inset=0.25), 7)
stacking_lip = gf.StackingLip(grid=grid)

Gridfinity Parts Gridfinity Parts

Every building block has a grid argument to define its shape.

...
grid = [[True], [True, True]]
...

Gridfinity Parts Gridfinity Parts

Example scripts

Scripts for the creation of some parametric designs can be found in the examples folder.

Screw holes

Each design must be published in many variations when holes for screws, magnets or other modifications are added into the design. It makes more sense to publish each design as it is (while ensuring that the lower 7mm are not used for the inner compartment).

Possible modifications, e.g. for screws, can then be added in the slicer as a negative volume. Only one such negative volume is required for each grid layout and can be reused for all designs.

An example of how to create negative volumes for screws can be found in the examples folder.

Of course, it is still possible to add screw holes directly to the design with this library, but it is not recommended and therefore not actively supported.

About

Python package to create Gridfinity compatible parts with build123d.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages