Massive re-write of core bin creation. Along with multiple quality of life improvements.
- Class/struct style bin creation.
- Minimized hidden globals.
- Re-wrote bin cutters.
- Bins no longer use
minowskiorhullfunctions.- These are incompatible with CAD software.
- Significantly more useful helper functions.
gridalone could be a library.
- Fixes #260 By setting a particular cutoff.
- Fixes #259 For regular and lite bins.
Not Done / Included
Documentation updates. These are horribly out of date.
User visible Changes / Fixes
- Fixes #249 Lite bins had a weird overhang when using some settings.
- Lite bin bridging structures are now stronger, and always are the same thickness.
- Fixed Lite bin wall thickness for holes was half what it should have been.
- Bin internals now go to the bridging structure.
- Deeper bins.
- Tabs no longer end in a triangle.
- Halved bins divider thickness.
- Support significantly larger bins.
- 15x15 bases with 4x4 tabbed compartments renders in < 3 seconds without cache. (Using Manifold)
- Fixes #285 gridfinity-spiral-vase.scad bins now work again
- Edge cases still need to be ironed out.
- Fixes #291 Half-grid bins now work correctly.
- Partially implements #305, by allowing custom tab width for custom bins.
- Fixes #286 Small bins now render perfectly.
- Note the base changes below mean anything under 1 unit / 7mm height does nothing.
- Bins are now 0.5mm taller, to align with the standard.
- Base + Bridging structure is exactly 1U / 7mm.
New / Changed Helpers
No helper is Gridfinity specific, and everything here could be done by a library or used in another project.
Several of these should be included with OpenSCAD.
grid.scad & grid_element.scad
The heart of the new bin system! Started out as a slightly better pattern_linear, but grew and grew.
- Struct/Class like data access to information via
new_grid. - Two new helper functions
pattern_gridandsubdivide_gridto replacepattern_linear. - Children can access key information about themselves and their current placement via
grid_element_current().- One of two places which uses a hidden variable.
- Supports padding subtracted from outer elements.
- Allows for a 42mm grid spacing, even when the total size is less than a multiple of 42.
- Supports 2 and 3 dimensional grids.
- Supports some calculations on 2+ dimensional grids, but position is limited to 3 dimensions.
- Experimental support for
child_per_element.
Examples:
pattern_grid([3, 5], [10, 20], true, true) {
element = grid_element_current();
is_top_left = grid_element_is_last_row(element) && grid_element_is_first_col(element);
color(is_top_left ? "red" : "green")
circle(r=4);
}
// 5x4x3 grid.
// Each element is a 10x20x5 cube.
// Centered in the x, y, and z dimensions.
my_grid = new_grid([5, 4, 3], [10 , 20, 5], center=true);
translate([100, 0, 0])
grid_foreach(my_grid, center=true) { // Zero position is the center of the element.
element = grid_element_current();
is_top_left = grid_element_is_last_row(element) && grid_element_is_first_col(element);
color(is_top_left ? "red" : "green")
sphere(r=2);
}
// The same grid can be re-used in multiple locations.
translate([150, 0, 0])
grid_foreach(my_grid) { // By default, elements start at the lower bottom left corner.
element = grid_element_current();
cube(grid_element_get_dimensions(element)/2);
}
// Create colorful, labeled, grid elements to see what is happening.
// print=1 also provides debugging information about the grid in the console.
translate([200, 0, 0])
debug_grid(my_grid, print=1);Functions
grid.scad
new_gridgrid_from_totalgrid_from_othergrid_get_num_elementsgrid_get_element_countgrid_get_element_dimensionsgrid_is_centeredgrid_get_perimetergrid_get_average_element_dimensionsgrid_get_raw_dimensionsgrid_get_total_dimensionsgrid_get_position_bottom_leftgrid_get_position_centeris_gridgrid_get_elementgrid_scalegrid_translategrid_foreachchild_per_elementsubdivide_gridpattern_gridprint_gridgrid_visualize_perimeterdebug_grid
grid_element.scad
is_grid_elementgrid_element_currentgrid_element_get_gridgrid_element_get_indexgrid_element_is_centeredgrid_element_get_positiongrid_element_get_sequence_numbergrid_element_get_dimensionsgrid_element_is_in_positiongrid_element_is_firstgrid_element_is_lastgrid_element_is_first_colgrid_element_is_first_rowgrid_element_is_last_colgrid_element_is_last_rowgrid_element_labeldebug_grid_elementprint_grid_element
shapes.scad
- Moved
rounded_squarefrom generic_helpers.scad - Moved
conefrom gridfinity-rebuilt-holes.scad rounded_squareis now purely 2d. The built inlinear_extrudehad different centering behavior fromcube.
angles.scad
Helper functions for angle calculations.
signp:signfunction, but 0 means a positive sign.normalize_angle: Convert an angle to between -180 and +180 degrees.positive_angle: Convert an angle to between 0 and +360 degrees.
list.scad
List helper functions.
reverse(list): Reverse the order of elements in a list.aggregate(list, accumulator, start): Use an accumulator function to convert a list to a single element.sum(list): Add all list elements together.all(list, test_fn): If all list elements return true.any(list, test_fn): If any list element returns true.none(list, test_fn): If no list element returns true.as_list(object, n): Convert an object to a list of n elements. If it was already a list, limit it to n elements.as_2d(object): Alias foras_list(object, 2)as_3d(object): Alias foras_list(object, 3)
generic_helpers.scad
Additional minor work, not mentioned below, also done.
Added:
pprint: Helper to make debugging multidimensional matrices easier.vector_scale: Performs element wise multiplication.is_valid_2d(vector): If the first two elements are numbers. Can be a higher rank vector.is_valid_3d(vector): If the first three elements are numbers. Can be a higher rank vector.is_positive(vector): If all elements are positive.
Removed:
Functions moved to other files are not included on this list.
rounded_rectangle, as it was previously deprecated.atanv. atan2 ordering is important, and should be manually specified.vector_magnitude. It was a, poor, re-implementation of the built innormfunction.
TODO: Finish replacing pattern_linear, and remove it.
Core
Misc Shape / Constant Changes
gridfinity-rebuilt-utility.scad
- Fix zero height
fromGirdfinityUnits heightfunction can no longer return negative values.z_snapseparated fromheightfunction.
Moved or removed all other methods.
standard.scad
r_baseis nowBASE_TOP_RADIUS- New
BASE_GAP_MMconstant.- Required for half-grid bins to fit in regular grids.
MAGNET_HOLE_CRUSH_RIB_INNER_RADIUSchanged from 5.9/2 to 5.5/2.MAGNET_HOLE_CRUSH_RIB_COUNTchanged from 8 to 9.CHAMFER_ADDITIONAL_RADIUSchanged from 0.8 to 0.5.BASE_HEIGHTre-named toBASE_PROFILE_HEIGHT.- New
BASE_HEIGHTfixed at 7mm.- Per standard.
h_botre-named toBASE_BRIDGE_HEIGHT.- Now calculated from
BASE_HEIGHT-BASE_PROFILE_HEIGHT
- Now calculated from
d_tabwre-named toTAB_WIDTH_NOMINAL.- Removed
d_clearTOLLERANCEshould be used instead.
- Moved
r_c1to gridfinity-spiral-vase.scad - Moved
d_wall2to gridfinity-spiral-vase.scad
Additionally, created a "Tab Constants" section. With a polygon to create the tab. Prior constant values were not changed.
wall.scad
Stacking lip and wall functions moved from "gridfinity-rebuilt-utility.scad" to this new file.
- When stacking lip is disabled, infill now provides the wall.
- Most functions are now prefixed with
_denoting them as private.- Zero API stability guarantees.
- Wall with stacking lip now colored blue by default.
base.scad
gridfinityBase functions moved from "gridfinity-rebuilt-utility.scad" to this new file.
gridfinityBaseandblock_base: Removed "off" and "final_cut" parameters.- Base top / bridging structure now colored "RosyBrown".
base_polygon()re-named to_base_polygon()- Optimized
base_outer_shell.- Used by Gridfinity_lite bases.
- Support bottomless Gridfinity_lite bases.
cutouts.scad & tab.scad
Brand new cutter and tab handling functions. Supports placing the tab anywhere along the edge. These are missing some of the radiused edges of the originals, but do not use hull or minowsky.
cutouts.scad
cgs: Usesgrid_element_current()to calculate the compartment size, with spacing between compartments.cut_compartment: More powerful cut function, but with a lower level interface.cut_compartment_auto: Replacement for thecutfunction.cut_chamfered_cylinder
tab.scad
tabsnap_to_edge: Given a centered bounding box and an angle, snap children to an edge of said box based on the angle.normalize_to_box: Normalize an angle so that 45 degrees points to the corner of a box.
bin.scad
This replaces gridfinityInit, cut_move, and the translate portions of cut, and cutEqual.
It also supports setting "base_thickness" to create a lite bin.
bin22 = new_bin(
grid_size = [2, 2],
height_mm = 7 * 3,
include_lip = true
);
// Render a 2x2 bin with 4 equal cutouts
bin_render(bin22) {
// Everything inside here is removed from everything but the base and stacking lip / wall.
bin_subdivide(bin22, [2, 2]) {
cut_compartment_auto (cgs());
}
}
// Render the same bin with a single offset cutout
translate([100, 0, 0])
bin_render(bin22) {
// Everything inside here is removed from everything but the base and stacking lip / wall.
bin_translate([0.5, 0.5])
cut_compartment_auto (cgs([1.5, 1]), center_top=false);
}new_binbin_renderbin_render_infillbin_render_wallbin_render_basebin_subdividebin_translatebin_get_basesbin_get_grid_dimensionsbin_get_size_mmbin_get_infill_size_mmis_bin
Top Level Files
gridfinity-spiral-vase.scad
Fixed bin rendering.
gridfinity-rebuilt-bins.scad
Switched to the new bin method. Including all examples.
- Replaced
cdivx,cdivywith acut_cylindersoption. - Removed
c_depthoption.- Just set infill height.
- Removed
c_orientation. - Decrease $fa to 4.
- Needed for new scoop to render correctly.
gridfinity-rebuilt-lite.scad
Switched to new bin creation method.
- Bridging structure is now always full height.
- Supporting custom base heights, all the way up to a normal base.
- Can be treated as regular bins with the outer shell protected from infill cutters.
Internally, the only reason regular bins are not all rendered as "lite" bins is for performance reasons, and to keep the object count down.