2022-10-03 00:35:03 +00:00
include < gridfinity-rebuilt-utility.scad >
2022-11-17 19:58:46 +00:00
// ===== INFORMATION ===== //
2022-10-03 00:35:03 +00:00
/*
IMPORTANT : rendering will be better for analyzing the model if fast - csg is enabled . As of writing , this feature is only available in the development builds and not the official release of OpenSCAD , but it makes rendering only take a couple seconds , even for comically large bins . Enable it in Edit > Preferences > Features > fast - csg
the magnet holes can have an extra cut in them to make it easier to print without supports
tabs will automatically be disabled when gridz is less than 3 , as the tabs take up too much space
base function s can be found in "gridfinity-rebuilt-utility.scad"
examples at end of file
BIN HEIGHT
the original gridfinity bins had the overall height defined by 7 mm increments
a bin would be 7 * u millimeters tall
the lip at the top of the bin ( 3.8 mm ) added onto this height
The stock bins have unit heights of 2 , 3 , and 6 :
Z unit 2 - > 7 * 2 + 3.8 - > 17.8 mm
Z unit 3 - > 7 * 3 + 3.8 - > 24.8 mm
Z unit 6 - > 7 * 6 + 3.8 - > 45.8 mm
https : //github.com/kennetek/gridfinity-rebuilt-openscad
* /
2022-11-17 19:58:46 +00:00
// ===== PARAMETERS ===== //
2022-10-03 00:35:03 +00:00
/* [Setup Parameters] */
$fa = 8 ;
$fs = 0.25 ;
/* [General Settings] */
// number of bases along x-axis
2024-01-06 12:18:55 +00:00
gridx = 3 ;
2023-09-22 06:11:23 +00:00
// number of bases along y-axis
2024-01-06 12:18:55 +00:00
gridy = 2 ;
2023-09-22 06:11:23 +00:00
// bin height. See bin height information and "gridz_define" below.
2023-05-31 15:46:30 +00:00
gridz = 6 ;
2022-10-03 00:35:03 +00:00
2023-10-23 19:38:02 +00:00
/* [Linear Compartments] */
2023-02-17 17:23:59 +00:00
// number of X Divisions (set to zero to have solid bin)
2023-10-23 19:38:02 +00:00
divx = 0 ;
// number of Y Divisions (set to zero to have solid bin)
divy = 0 ;
/* [Cylindrical Compartments] */
// number of cylindrical X Divisions (mutually exclusive to Linear Compartments)
cdivx = 0 ;
// number of cylindrical Y Divisions (mutually exclusive to Linear Compartments)
cdivy = 0 ;
// orientation
c_orientation = 2 ; // [0: x direction, 1: y direction, 2: z direction]
2023-10-25 18:58:55 +00:00
// diameter of cylindrical cut outs
cd = 10 ;
2023-10-23 19:38:02 +00:00
// cylinder height
2023-10-25 18:58:55 +00:00
ch = 1 ;
// spacing to lid
c_depth = 1 ;
2024-02-03 21:49:44 +00:00
// chamfer around the top rim of the holes
c_chamfer = 0.5 ;
2022-10-03 00:35:03 +00:00
2023-02-14 22:12:45 +00:00
/* [Height] */
// determine what the variable "gridz" applies to based on your use case
gridz_define = 0 ; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
// overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
2023-09-22 06:11:23 +00:00
height_internal = 0 ;
2022-10-03 00:35:03 +00:00
// snap gridz height to nearest 7mm increment
enable_zsnap = false ;
2023-02-14 22:12:45 +00:00
/* [Features] */
2022-10-03 00:35:03 +00:00
// the type of tabs
style_tab = 1 ; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
2023-02-14 22:12:45 +00:00
// how should the top lip act
style_lip = 0 ; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height]
2023-09-22 06:11:23 +00:00
// scoop weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop.
2023-02-14 17:04:53 +00:00
scoop = 1 ; //[0:0.1:1]
2023-02-17 17:23:59 +00:00
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
2023-03-20 17:48:28 +00:00
only_corners = false ;
2022-10-03 00:35:03 +00:00
/* [Base] */
2024-04-14 18:28:12 +00:00
style_hole = 4 ; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: Gridfinity Refined hole - no glue needed, 5: Magnet hole with crush ribs]
2022-10-03 00:35:03 +00:00
// number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division)
div_base_x = 0 ;
// number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division)
2023-09-22 06:11:23 +00:00
div_base_y = 0 ;
2022-10-03 00:35:03 +00:00
2022-11-17 19:58:46 +00:00
// ===== IMPLEMENTATION ===== //
2022-10-03 00:35:03 +00:00
2023-02-14 16:56:15 +00:00
color ( "tomato" ) {
2024-01-30 09:35:29 +00:00
gridfinityInit ( gridx , gridy , height ( gridz , gridz_define , style_lip , enable_zsnap ) , height_internal , sl = style_lip ) {
2023-02-14 16:56:15 +00:00
2023-10-23 19:38:02 +00:00
if ( divx > 0 && divy > 0 ) {
2024-01-06 16:37:37 +00:00
2023-10-23 19:38:02 +00:00
cutEqual ( n_divx = divx , n_divy = divy , style_tab = style_tab , scoop_weight = scoop ) ;
2024-01-06 16:37:37 +00:00
2023-10-23 19:38:02 +00:00
} else if ( cdivx > 0 && cdivy > 0 ) {
2024-01-06 16:37:37 +00:00
2024-02-09 08:18:44 +00:00
cutCylinders ( n_divx = cdivx , n_divy = cdivy , cylinder_diameter = cd , cylinder_height = ch , coutout_depth = c_depth , orientation = c_orientation , chamfer = c_chamfer ) ;
2023-10-23 19:38:02 +00:00
}
2023-02-14 16:56:15 +00:00
}
2023-05-31 17:01:00 +00:00
gridfinityBase ( gridx , gridy , l_grid , div_base_x , div_base_y , style_hole , only_corners = only_corners ) ;
2023-02-14 16:56:15 +00:00
}
2022-10-03 00:35:03 +00:00
2022-11-17 19:58:46 +00:00
// ===== EXAMPLES ===== //
2022-10-03 00:35:03 +00:00
// 3x3 even spaced grid
/*
gridfinityInit ( 3 , 3 , height ( 6 ) , 0 , 42 ) {
2023-02-14 22:12:45 +00:00
cutEqual ( n_divx = 3 , n_divy = 3 , style_tab = 0 , scoop_weight = 0 ) ;
2022-10-03 00:35:03 +00:00
}
gridfinityBase ( 3 , 3 , 42 , 0 , 0 , 1 ) ;
* /
2023-09-22 06:11:23 +00:00
// Compartments can be placed anywhere (this includes non-integer positions like 1/2 or 1/3). The grid is defined as (0,0) being the bottom left corner of the bin, with each unit being 1 base long. Each cut() module is a compartment, with the first four values defining the area that should be made into a compartment (X coord, Y coord, width, and height). These values should all be positive. t is the tab style of the compartment (0:full, 1:auto, 2:left, 3:center, 4:right, 5:none). s is a toggle for the bottom scoop.
2022-10-03 00:35:03 +00:00
/*
gridfinityInit ( 3 , 3 , height ( 6 ) , 0 , 42 ) {
2023-02-14 22:12:45 +00:00
cut ( x = 0 , y = 0 , w = 1.5 , h = 0.5 , t = 5 , s = 0 ) ;
cut ( 0 , 0.5 , 1.5 , 0.5 , 5 , 0 ) ;
cut ( 0 , 1 , 1.5 , 0.5 , 5 , 0 ) ;
2023-09-22 06:11:23 +00:00
2023-02-14 22:12:45 +00:00
cut ( 0 , 1.5 , 0.5 , 1.5 , 5 , 0 ) ;
cut ( 0.5 , 1.5 , 0.5 , 1.5 , 5 , 0 ) ;
cut ( 1 , 1.5 , 0.5 , 1.5 , 5 , 0 ) ;
2023-09-22 06:11:23 +00:00
2022-10-03 00:35:03 +00:00
cut ( 1.5 , 0 , 1.5 , 5 / 3 , 2 ) ;
cut ( 1.5 , 5 / 3 , 1.5 , 4 / 3 , 4 ) ;
}
gridfinityBase ( 3 , 3 , 42 , 0 , 0 , 1 ) ;
* /
2023-09-22 06:11:23 +00:00
// Compartments can overlap! This allows for weirdly shaped compartments, such as this "2" bin.
2022-10-03 00:35:03 +00:00
/*
gridfinityInit ( 3 , 3 , height ( 6 ) , 0 , 42 ) {
2023-02-14 22:12:45 +00:00
cut ( 0 , 2 , 2 , 1 , 5 , 0 ) ;
2022-10-03 00:35:03 +00:00
cut ( 1 , 0 , 1 , 3 , 5 ) ;
cut ( 1 , 0 , 2 , 1 , 5 ) ;
cut ( 0 , 0 , 1 , 2 ) ;
cut ( 2 , 1 , 1 , 2 ) ;
}
gridfinityBase ( 3 , 3 , 42 , 0 , 0 , 1 ) ;
* /
// Areas without a compartment are solid material, where you can put your own cutout shapes. using the cut_move() function, you can select an area, and any child shapes will be moved from the origin to the center of that area, and subtracted from the block. For example, a pattern of three cylinderical holes.
/*
gridfinityInit ( 3 , 3 , height ( 6 ) , 0 , 42 ) {
cut ( x = 0 , y = 0 , w = 2 , h = 3 ) ;
cut ( x = 0 , y = 0 , w = 3 , h = 1 , t = 5 ) ;
2023-09-22 06:11:23 +00:00
cut_move ( x = 2 , y = 1 , w = 1 , h = 2 )
pattern_linear ( x = 1 , y = 3 , sx = 42 / 2 )
2022-10-03 00:35:03 +00:00
cylinder ( r = 5 , h = 1000 , center = true ) ;
}
gridfinityBase ( 3 , 3 , 42 , 0 , 0 , 1 ) ;
* /
// You can use loops as well as the bin dimensions to make different parametric functions, such as this one, which divides the box into columns, with a small 1x1 top compartment and a long vertical compartment below
/*
gx = 3 ;
gy = 3 ;
gridfinityInit ( gx , gy , height ( 6 ) , 0 , 42 ) {
for ( i = [ 0 : gx - 1 ] ) {
cut ( i , 0 , 1 , gx - 1 ) ;
cut ( i , gx - 1 , 1 , 1 ) ;
}
}
gridfinityBase ( gx , gy , 42 , 0 , 0 , 1 ) ;
* /
// Pyramid scheme bin
/*
gx = 4.5 ;
gy = 4 ;
gridfinityInit ( gx , gy , height ( 6 ) , 0 , 42 ) {
2023-09-22 06:11:23 +00:00
for ( i = [ 0 : gx - 1 ] )
2022-10-03 00:35:03 +00:00
for ( j = [ 0 : i ] )
cut ( j * gx / ( i + 1 ) , gy - i - 1 , gx / ( i + 1 ) , 1 , 0 ) ;
}
gridfinityBase ( gx , gy , 42 , 0 , 0 , 1 ) ;
2023-09-22 06:11:23 +00:00
* /