Skip to content

Version 2.0.0

Latest

Choose a tag to compare

@EmperorArthur EmperorArthur released this 01 Sep 00:27
910e22d

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 minowski or hull functions.
    • These are incompatible with CAD software.
  • Significantly more useful helper functions.
    • grid alone 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_grid and subdivide_grid to replace pattern_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_grid
  • grid_from_total
  • grid_from_other
  • grid_get_num_elements
  • grid_get_element_count
  • grid_get_element_dimensions
  • grid_is_centered
  • grid_get_perimeter
  • grid_get_average_element_dimensions
  • grid_get_raw_dimensions
  • grid_get_total_dimensions
  • grid_get_position_bottom_left
  • grid_get_position_center
  • is_grid
  • grid_get_element
  • grid_scale
  • grid_translate
  • grid_foreach
  • child_per_element
  • subdivide_grid
  • pattern_grid
  • print_grid
  • grid_visualize_perimeter
  • debug_grid

grid_element.scad

  • is_grid_element
  • grid_element_current
  • grid_element_get_grid
  • grid_element_get_index
  • grid_element_is_centered
  • grid_element_get_position
  • grid_element_get_sequence_number
  • grid_element_get_dimensions
  • grid_element_is_in_position
  • grid_element_is_first
  • grid_element_is_last
  • grid_element_is_first_col
  • grid_element_is_first_row
  • grid_element_is_last_col
  • grid_element_is_last_row
  • grid_element_label
  • debug_grid_element
  • print_grid_element

shapes.scad

  • Moved rounded_square from generic_helpers.scad
  • Moved cone from gridfinity-rebuilt-holes.scad
  • rounded_square is now purely 2d. The built in linear_extrude had different centering behavior from cube.

angles.scad

Helper functions for angle calculations.

  • signp: sign function, 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 for as_list(object, 2)
  • as_3d(object): Alias for as_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 in norm function.

TODO: Finish replacing pattern_linear, and remove it.

Core

Misc Shape / Constant Changes

gridfinity-rebuilt-utility.scad

  • Fix zero height fromGirdfinityUnits
  • height function can no longer return negative values.
  • z_snap separated from height function.

Moved or removed all other methods.

standard.scad

  • r_base is now BASE_TOP_RADIUS
  • New BASE_GAP_MM constant.
    • Required for half-grid bins to fit in regular grids.
  • MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS changed from 5.9/2 to 5.5/2.
  • MAGNET_HOLE_CRUSH_RIB_COUNT changed from 8 to 9.
  • CHAMFER_ADDITIONAL_RADIUS changed from 0.8 to 0.5.
  • BASE_HEIGHT re-named to BASE_PROFILE_HEIGHT.
  • New BASE_HEIGHT fixed at 7mm.
    • Per standard.
  • h_bot re-named to BASE_BRIDGE_HEIGHT.
    • Now calculated from BASE_HEIGHT - BASE_PROFILE_HEIGHT
  • d_tabw re-named to TAB_WIDTH_NOMINAL.
  • Removed d_clear
    • TOLLERANCE should be used instead.
  • Moved r_c1 to gridfinity-spiral-vase.scad
  • Moved d_wall2 to 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.

  • gridfinityBase and block_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: Uses grid_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 the cut function.
  • cut_chamfered_cylinder

tab.scad

  • tab
  • snap_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_bin
  • bin_render
  • bin_render_infill
  • bin_render_wall
  • bin_render_base
  • bin_subdivide
  • bin_translate
  • bin_get_bases
  • bin_get_grid_dimensions
  • bin_get_size_mm
  • bin_get_infill_size_mm
  • is_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, cdivy with a cut_cylinders option.
  • Removed c_depth option.
    • 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.