Skip to content

Instantly share code, notes, and snippets.

@ragaskar
Created February 12, 2025 15:16
Show Gist options
  • Save ragaskar/d45b2e91016ddd7fc3820434592c2c41 to your computer and use it in GitHub Desktop.
Save ragaskar/d45b2e91016ddd7fc3820434592c2c41 to your computer and use it in GitHub Desktop.
gridfinity_helpers.scad
#
# This file "wraps" the https://github.com/ostat/gridfinity_extended_openscad/ library so that one could call it programmatically
# Please see https://github.com/ostat/gridfinity_extended_openscad/issues/119
#
# (this file assumes the gridfinity_extended_openscad is in your OpenScad library dir. It could be placed at the root of your lib if desired.
// include instead of use, so we get the pitch
include <gridfinity_extended_openscad/modules/gridfinity_constants.scad>
use <gridfinity_extended_openscad/modules/module_gridfinity.scad>
use <gridfinity_extended_openscad/modules/module_gridfinity_baseplate.scad>
use <gridfinity_extended_openscad/modules/module_gridfinity_cup.scad>
function grid_pos(g) = g * 42;
module cutout_grid(cut_x = 2, cut_y = 2, start_x = 0, start_y = 0) {
cut_height = 10;
grid_wall = 2.95;
function 2x(v) = 2 * v;
corner_affordance = 12; //for magnet.
x_offset = grid_pos(start_x);
y_offset = grid_pos(start_y);
lower_left = [0, 0, -1];
lower_right = [grid_pos(cut_x) - corner_affordance - 2x(grid_wall), 0, -1];
upper_right = [grid_pos(cut_x) - corner_affordance - 2x(grid_wall), grid_pos(cut_y) - corner_affordance - 2x(grid_wall
), -1];
upper_left = [0, grid_pos(cut_y) - corner_affordance - 2x(grid_wall), -1];
module cutout() {
difference() {
translate([grid_wall, grid_wall, 0]) {
difference() {
cube([grid_pos(cut_x) - (2 * grid_wall), grid_pos(cut_y) - (2 * grid_wall), cut_height]);
for (p = [lower_left, lower_right, upper_right, upper_left]) {
translate(p) cube([corner_affordance, corner_affordance, cut_height + 2]);
}
}
}
}
}
difference() {
union() {children();}
translate([x_offset, y_offset, -1]) cutout();
}
}
module render_cup(x = 1, y = 1, render_position = "zero") {
/* -- General Cup -- */
// X dimension. grid units (multiples of 42mm) or mm.
// 168 * 84
//max height on plate lean should be under 190, I think 35mm distance between will work
//that means in a 42, we have 35 + 2x 3.5 walls, BUT, because we are doing in chunks of 2,
//the "front" wall for one is the "back" of the other (meaning we need total e.g. 3 walls for a 2 grid plate holder).
//i,e, in 84 we have (84 - (2 * 35))/3 = 4.666667 -- round down to 4.5, we'll have some spacing:
// (84 - (2 * 35) - (3 * 4.5)) = 0.5 left over, .25 on each side?
width = [x, 0]; //0.1
// Y dimension. grid units (multiples of 42mm) or mm.
//add a touch of depth for our last divider
depth = [y, 0]; //0.1
// Z dimension excluding. grid units (multiples of 7mm) or mm (0.1)
height = [1, 0];
// Fill in solid block (overrides all following options)
//options: disabled, enabled, enabledfilllip:"Fill cup and lip"
filled_in = "enabled";
// Wall thickness of outer walls. default, height < 8 0.95, height < 16 1.2, height > 16 1.6 (Zack's design is 0.95 mm)
wall_thickness = 0; // .01
// Remove some or all of lip
//options: normal, reduced, minimum, none:not stackable
lip_style = "none";
//under size the bin top by this amount to allow for better stacking
zClearance = 0; // 0.1
//assign colours to the bin, will may
//options: disabled, enable, preview, lip
set_colour = "enable";
/* -- Subdivisions -- */
chamber_wall_thickness = 1.2;
//Reduce the wall height by this amount
chamber_wall_zClearance = 0;//0.1
// X dimension subdivisions
vertical_chambers = 0;
vertical_separator_bend_position = 0;
vertical_separator_bend_angle = 0;
vertical_separator_bend_separation = 0;
vertical_separator_cut_depth = 0;
horizontal_chambers = 0;
horizontal_separator_bend_position = 0;
horizontal_separator_bend_angle = 0;
horizontal_separator_bend_separation = 0;
horizontal_separator_cut_depth = 0;
// Enable irregular subdivisions
vertical_irregular_subdivisions = false;
// Separator positions are defined in terms of grid units from the left end
vertical_separator_config = "10.5|21|42|50|60";
// Enable irregular subdivisions
horizontal_irregular_subdivisions = false;
// Separator positions are defined in terms of grid units from the left end
horizontal_separator_config = "10.5|21|42|50|60";
/* -- Base -- */
// Enable magnets
enable_magnets = true;
// Enable screws
enable_screws = false;
//size of magnet, diameter and height. Zack's original used 6.5 and 2.4
magnet_size = [6.0, 2.0]; // .1
//create relief for magnet removal
//options: "off","auto","inner","outer"
magnet_easy_release = "auto";
//size of screw, diameter and height. Zack's original used 3 and 6
screw_size = [3, 6]; // .1
//size of center magnet, diameter and height.
center_magnet_size = [0, 0];
// Sequential Bridging hole overhang remedy is active only when both screws and magnets are nonzero (and this option is selected)
hole_overhang_remedy = 2;
//Only add attachments (magnets and screw) to box corners (prints faster).
box_corner_attachments_only = true;
// Minimum thickness above cutouts in base (Zack's design is effectively 1.2)
floor_thickness = 0.7;
cavity_floor_radius = -1;// .1
// Efficient floor option saves material and time, but the internal floor is not flat
//options: off,on,rounded,smooth
efficient_floor = "off";
// Enable to subdivide bottom pads to allow half-cell offsets
half_pitch = false;
// Removes the internal grid from base the shape
flat_base = false;
// Remove floor to create a vertical spacer
spacer = false;
//Pads smaller than this will not be rendered as it interferes with the baseplate. Ensure appropriate support is added in slicer.
minimum_printable_pad_size = 0.2;
/* -- Label -- */
//options: disabled: no label, normal:normal, gflabel:gflabel basic label, pred:pred - labels by pred, cullenect:Cullenect click labels V2, cullenect_legacy:Cullenect click labels v1
label_style = "normal";
// Include overhang for labeling (and specify left/right/center justification)
//options: left, right, center, leftchamber, rightchamber, centerchamber
label_position = "left";
// Width, Depth, Height, Radius. Width in Gridfinity units of 42mm, Depth and Height in mm, radius in mm. Width of 0 uses full width. Height of 0 uses Depth, height of -1 uses depth*3/4.
label_size = [0, 14, 0, 0.6]; // 0.01
// Size in mm of relief where appropriate. Width, depth, height, radius
label_relief = [0, 0, 0, 0.6]; // 0.1
// wall to enable on, front, back, left, right. 0: disabled; 1: enabled;
//options: 0:1:1
label_walls = [0, 1, 0, 0];
/* -- Sliding Lid -- */
sliding_lid_enabled = false;
// 0 = wall thickness *2
sliding_lid_thickness = 0; //0.1
// 0 = wall_thickness/2
sliding_min_wallThickness = 0;//0.1
// 0 = default_sliding_lid_thickness/2
sliding_min_support = 0;//0.1
sliding_clearance = 0.1;//0.1
sliding_lid_lip_enabled = false;
/* -- Finger Slide -- */
// Include larger corner fillet
//options: none, rounded, chamfered
fingerslide = "none";
// Radius of the corner fillet
fingerslide_radius = 8;
// wall to enable on, front, back, left, right. 0: disabled; 1: enabled;
//options: 0:1:1
fingerslide_walls = [1, 0, 0, 0];
//Align the fingerslide with the lip
fingerslide_lip_aligned = true;
/* -- Tapered Corner -- */
//options: none, rounded, chamfered
tapered_corner = "none";
tapered_corner_size = 10;
// Set back of the tapered corner, default is the gridfinity corner radius
tapered_setback = -1;//gridfinity_corner_radius/2;
/* -- Wall Pattern -- */
// Grid wall patter
wallpattern_enabled = false;
// Style of the pattern
//options: grid, gridrotated, hexgrid, hexgridrotated, voronoi, voronoigrid, voronoihexgrid, brick, brickrotated, brickoffset, brickoffsetrotated
wallpattern_style = "gridrotated";
// Spacing between pattern
wallpattern_hole_spacing = 2; //0.1
// wall to enable on, front, back, left, right.
//options: 0:1:1
wallpattern_walls = [1, 1, 1, 1];
// Add the pattern to the dividers
//options: disabled, horizontal, vertical, both
wallpattern_dividers_enabled = "disabled";
//Number of sides of the hole op
//options: 4:square, 6:Hex, 64:circle
wallpattern_hole_sides = 6;
//Size of the hole
wallpattern_hole_size = [5, 5]; //0.1
// pattern fill mode
//options: none, space, crop, crophorizontal, cropvertical, crophorizontal_spacevertical, cropvertical_spacehorizontal, spacevertical, spacehorizontal
wallpattern_fill = "crop";
wallpattern_voronoi_noise = 0.75;
wallpattern_voronoi_radius = 0.5;
/* -- Floor Pattern -- */
// enable Grid floor patter
floorpattern_enabled = false;
// Style of the pattern
//options: grid, gridrotated, hexgrid, hexgridrotated, voronoi, voronoigrid, voronoihexgrid, brick, brickrotated, brickoffset, brickoffsetrotated
floorpattern_style = "gridrotated";
// Spacing between pattern
floorpattern_hole_spacing = 2; //0.1
//Number of sides of the hole op
//options: 4:square, 6:Hex, 64:circle
floorpattern_hole_sides = 6;
//Size of the hole
floorpattern_hole_size = [5, 5]; //0.1
floorpattern_hole_radius = 0.5;
// pattern fill mode
//options: none, space, crop, crophorizontal, cropvertical, crophorizontal_spacevertical, cropvertical_spacehorizontal, spacevertical, spacehorizontal
floorpattern_fill = "crop";
//veroni: noise, brick: center weight
floorpattern_pattern_variable = 0.75;
/* -- Wall Cutout -- */
//options: disabled, enabled, wallsonly, frontonly, backonly
wallcutout_vertical = "disabled";
// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value)
wallcutout_vertical_position = -2; //0.1
//default will be binwidth/2
wallcutout_vertical_width = 0;
wallcutout_vertical_angle = 70;
//default will be binHeight
wallcutout_vertical_height = 0;
wallcutout_vertical_corner_radius = 5;
//options: disabled, enabled, wallsonly, leftonly, rightonly
wallcutout_horizontal = "disabled";
// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value)
wallcutout_horizontal_position = -2; //0.1
//default will be binwidth/2
wallcutout_horizontal_width = 0;
wallcutout_horizontal_angle = 70;
//default will be binHeight
wallcutout_horizontal_height = 0;
wallcutout_horizontal_corner_radius = 5;
/* -- Extendable -- */
//options: disabled, front, back
extension_x_enabled = "disabled";
extension_x_position = 0.5;
//options: disabled, front, back
extension_y_enabled = "disabled";
extension_y_position = 0.5;
extension_tabs_enabled = false;
//Tab size, height, width, thickness, style. width default is height, thickness default is 1.4, style {0,1,2}.
extension_tab_size = [10, 0, 0, 0];
/* -- Bottom Text -- */
// Add bin size to bin bottom
text_1 = false;
// Font Size of text, in mm (0 will auto size)
text_size = 0; // 0.1
// Depth of text, in mm
text_depth = 0.3; // 0.01
// Font to use
//options: Aldo, B612, "Open Sans", Ubuntu
text_font = "Aldo";
// Add free-form text line to bin bottom (printing date, serial, etc)
text_2 = false;
// Actual text to add
text_2_text = "Gridfinity Extended";
/* -- debug -- */
//options: default,center,zero
//render_position = render_position;
//Slice along the x axis
cutx = 0; //0.1
//Slice along the y axis
cuty = 0; //0.1
// enable loging of help messages during render.
//options: info,debug,trace
enable_help = "debug";
SetGridfinityEnvironment(
width = width,
depth = depth,
height = height,
render_position = render_position,
help = enable_help,
cutx = cutx,
cuty = cuty,
cutz = calcDimensionHeight(height, true),
setColour = set_colour)
gridfinity_cup(
width = width, depth = depth, height = height,
filled_in = filled_in,
label_settings = LabelSettings(
labelStyle = label_style,
labelPosition = label_position,
labelSize = label_size,
labelRelief = label_relief,
labelWalls = label_walls),
fingerslide = fingerslide,
fingerslide_radius = fingerslide_radius,
fingerslide_walls = fingerslide_walls,
fingerslide_lip_aligned = fingerslide_lip_aligned,
cupBase_settings = CupBaseSettings(
magnetSize = enable_magnets?magnet_size:[0, 0],
magnetEasyRelease = magnet_easy_release,
centerMagnetSize = center_magnet_size,
screwSize = enable_screws?screw_size:[0, 0],
holeOverhangRemedy = hole_overhang_remedy,
cornerAttachmentsOnly = box_corner_attachments_only,
floorThickness = floor_thickness,
cavityFloorRadius = cavity_floor_radius,
efficientFloor = efficient_floor,
halfPitch = half_pitch,
flatBase = flat_base,
spacer = spacer,
minimumPrintablePadSize = minimum_printable_pad_size),
wall_thickness = wall_thickness,
chamber_wall_thickness = chamber_wall_thickness,
chamber_wall_zClearance = chamber_wall_zClearance,
vertical_chambers = vertical_chambers,
vertical_separator_bend_position = vertical_separator_bend_position,
vertical_separator_bend_angle = vertical_separator_bend_angle,
vertical_separator_bend_separation = vertical_separator_bend_separation,
vertical_separator_cut_depth = vertical_separator_cut_depth,
vertical_irregular_subdivisions = vertical_irregular_subdivisions,
vertical_separator_config = vertical_separator_config,
horizontal_chambers = horizontal_chambers,
horizontal_separator_bend_position = horizontal_separator_bend_position,
horizontal_separator_bend_angle = horizontal_separator_bend_angle,
horizontal_separator_bend_separation = horizontal_separator_bend_separation,
horizontal_separator_cut_depth = horizontal_separator_cut_depth,
horizontal_irregular_subdivisions = horizontal_irregular_subdivisions,
horizontal_separator_config = horizontal_separator_config,
lip_style = lip_style,
zClearance = zClearance,
tapered_corner = tapered_corner,
tapered_corner_size = tapered_corner_size,
tapered_setback = tapered_setback,
wallpattern_enabled = wallpattern_enabled,
wallpattern_style = wallpattern_style,
wallpattern_walls = wallpattern_walls,
wallpattern_dividers_enabled = wallpattern_dividers_enabled,
wallpattern_hole_sides = wallpattern_hole_sides,
wallpattern_hole_size = wallpattern_hole_size,
wallpattern_hole_spacing = wallpattern_hole_spacing,
wallpattern_fill = wallpattern_fill,
wallpattern_voronoi_noise = wallpattern_voronoi_noise,
wallpattern_voronoi_radius = wallpattern_voronoi_radius,
floor_pattern_settings = PatternSettings(
patternEnabled = floorpattern_enabled,
patternStyle = floorpattern_style,
patternFill = floorpattern_fill,
patternBorder = floorpattern_hole_spacing,
patternHoleSize = floorpattern_hole_size,
patternHoleSides = floorpattern_hole_sides,
patternHoleSpacing = floorpattern_hole_spacing,
patternHoleRadius = floorpattern_hole_radius,
patternVariable = floorpattern_pattern_variable),
wallcutout_vertical = wallcutout_vertical,
wallcutout_vertical_position = wallcutout_vertical_position,
wallcutout_vertical_width = wallcutout_vertical_width,
wallcutout_vertical_angle = wallcutout_vertical_angle,
wallcutout_vertical_height = wallcutout_vertical_height,
wallcutout_vertical_corner_radius = wallcutout_vertical_corner_radius,
wallcutout_horizontal = wallcutout_horizontal,
wallcutout_horizontal_position = wallcutout_horizontal_position,
wallcutout_horizontal_width = wallcutout_horizontal_width,
wallcutout_horizontal_angle = wallcutout_horizontal_angle,
wallcutout_horizontal_height = wallcutout_horizontal_height,
wallcutout_horizontal_corner_radius = wallcutout_horizontal_corner_radius,
extendable_Settings = ExtendableSettings(
extendablexEnabled = extension_x_enabled,
extendablexPosition = extension_x_position,
extendableyEnabled = extension_y_enabled,
extendableyPosition = extension_y_position,
extendableTabsEnabled = extension_tabs_enabled,
extendableTabSize = extension_tab_size),
sliding_lid_enabled = sliding_lid_enabled,
sliding_lid_thickness = sliding_lid_thickness,
sliding_min_wall_thickness = sliding_min_wallThickness,
sliding_min_support = sliding_min_support,
sliding_clearance = sliding_clearance,
sliding_lid_lip_enabled = sliding_lid_lip_enabled,
cupBaseTextSettings = CupBaseTextSettings(
baseTextLine1Enabled = text_1,
baseTextLine2Enabled = text_2,
baseTextLine2Value = text_2_text,
baseTextFontSize = text_size,
baseTextFont = text_font,
baseTextDepth = text_depth));
}
module render_baseplate(grid_x_size, grid_y_size, render_position = "zero") {
// Plate Style
//options: default:Efficient base, cnclaser:CNC or Laser cut
Base_Plate_Options = "default";
//Width & Depth are "grid" dimensions -- that is, the dims to be printed w/ grids vs "filler".
// If you want "grid everywhere" even if smaller than 42mm, set this to your total desired outer dimensions.
// If you want "filler", then figure the nearest modulo 42 whole number and enter that, and use outer_Width to set actual width.
//
// X dimension. grid units (multiples of 42mm) or mm (0.1)
Width = [grid_x_size, 0];
// Y dimension. grid units (multiples of 42mm) or mm (0.1)
Depth = [grid_y_size, 0];
//options: crop, fill
oversize_method = "fill";
//options: near, center, far
position_fill_grid_x = "near";
//options: near, center, far
position_fill_grid_y = "near";
// X outer dimension. grid units (multiples of 42mm) or mm (0.1)
outer_Width = [0, 0];
// Y outer dimension. grid units (multiples of 42mm) or mm (0.1)
outer_Depth = [0, 0];
// z outer dimension. mm (0.1)
outer_Height = 0;
//options: near, center, far
position_grid_in_outer_x = "center";
//options: near, center, far
position_grid_in_outer_y = "center";
//Reduce the frame wall size to this value
Reduced_Wall_Height = 0; //0.1
Reduced_Wall_Taper = false;
//options: 0:0.01:3.75
plate_corner_radius = 3.75;
/* -- Printer bed options -- */
//options: disabled, enabled, unique
build_plate_enabled = "enabled";
//Will split the plate in to the
build_plate_size = [238, 256];
/* -- Base Plate Options -- */
// Enable magnets in the bin corner
Enable_Magnets = true;
//size of magnet, diameter and height. Zacks original used 6.5 and 2.4
Magnet_Size = [6.0, 2.0]; // .1
//Enable screws in the bin corner under the magnets
Corner_Screw_Enabled = false;
//Enable hold down screw in the center
Center_Screw_Enabled = false;
//Enable cavity to place frame weights
Enable_Weight = false;
/* [Base Plate Clips - POC don't use yet]*/
//This feature is not yet finalized, or working properly.
Butterfly_Clip_Enabled = false;
Butterfly_Clip_Size = [6, 6, 1.5];
Butterfly_Clip_Radius = 0.1;
Butterfly_Clip_Tolerance = 0.1;
Butterfly_Clip_Only = false;
//This feature is not yet finalized, or working properly.
Filament_Clip_Enabled = false;
Filament_Clip_Diameter = 2;
Filament_Clip_Length = 8;
/* -- Custom Grid -- */
//Enable custom grid, you will configure this in the (Lid not supported)
//I think what we want instead are different sizes.
Custom_Grid_Enabled = false;
//Custom gid sizes
//I am not sure it this is really useful, but its possible, so here we are.
//0:off the cell is off
//1:on the cell is on and all corners are rounded
//2-16, are bitwise values used to calculate what corners should be rounded, you need to subtract 2 from the value for the bitwise logic (so it does not clash with 0 and 1).
xpos1 = [3, 2, 2, 2, 2, 4, 0];
xpos2 = [2, 2, 2, 2, 2, 2, 0];
xpos3 = [2, 2, 2, 2, 2, 2, 0];
xpos4 = [2, 2, 2, 2, 2, 2, 0];
xpos5 = [6, 2, 2, 2, 2, 10, 0];
xpos6 = [0, 0, 0, 0, 0, 0, 0]; //unused
xpos7 = [0, 0, 0, 0, 0, 0, 0]; //unused
/* -- debug -- */
//options: default,center,zero
Render_Position = "zero";
//Slice along the x axis
cutx = 0; //0.1
//Slice along the y axis
cuty = 0; //0.1
// enable loging of help messages during render.
enable_help = "fart";
function split_dimention(gf_size, gf_outer_size, plate_size, position_fill_grid, position_grid_in_outer) =
assert(is_num(gf_size), "gf_size must be a number")
assert(is_num(gf_outer_size), "gf_outer_size must be a number")
assert(is_num(plate_size), "plate_size must be a number")
assert(is_string(position_fill_grid), "position_fill_grid must be a string")
assert(is_string(position_grid_in_outer), "position_grid_in_outer must be a string")
let(
outerSize = gf_outer_size > gf_size ? gf_outer_size : gf_size,
outerDelta = outerSize - gf_size,
outerPrefix =
position_grid_in_outer == "far" ? outerDelta :
position_grid_in_outer == "center" ? outerDelta / 2 : 0,
gridPrefix =
position_fill_grid == "near" ? gf_size - floor(gf_size) :
position_fill_grid == "center" ? (gf_size - floor(gf_size)) / 2 : 0,
size1 = outerSize <= plate_size ? gf_size : gridPrefix + floor(plate_size - max(outerPrefix, gridPrefix)),
outer1 = outerSize <= plate_size ? outerSize : outerPrefix + floor(plate_size - outerPrefix),
remSize = max(0, gf_size - size1),
remOuter = max(0, outerSize - max(outer1, size1)))
let(
next = remSize > 0 || remOuter > 0 ? split_dimention(remSize, remOuter, plate_size, "far", "near"): [],
posOuter = position_grid_in_outer == "center" && gf_size > plate_size ? "far" : position_grid_in_outer,
posGrid = position_fill_grid == "center" && gf_size > plate_size ? "near" : position_fill_grid
)
concat([[size1, posGrid, outer1 <= size1 ? 0 : outer1, posOuter]], next);
function split_plate(num_x, num_y,
outer_num_x,
outer_num_y,
position_fill_grid_x,
position_fill_grid_y,
position_grid_in_outer_x,
position_grid_in_outer_y,
build_plate_size) =
let(
max_x = build_plate_size.x / gf_pitch,
max_y = build_plate_size.y / gf_pitch,
list_x = split_dimention(num_x, outer_num_x, max_x, position_fill_grid_x, position_grid_in_outer_x),
list_y = split_dimention(num_y, outer_num_y, max_y, position_fill_grid_y, position_grid_in_outer_y),
list = [for (iy = [0:len(list_y) - 1]) [for (ix = [0:len(list_x) - 1]) [[ix, iy], [list_x[ix], list_y[iy]]]]])
[for (iy = [0:len(list) - 1]) [for (ix = [0:len(list[iy]) - 1]) let(plate = list[iy][ix]) [plate[0], plate[1],
check_plate_duplicate_y(plate, list)]]];
function check_plate_duplicate_y(plate, plate_list, y = 0, end) =
assert(is_list(plate), "plate must be a list")
assert(is_list(plate_list), "plate_list must be a list")
assert(is_num(y), "y must be a number")
let(end = is_undef(end) ? len(plate_list) : end)
y > len(plate_list) - 1 || y > end ? false
: check_plate_duplicate_x(plate, plate_list[y])
|| check_plate_duplicate_y(plate, plate_list, y = y + 1);
function check_plate_duplicate_x(plate, plate_list_y, x = 0, end) =
assert(is_list(plate), "plate must be a list")
assert(is_list(plate_list_y), "plate_list_y must be a list")
assert(is_num(x), "x must be a number")
//echo("check_plate_duplicate_x", plate=plate)
let(end = is_undef(end) ? len(plate_list_y) : end)
x > len(plate_list_y) - 1 || x > end ? false
: let(comparePlate = plate_list_y[x],
isDupe = (comparePlate[0][0] < plate[0][0] ||
(comparePlate[0][0] == plate[0][0] && comparePlate[0][1] < plate[0][1])) &&
plate[1][0][iPlate_size] == comparePlate[1][0][iPlate_size] &&
(plate[1][0][iPlate_size] == floor(plate[1][0][iPlate_size]) || plate[1][0][iPlate_posGrid] == comparePlate[1][0][
iPlate_posGrid]) &&
plate[1][0][iPlate_outerSize] == comparePlate[1][0][iPlate_outerSize] &&
(plate[1][0][iPlate_outerSize] == 0 || plate[1][0][iPlate_posOuter] == comparePlate[1][0][iPlate_posOuter]) &&
plate[1][1][iPlate_size] == comparePlate[1][1][iPlate_size] &&
(plate[1][1][iPlate_size] == floor(plate[1][1][iPlate_size]) || plate[1][1][iPlate_posGrid] == comparePlate[1][1][
iPlate_posGrid]) &&
plate[1][1][iPlate_outerSize] == comparePlate[1][1][iPlate_outerSize] &&
(plate[1][1][iPlate_outerSize] == 0 || plate[1][1][iPlate_posOuter] == comparePlate[1][1][iPlate_posOuter]))
isDupe || check_plate_duplicate_x(plate, plate_list_y, x = x + 1, end);
iPlate_size = 0;
iPlate_posGrid = 1;
iPlate_outerSize = 2;
iPlate_posOuter = 3;
if (Butterfly_Clip_Only)
{
ButterFly(
size = [
Butterfly_Clip_Size.x + Butterfly_Clip_Tolerance,
Butterfly_Clip_Size.y + Butterfly_Clip_Tolerance,
Butterfly_Clip_Size.z],
r = Butterfly_Clip_Radius);
}
else
{
plate_list = let(
num_x = calcDimensionWidth(Width),
num_y = calcDimensionDepth(Depth),
outer_num_x = calcDimensionWidth(outer_Width),
outer_num_y = calcDimensionWidth(outer_Depth))
(build_plate_enabled == "disabled" || build_plate_size.x <= 0 || build_plate_size.y <= 0)
? [[[[0, 0], [[num_x, position_fill_grid_x, outer_num_x, position_grid_in_outer_x],
[num_y, position_fill_grid_y, outer_num_y, position_grid_in_outer_y]], false]]]
:split_plate(
num_x = num_x,
num_y = num_y,
outer_num_x = outer_num_x,
outer_num_y = outer_num_y,
position_fill_grid_x = position_fill_grid_x,
position_fill_grid_y = position_fill_grid_y,
position_grid_in_outer_x = position_grid_in_outer_x,
position_grid_in_outer_y = position_grid_in_outer_y,
build_plate_size = build_plate_size);
for (iy = [0:len(plate_list) - 1])
let(listy = plate_list[iy])
for (ix = [0:len(listy) - 1]) {
plate = listy[ix];
pos = [
ix * build_plate_size.x + ix * 5,
iy * build_plate_size.y + iy * 5,
0];
if (build_plate_enabled == "unique" && !plate[2] || build_plate_enabled != "unique")
conditional_color(true, plate[2] ? "#00640050" : "#006400")
translate(pos)
conditional_render(true)//plate[2])
SetGridfinityEnvironment(
width = plate[1].x[iPlate_size],
depth = plate[1].y[iPlate_size],
render_position = Render_Position,
help = enable_help,
cutx = cutx,
cuty = cuty,
cutz = 2)
gridfinity_baseplate(
num_x = plate[1].x[iPlate_size], //calcDimensionWidth(Width),
num_y = plate[1].y[iPlate_size], //calcDimensionWidth(Depth),
outer_num_x = plate[1].x[iPlate_outerSize], //calcDimensionWidth(outer_Width),
outer_num_y = plate[1].y[iPlate_outerSize], //calcDimensionWidth(outer_Depth),
outer_height = outer_Height,
position_fill_grid_x = plate[1].x[iPlate_posGrid], //position_fill_grid_x,
position_fill_grid_y = plate[1].y[iPlate_posGrid], //position_fill_grid_y,
position_grid_in_outer_x = plate[1].x[iPlate_posOuter], //position_grid_in_outer_x,
position_grid_in_outer_y = plate[1].y[iPlate_posOuter], //position_grid_in_outer_y,
plate_corner_radius = plate_corner_radius,
magnetSize = Enable_Magnets ? Magnet_Size : [0, 0],
reducedWallHeight = Reduced_Wall_Height,
reduceWallTaper = Reduced_Wall_Taper,
cornerScrewEnabled = Corner_Screw_Enabled,
centerScrewEnabled = Center_Screw_Enabled,
weightedEnable = Enable_Weight,
oversizeMethod = oversize_method,
plateOptions = Base_Plate_Options,
customGridEnabled = Custom_Grid_Enabled,
gridPositions = [xpos1, xpos2, xpos3, xpos4, xpos5, xpos6, xpos7],
butterflyClipEnabled = Butterfly_Clip_Enabled,
butterflyClipSize = Butterfly_Clip_Size,
butterflyClipRadius = Butterfly_Clip_Radius,
filamentClipEnabled = Filament_Clip_Enabled,
filamentClipDiameter = Filament_Clip_Diameter,
filamentClipLength = Filament_Clip_Length);
}
}
module conditional_color(enable = true, c) {
if (enable)
color(c)
children();
else
children();
}
module conditional_render(enable = true) {
if (enable)
render()
children();
else
union()
children();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment