From 436a99a0d61096aed987572e0b17978970a82d57 Mon Sep 17 00:00:00 2001 From: Danilo Sanchi Date: Sat, 7 Jun 2025 18:39:41 +0200 Subject: [PATCH 1/4] WIP --- gridfinity_basic_cup.json | 60 +------ gridfinity_basic_cup.scad | 16 +- modules/module_gridfinity.scad | 14 +- modules/module_gridfinity_cup.scad | 239 +++++++++++++++++---------- modules/module_gridfinity_label.scad | 12 +- modules/module_lip.scad | 15 +- 6 files changed, 184 insertions(+), 172 deletions(-) diff --git a/gridfinity_basic_cup.json b/gridfinity_basic_cup.json index 8032ff3..c2808d4 100644 --- a/gridfinity_basic_cup.json +++ b/gridfinity_basic_cup.json @@ -4,24 +4,13 @@ "Label": { "box_corner_attachments_only": "true", "cavity_floor_radius": "-1", - "center_magnet_diameter": "0", - "center_magnet_thickness": "0", "chamber_wall_thickness": "1.2", "cutx": "0", "cuty": "0", - "depth": "1", - "efficient_floor": "false", - "enable_help": "false", - "extention_tabs_enabled": "true", - "extention_x_enabled": "false", - "extention_y_enabled": "false", - "filled_in": "off", "fingerslide": "rounded", "fingerslide_radius": "8", - "flat_base": "false", "floor_thickness": "0.69999999999999996", "half_pitch": "false", - "height": "4", "hole_overhang_remedy": "2", "horizontal_chambers": "1", "horizontal_irregular_subdivisions": "false", @@ -30,13 +19,8 @@ "horizontal_separator_bend_separation": "0", "horizontal_separator_config": "10.5|21|42|50|60", "horizontal_separator_cut_depth": "0", - "label": "leftchamber", - "label_relief": "0", "label_size": "[0, 14, 0, 0.6]", "lip_style": "normal", - "magnet_diameter": "0", - "position": "default", - "screw_depth": "0", "spacer": "false", "tapered_corner": "none", "tapered_corner_size": "10", @@ -49,46 +33,23 @@ "vertical_separator_config": "10.5|21|42|50|60", "vertical_separator_cut_depth": "0", "wall_thickness": "0", - "wallcutout_angle": "70", - "wallcutout_corner_radius": "5", - "wallcutout_enabled": "false", - "wallcutout_height": "0", - "wallcutout_walls": "[1, 0, 0, 0]", - "wallcutout_width": "0", - "wallpattern_dividers_enabled": "false", "wallpattern_enabled": "false", "wallpattern_fill": "none", "wallpattern_hole_sides": "6", - "wallpattern_hole_size": "10", "wallpattern_hole_spacing": "2", "wallpattern_style": "grid", - "wallpattern_voronoi_noise": "0.75", - "wallpattern_voronoi_radius": "0.5", - "wallpattern_walls": "[1, 1, 1, 1]", - "width": "1", - "zClearance": "2" + "wallpattern_walls": "[1, 1, 1, 1]" }, "solid": { "box_corner_attachments_only": "true", "cavity_floor_radius": "-1", - "center_magnet_diameter": "0", - "center_magnet_thickness": "0", "chamber_wall_thickness": "1.2", "cutx": "0", "cuty": "0", - "depth": "4", - "efficient_floor": "false", - "enable_help": "false", - "extention_tabs_enabled": "true", - "extention_x_enabled": "false", - "extention_y_enabled": "false", - "filled_in": "on", "fingerslide": "none", "fingerslide_radius": "8", - "flat_base": "false", "floor_thickness": "0.69999999999999996", "half_pitch": "false", - "height": "3", "hole_overhang_remedy": "2", "horizontal_chambers": "1", "horizontal_irregular_subdivisions": "false", @@ -97,13 +58,8 @@ "horizontal_separator_bend_separation": "0", "horizontal_separator_config": "10.5|21|42|50|60", "horizontal_separator_cut_depth": "0", - "label": "disabled", - "label_relief": "0", "label_size": "[0, 14, 0, 0.6]", "lip_style": "normal", - "magnet_diameter": "0", - "position": "center", - "screw_depth": "0", "spacer": "false", "tapered_corner": "none", "tapered_corner_size": "10", @@ -116,24 +72,12 @@ "vertical_separator_config": "10.5|21|42|50|60", "vertical_separator_cut_depth": "0", "wall_thickness": "0", - "wallcutout_angle": "70", - "wallcutout_corner_radius": "5", - "wallcutout_enabled": "false", - "wallcutout_height": "0", - "wallcutout_walls": "[1, 0, 0, 0]", - "wallcutout_width": "0", - "wallpattern_dividers_enabled": "false", "wallpattern_enabled": "false", "wallpattern_fill": "none", "wallpattern_hole_sides": "6", - "wallpattern_hole_size": "10", "wallpattern_hole_spacing": "2", "wallpattern_style": "grid", - "wallpattern_voronoi_noise": "0.75", - "wallpattern_voronoi_radius": "0.5", - "wallpattern_walls": "[1, 1, 1, 1]", - "width": "2", - "zClearance": "0" + "wallpattern_walls": "[1, 1, 1, 1]" } } } diff --git a/gridfinity_basic_cup.scad b/gridfinity_basic_cup.scad index 751dead..7e1182e 100644 --- a/gridfinity_basic_cup.scad +++ b/gridfinity_basic_cup.scad @@ -18,7 +18,7 @@ width = [2, 0]; //0.1 // Y dimension. grid units (multiples of 42mm) or mm. depth = [1, 0]; //0.1 // Z dimension excluding. grid units (multiples of 7mm) or mm. -height = [3, 0]; //0.1 +height = [6, 0]; //0.1 // Fill in solid block (overrides all following options) filled_in = "disabled"; //[disabled, enabled, enabledfilllip:"Fill cup and lip"] // 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) @@ -28,7 +28,7 @@ headroom = 0.8; // 0.1 /* [Cup Lip] */ // Style of the cup lip -lip_style = "normal"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] +lip_style = "reduced_double"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] // Below this the inside of the lip will be reduced for easier access. lip_side_relief_trigger = [1,1]; //0.1 // Create a relief in the lip @@ -122,11 +122,11 @@ flat_base_rounded_radius = -1; flat_base_rounded_easyPrint = -1; /* [Label] */ -label_style = "disabled"; //[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"; //[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] // Include overhang for labeling (and specify left/right/center justification) label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber] // 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 +label_size = [0,10,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; @@ -145,7 +145,7 @@ sliding_lid_lip_enabled = false; /* [Finger Slide] */ // Include larger corner fillet -fingerslide = "none"; //[none, rounded, chamfered] +fingerslide = "rounded"; //[none, rounded, chamfered] // Radius of the corner fillet, 0:none, >1: radius in mm, <0 dimention/abs(n) (i.e. -3 is 1/3 the width) fingerslide_radius = 8; // wall to enable on, front, back, left, right. 0: disabled; 1: enabled using radius; >1: override radius. @@ -291,7 +291,7 @@ module end_of_customizer_opts() {} $fa = fa; $fs = fs; $fn = fn; - +intersection() { set_environment( width = width, depth = depth, @@ -431,3 +431,7 @@ gridfinity_cup( baseTextFontSize = text_size, baseTextFont = text_font, baseTextDepth = text_depth)); + + +// cube([500, 500, 500]); +} \ No newline at end of file diff --git a/modules/module_gridfinity.scad b/modules/module_gridfinity.scad index e1e07a5..ebf04a6 100644 --- a/modules/module_gridfinity.scad +++ b/modules/module_gridfinity.scad @@ -4,7 +4,7 @@ include include include include -include +include module pad_grid(num_x, num_y, half_pitch=false, flat_base="off", minimium_size = 0.2) { assert(is_num(num_x)); @@ -149,11 +149,11 @@ module pad_oversize( hull() cornercopy(pad_corner_position, num_x, num_y) { if (sharp_corners) { translate(bevel2_bottom) - cylsq2(d1=3.2+2*radialgap, d2=7.5+0.5+2*radialgap+2*bonus_ht, h=bevel2_top-bevel2_bottom+bonus_ht); + cylsq2(d1=3.2+2*radialgap-clr*2, d2=7.5+0.5+2*radialgap+2*bonus_ht-clr*2, h=bevel2_top-bevel2_bottom+bonus_ht); } else { - tz(bevel2_bottom) - cylinder(d1=3.2+2*radialgap, d2=7.5+0.5+2*radialgap+2*bonus_ht, h=bevel2_top-bevel2_bottom+bonus_ht); + tz(bevel2_bottom) + cylinder(d1=3.2+2*radialgap-clr*2, d2=7.5+0.5+2*radialgap+2*bonus_ht-clr*2, h=bevel2_top-bevel2_bottom+bonus_ht); } } } @@ -162,14 +162,14 @@ module pad_oversize( hull() cornercopy(pad_corner_position, num_x, num_y) { if (sharp_corners) { - cylsq(d=1.6+2*radialgap, h=0.1); + cylsq(d=1.6+2*radialgap-clr*2, h=0.1); translate([0, 0, bevel1_top]) cylsq(d=3.2+2*radialgap, h=1.9+bevel2_top-bevel2_bottom+bonus_ht); } else { - cylinder(d=remove_bottom_taper ? 3.2+2*radialgap : 1.6+2*radialgap, h=0.1); + cylinder(d=remove_bottom_taper ? 3.2+2*radialgap-clr*2 : 1.6+2*radialgap-clr*2, h=0.1); translate([0, 0, bevel1_top]) - cylinder(d=3.2+2*radialgap, h=1.9+bevel2_top-bevel2_bottom+bonus_ht); + cylinder(d=3.2+2*radialgap-clr*2, h=1.9+bevel2_top-bevel2_bottom+bonus_ht); } } } diff --git a/modules/module_gridfinity_cup.scad b/modules/module_gridfinity_cup.scad index 300faff..1293fec 100644 --- a/modules/module_gridfinity_cup.scad +++ b/modules/module_gridfinity_cup.scad @@ -437,36 +437,103 @@ module gridfinity_cup( ? wallpattern_dividers_enabled ? "vertical" : "disabled" : wallpattern_dividers_enabled; - debug_cut() +// debug_cut() union(){ +// difference() { +// grid_block( +// num_x, num_y, num_z, +// cupBase_settings = cupBase_settings, +// wall_thickness = wall_thickness, +// lip_settings = lip_settings, +// filledin = filled_in); + difference() { - grid_block( + intersection() { + gridfinity_label( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + vertical_separator_positions = calculated_vertical_separator_positions, + horizontal_separator_positions = calculated_horizontal_separator_positions, + label_settings = label_settings, + render_option = "labelwithsocket"); + + partitioned_cavity( num_x, num_y, num_z, + label_settings=label_settings, cupBase_settings = cupBase_settings, - wall_thickness = wall_thickness, - lip_settings = lip_settings, - filledin = filled_in); - + fingerslide=fingerslide, + fingerslide_radius=fingerslide_radius, + fingerslide_walls=fingerslide_walls, + fingerslide_lip_aligned=fingerslide_lip_aligned, + wall_thickness=wall_thickness+clr, + chamber_wall_thickness=chamber_wall_thickness, + chamber_wall_headroom=chamber_wall_headroom, + calculated_vertical_separator_positions = calculated_vertical_separator_positions, + calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, + lip_settings=lip_settings, + headroom=headroom, + sliding_lid_settings= slidingLidSettings, + divider_wall_removable_settings = divider_wall_removable_settings); + } + + + label_size = calculateLabelSize(label_settings[iLabelSettings_size]); + labelCornerRadius = label_size[3]; + lipHeight = 3.75; + tz(-lipHeight - labelCornerRadius) + tz(zpoint) + cupLip( + num_x = num_x, + num_y = num_y, + lipStyle = lip_settings[iLipStyle], + wall_thickness = wall_thickness, + lip_notches = false, + lip_top_relief_height = lip_settings[iLipTopReliefHeight], + lip_top_relief_width = lip_settings[iLipTopReliefWidth], + lip_clip_position = lip_settings[iLipClipPosition], + lip_non_blocking = lip_settings[iLipNonBlocking] + ); + +// label_size = calculateLabelSize(label_settings[iLabelSettings_size]); +// labelCornerRadius = label_size[3]; +// lipHeight = 3.75; +// tz(-lipHeight - labelCornerRadius) +// tz(zpoint) +// #cupLip( +// num_x = num_x, +// num_y = num_y, +// lipStyle = lip_settings[iLipStyle], +// wall_thickness = wall_thickness, +// lip_notches = false, +// lip_top_relief_height = lip_settings[iLipTopReliefHeight], +// lip_top_relief_width = lip_settings[iLipTopReliefWidth], +// lip_clip_position = lip_settings[iLipClipPosition], +// lip_non_blocking = lip_settings[iLipNonBlocking] +// ); + } + if(filled_in == FilledIn_disabled) union(){ //primary cavity - partitioned_cavity( - num_x, num_y, num_z, - label_settings=label_settings, - cupBase_settings = cupBase_settings, - fingerslide=fingerslide, - fingerslide_radius=fingerslide_radius, - fingerslide_walls=fingerslide_walls, - fingerslide_lip_aligned=fingerslide_lip_aligned, - wall_thickness=wall_thickness, - chamber_wall_thickness=chamber_wall_thickness, - chamber_wall_headroom=chamber_wall_headroom, - calculated_vertical_separator_positions = calculated_vertical_separator_positions, - calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, - lip_settings=lip_settings, - headroom=headroom, - sliding_lid_settings= slidingLidSettings, - divider_wall_removable_settings = divider_wall_removable_settings); + +// partitioned_cavity( +// num_x, num_y, num_z, +// label_settings=label_settings, +// cupBase_settings = cupBase_settings, +// fingerslide=fingerslide, +// fingerslide_radius=fingerslide_radius, +// fingerslide_walls=fingerslide_walls, +// fingerslide_lip_aligned=fingerslide_lip_aligned, +// wall_thickness=wall_thickness, +// chamber_wall_thickness=chamber_wall_thickness, +// chamber_wall_headroom=chamber_wall_headroom, +// calculated_vertical_separator_positions = calculated_vertical_separator_positions, +// calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, +// lip_settings=lip_settings, +// headroom=headroom, +// sliding_lid_settings= slidingLidSettings, +// divider_wall_removable_settings = divider_wall_removable_settings); color(env_colour(color_wallcutout)) union(){ @@ -559,10 +626,10 @@ module gridfinity_cup( if(floor_pattern_settings[iPatternEnabled]){ difference(){ pad_copy( - num_x = num_x, - num_y = num_y, - half_pitch = cupBase_settings[iCupBase_HalfPitch], - flat_base = cupBase_settings[iCupBase_FlatBase], + num_x = num_x, + num_y = num_y, + half_pitch = cupBase_settings[iCupBase_HalfPitch], + flat_base = cupBase_settings[iCupBase_FlatBase], minimium_size = cupBase_settings[iCupBase_MinimumPrintablePadSize]) translate([$pad_copy_size.x*env_pitch().x/2, $pad_copy_size.y*env_pitch().y/2,-fudgeFactor]) cutout_pattern( @@ -605,15 +672,15 @@ module gridfinity_cup( border = 0; //Believe this to be no longer needed wallpatternzpos = wallpatternClearanceHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], floor_thickness = cupBase_settings[iCupBase_FloorThickness], - num_z=num_z, - filled_in=FilledIn_disabled, - efficient_floor=efficient_floor, - flat_base=cupBase_settings[iCupBase_FlatBase], - floor_inner_radius = cavityFloorRadius, + num_z=num_z, + filled_in=FilledIn_disabled, + efficient_floor=efficient_floor, + flat_base=cupBase_settings[iCupBase_FlatBase], + floor_inner_radius = cavityFloorRadius, outer_cup_radius = 1); //I feel this should use wallTop, but it seems to work... @@ -634,8 +701,8 @@ module gridfinity_cup( [num_x*env_pitch().x-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x/2, - gf_tolerance/2+wall_thickness/2, + [(num_x)*env_pitch().x/2, + gf_tolerance/2+wall_thickness/2, z - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)/2], //rotation [90,0,0], @@ -646,11 +713,11 @@ module gridfinity_cup( [num_x*env_pitch().x-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x/2, - (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, + [(num_x)*env_pitch().x/2, + (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, z - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)/2], //rotation - [90,0,0], + [90,0,0], //enabled wallpattern_walls[1]]; left = [ @@ -658,8 +725,8 @@ module gridfinity_cup( [num_y*env_pitch().y-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)], //Position - [gf_tolerance/2+wall_thickness/2, - (num_y)*env_pitch().y/2, + [gf_tolerance/2+wall_thickness/2, + (num_y)*env_pitch().y/2, z - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)/2], //rotation [90,0,90], @@ -670,8 +737,8 @@ module gridfinity_cup( [num_y*env_pitch().y-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, - (num_y)*env_pitch().y/2, + [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, + (num_y)*env_pitch().y/2, z - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)/2], //rotation [90,0,90], @@ -712,16 +779,16 @@ module gridfinity_cup( if(wallpattern_dividers_enabled == "vertical" || wallpattern_dividers_enabled == "both") position_separators( - calculatedSeparators = calculated_vertical_separator_positions, + calculatedSeparators = calculated_vertical_separator_positions, separator_orientation = "vertical") let(verSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) - translate([-verSepThickness/2, left[1].y, left[1].z]) + translate([-verSepThickness/2, left[1].y, left[1].z]) rotate(left[2]) render_conditional(env_force_render()) //separator wall pattern cutout_pattern( patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = left[0], + canvasSize = left[0], border = wall_pattern_settings[iPatternBorder], customShape = false, circleFn = wall_pattern_settings[iPatternHoleSides], @@ -736,8 +803,8 @@ module gridfinity_cup( holeRadius = wall_pattern_settings[iPatternHoleRadius], source="vertical separator wall pattern", patternFs = wall_pattern_settings[iPatternFs]); - } - + } + //subtract dividers from wall patterns translate([env_pitch().x*num_x, 0, -fudgeFactor]) separators( @@ -745,7 +812,7 @@ module gridfinity_cup( separator_orientation = "horizontal", override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); } - + //patterns in the outer walls y difference(){ union(){ @@ -775,7 +842,7 @@ module gridfinity_cup( if(wallpattern_dividers_enabled == "horizontal" || wallpattern_dividers_enabled == "both") position_separators( - calculatedSeparators = calculated_horizontal_separator_positions, + calculatedSeparators = calculated_horizontal_separator_positions, separator_orientation = "horizontal") let(hozSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) rotate([0,0,-90]) @@ -785,7 +852,7 @@ module gridfinity_cup( //separator wall pattern cutout_pattern( patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = front[0], + canvasSize = front[0], border = wall_pattern_settings[iPatternBorder], customShape = false, circleFn = wall_pattern_settings[iPatternHoleSides], @@ -793,7 +860,7 @@ module gridfinity_cup( holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], holeHeight = hozSepThickness, center = true, - fill = wall_pattern_settings[iPatternFill], + fill = wall_pattern_settings[iPatternFill], patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], @@ -801,7 +868,7 @@ module gridfinity_cup( source = "horizontal separator wall pattern", patternFs = wall_pattern_settings[iPatternFs]); } - + //subtract dividers from outer wall pattern translate([0, 0, -fudgeFactor]) separators( @@ -811,7 +878,7 @@ module gridfinity_cup( } } } - + //Subtract setback from wall pattern if(tapered_corner == "rounded" || tapered_corner == "chamfered") { translate([ @@ -822,18 +889,18 @@ module gridfinity_cup( union() if(tapered_corner == "rounded"){ roundedCorner( - radius = tapered_corner_size+cutoutclearance_border*2, - length=(num_x)*env_pitch().x, + radius = tapered_corner_size+cutoutclearance_border*2, + length=(num_x)*env_pitch().x, height = tapered_corner_size); } else if(tapered_corner == "chamfered"){ chamferedCorner( - chamferLength = tapered_corner_size, - length=(num_x)*env_pitch().x, + chamferLength = tapered_corner_size, + length=(num_x)*env_pitch().x, height = max((num_x)*env_pitch().x, (num_z)*env_pitch().z), angled_extension =false); } - } + } //Subtract cutout from wall pattern if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) @@ -896,7 +963,7 @@ module gridfinity_cup( else translate([0,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),-fudgeFactor]) cube([env_pitch().x*num_x,num_y*env_pitch().x-unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); - } +// } if((extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled || extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_disabled) && extendable_Settings[iExtendableTabsEnabled]) { refTabHeight = extendable_Settings[iExtendableTabSize].x; @@ -960,24 +1027,24 @@ module gridfinity_cup( } } - if (lip_settings[iLipStyle] == "reduced_double") { - label_size=calculateLabelSize(label_settings[iLabelSettings_size]); - labelCornerRadius = label_size[3]; - lipHeight = 3.75; - tz(- lipHeight -labelCornerRadius) - tz(zpoint) - cupLip( - num_x = num_x, - num_y = num_y, - lipStyle = lip_settings[iLipStyle], - wall_thickness = wall_thickness, - lip_notches = false, - lip_top_relief_height = lip_settings[iLipTopReliefHeight], - lip_top_relief_width = lip_settings[iLipTopReliefWidth], - lip_clip_position = lip_settings[iLipClipPosition], - lip_non_blocking = lip_settings[iLipNonBlocking]); - - } +// if (lip_settings[iLipStyle] == "reduced_double") { +// label_size=calculateLabelSize(label_settings[iLabelSettings_size]); +// labelCornerRadius = label_size[3]; +// lipHeight = 3.75; +// tz(- lipHeight -labelCornerRadius) +// tz(zpoint) +// cupLip( +// num_x = num_x, +// num_y = num_y, +// lipStyle = lip_settings[iLipStyle], +// wall_thickness = wall_thickness, +// lip_notches = false, +// lip_top_relief_height = lip_settings[iLipTopReliefHeight], +// lip_top_relief_width = lip_settings[iLipTopReliefWidth], +// lip_clip_position = lip_settings[iLipClipPosition], +// lip_non_blocking = lip_settings[iLipNonBlocking]); +// +// } } if(divider_wall_removable_settings[iDividerRemovable_Enabled]) @@ -1124,19 +1191,9 @@ module partitioned_cavity(num_x, num_y, num_z, separators( calculatedSeparators = calculated_horizontal_separator_positions, separator_orientation = "horizontal"); - - if(label_settings[iLabelSettings_style] != LabelStyle_disabled){ - gridfinity_label( - num_x = num_x, - num_y = num_y, - zpoint = zpoint, - vertical_separator_positions = calculated_vertical_separator_positions, - horizontal_separator_positions = calculated_horizontal_separator_positions, - label_settings=label_settings, - render_option = "labelwithsocket"); - } + } -} +} module basic_cavity(num_x, num_y, num_z, fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius,fingerslide_walls,fingerslide_lip_aligned=default_fingerslide_lip_aligned, diff --git a/modules/module_gridfinity_label.scad b/modules/module_gridfinity_label.scad index 3a3eabc..96f6a10 100644 --- a/modules/module_gridfinity_label.scad +++ b/modules/module_gridfinity_label.scad @@ -191,10 +191,14 @@ module gridfinity_label( for(l = [0:1:len(wallLocations)-1]){ wallLocation = wallLocations[l]; separator_positions = wallLocation[ilabelWall_SeparatorConfig];//calculateSeparators(wallLocation[3]); - + + label_thickness = 3; + ratio=label_thickness/(label_size.y+labelCornerRadius); + labelPoints = [[ 0-labelSize.y, -labelCornerRadius], - [ 0, -labelCornerRadius ], - [ 0, -labelCornerRadius-labelSize.z ] + [ 0, -labelCornerRadius], + [ 0, -labelCornerRadius-labelSize.z*ratio ], + [ 0-labelSize.y*(1-ratio), -labelCornerRadius-labelSize.z*ratio ] ]; labelWidthmm = labelSize.x <=0 ? wallLocation[ilabelWall_Width] : labelSize.x * wallLocation[6]; @@ -234,7 +238,7 @@ module gridfinity_label( difference(){ if(render_option == "label" || render_option == "labelwithsocket") union(){ - hull() for (y=[0, 1, 2]) + hull() for (y=[0, 1, 2, 3]) translate([0, labelPoints[y][0], labelPoints[y][1]]) rotate([0, 90, 0]) union(){ diff --git a/modules/module_lip.scad b/modules/module_lip.scad index 6c4f0aa..287576e 100644 --- a/modules/module_lip.scad +++ b/modules/module_lip.scad @@ -2,6 +2,9 @@ include include include + +clr = 0; +clr = 0.1; //Lip object configuration iLipStyle=0; iLipSideReliefTrigger=1; @@ -165,21 +168,21 @@ module cupLip( if (lipStyle == "minimum" || lipStyle == "none") { hull() cornercopy(seventeen, num_x, num_y) - tz(-fudgeFactor) + tz(-fudgeFactor) cylinder(r=innerWallRadius, h=gf_Lip_Height); // remove entire lip } else if (lipStyle == "reduced" || lipStyle == "reduced_double") { lowerTaperZ = gf_lip_lower_taper_height; hull() cornercopy(seventeen, num_x, num_y) union(){ - tz(lowerTaperZ) + tz(lowerTaperZ) cylinder( - r1=innerWallRadius, - r2=gf_cup_corner_radius-gf_lip_upper_taper_height, + r1=innerWallRadius-clr, + r2=gf_cup_corner_radius-gf_lip_upper_taper_height-clr, h=lipSupportThickness); - tz(-fudgeFactor) + tz(-fudgeFactor) cylinder( - r=innerWallRadius, + r=innerWallRadius-clr, h=lowerTaperZ+fudgeFactor*2); } } From ce4809962a5c227b5cedd4c139d9ed4ef9b2f9f2 Mon Sep 17 00:00:00 2001 From: Danilo Sanchi Date: Tue, 10 Jun 2025 23:32:51 +0200 Subject: [PATCH 2/4] WIP --- gridfinity_basic_cup.scad | 16 +- gridfinity_removable_label.scad | 434 +++++ modules/module_gridfinity.scad | 3 +- modules/module_gridfinity_cup.scad | 130 +- modules/module_gridfinity_label.scad | 33 +- .../module_gridfinity_removable_label.scad | 1470 +++++++++++++++++ modules/module_lip.scad | 9 +- 7 files changed, 1978 insertions(+), 117 deletions(-) create mode 100644 gridfinity_removable_label.scad create mode 100644 modules/module_gridfinity_removable_label.scad diff --git a/gridfinity_basic_cup.scad b/gridfinity_basic_cup.scad index 7e1182e..751dead 100644 --- a/gridfinity_basic_cup.scad +++ b/gridfinity_basic_cup.scad @@ -18,7 +18,7 @@ width = [2, 0]; //0.1 // Y dimension. grid units (multiples of 42mm) or mm. depth = [1, 0]; //0.1 // Z dimension excluding. grid units (multiples of 7mm) or mm. -height = [6, 0]; //0.1 +height = [3, 0]; //0.1 // Fill in solid block (overrides all following options) filled_in = "disabled"; //[disabled, enabled, enabledfilllip:"Fill cup and lip"] // 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) @@ -28,7 +28,7 @@ headroom = 0.8; // 0.1 /* [Cup Lip] */ // Style of the cup lip -lip_style = "reduced_double"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] +lip_style = "normal"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] // Below this the inside of the lip will be reduced for easier access. lip_side_relief_trigger = [1,1]; //0.1 // Create a relief in the lip @@ -122,11 +122,11 @@ flat_base_rounded_radius = -1; flat_base_rounded_easyPrint = -1; /* [Label] */ -label_style = "normal"; //[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 = "disabled"; //[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] // Include overhang for labeling (and specify left/right/center justification) label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber] // 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,10,0,0.6]; // 0.01 +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; @@ -145,7 +145,7 @@ sliding_lid_lip_enabled = false; /* [Finger Slide] */ // Include larger corner fillet -fingerslide = "rounded"; //[none, rounded, chamfered] +fingerslide = "none"; //[none, rounded, chamfered] // Radius of the corner fillet, 0:none, >1: radius in mm, <0 dimention/abs(n) (i.e. -3 is 1/3 the width) fingerslide_radius = 8; // wall to enable on, front, back, left, right. 0: disabled; 1: enabled using radius; >1: override radius. @@ -291,7 +291,7 @@ module end_of_customizer_opts() {} $fa = fa; $fs = fs; $fn = fn; -intersection() { + set_environment( width = width, depth = depth, @@ -431,7 +431,3 @@ gridfinity_cup( baseTextFontSize = text_size, baseTextFont = text_font, baseTextDepth = text_depth)); - - -// cube([500, 500, 500]); -} \ No newline at end of file diff --git a/gridfinity_removable_label.scad b/gridfinity_removable_label.scad new file mode 100644 index 0000000..d968fdb --- /dev/null +++ b/gridfinity_removable_label.scad @@ -0,0 +1,434 @@ +// Gridfinity extended basic cup +// version 2024-02-17 +// +// Source +// https://www.printables.com/model/630057-gridfinity-extended-openscad +// +// Documentation +// https://docs.ostat.com/docs/openscad/gridfinity-extended/basic-cup + +include +use +use +use + +/**/ +/* [General Cup] */ +// X dimension. grid units (multiples of 42mm) or mm. +width = [1, 0]; //0.1 +// Y dimension. grid units (multiples of 42mm) or mm. +depth = [1, 0]; //0.1 +// Z dimension excluding. grid units (multiples of 7mm) or mm. +height = [3, 0]; //0.1 +// Fill in solid block (overrides all following options) +filled_in = "disabled"; //[disabled, enabled, enabledfilllip:"Fill cup and lip"] +// 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 +//under size the bin top by this amount to allow for better stacking +headroom = 0.8; // 0.1 + +/* [Cup Lip] */ +// Style of the cup lip +lip_style = "reduced_double"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] +// Below this the inside of the lip will be reduced for easier access. +lip_side_relief_trigger = [1,1]; //0.1 +// Create a relief in the lip +lip_top_relief_height = -1; // 0.1 +// how much of the lip to retain on each end +lip_top_relief_width = -1; // 0.1 +// add a notch to the lip to prevent sliding. +lip_top_notches = true; +// enable lip clip for connection cups +lip_clip_position = "disabled"; //[disabled, intersection, center_wall, both] +//allow stacking when bin is not multiples of 42 +lip_non_blocking = false; + +/* [Subdivisions] */ +chamber_wall_thickness = 1.2; +//Reduce the wall height by this amount +chamber_wall_headroom = 0;//0.1 +// X dimension subdivisions +vertical_chambers = 1; +vertical_separator_bend_position = 0; +vertical_separator_bend_angle = 0; +vertical_separator_bend_separation = 0; +vertical_separator_cut_depth=0; +horizontal_chambers = 1; +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"; + +/* [Removable Divider Walls] */ +divider_walls_enabled = false; +// Wall to enable on, x direction, y direction +divider_walls = [1,1]; //[0:1:1] +// Thickness of the divider walls. +divider_walls_thickness = 2.5; //0.1 +// Spacing between the divider walls (0=divider_walls_thickness*2). +divider_walls_spacing = 0; //0.1 +// Thickness of the support walls (0=walls_thickness*2). +divider_walls_support_thickness = 2; +// Size of the slot in the divider walls. width(0=divider_walls_thickness), depth(0=divider_walls_support_thickness) +divider_wall_slot_size = [0,0]; +// Clearance between the divider walls top +divider_headroom = 0.1; +// Clearance subtracted from the removable divider wall. Width, Length +divider_clearance = [0.3, 0.2]; +// Number of slot spanning divider to generate. +divider_slot_spanning = 2; + +/* [Base] */ +// Enable magnets +enable_magnets = true; +// Enable screws +enable_screws = true; +//size of magnet, diameter and height. Zack's original used 6.5 and 2.4 +magnet_size = [6.5, 2.4]; // .1 +//create relief for magnet removal +magnet_easy_release = "auto";//["off","auto","inner","outer"] +//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 +efficient_floor = "off";//[off,on,rounded,smooth] +// Enable to subdivide bottom pads to allow half-cell offsets +half_pitch = false; +// Removes the internal grid from base the shape +flat_base = "off"; // [off, gridfinity:gridfinity stackable, rounded] +// 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; + +// Adjust the radius of the rounded flat base. -1 uses the corner radius. +flat_base_rounded_radius = -1; +// Add chamfer to the rounded bottom corner to make easier to print. -1 add auto 45deg. +flat_base_rounded_easyPrint = -1; + +/* [Label] */ +label_style = "normal"; //[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] +// Include overhang for labeling (and specify left/right/center justification) +label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber] +// 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,10,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; +label_walls=[0,1,0,0]; //[0:1:1] + +/* [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 +fingerslide = "none"; //[none, rounded, chamfered] +// Radius of the corner fillet, 0:none, >1: radius in mm, <0 dimention/abs(n) (i.e. -3 is 1/3 the width) +fingerslide_radius = 8; +// wall to enable on, front, back, left, right. 0: disabled; 1: enabled using radius; >1: override radius. +fingerslide_walls=[1,0,0,0]; +//Align the fingerslide with the lip +fingerslide_lip_aligned=true; + +/* [Tapered Corner] */ +tapered_corner = "none"; //[none, rounded, chamfered] +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 +wallpattern_style = "hexgrid"; //[hexgrid, hexgridrotated, grid, gridrotated, voronoi, voronoigrid, voronoihexgrid, brick, brickrotated, brickoffset, brickoffsetrotated] +// Spacing between pattern +wallpattern_hole_spacing = 2; //0.1 +// wall to enable on, front, back, left, right. +wallpattern_walls=[1,1,1,1]; //[0:1:1] +// Add the pattern to the dividers +wallpattern_dividers_enabled="disabled"; //[disabled, horizontal, vertical, both] +//Number of sides of the hole op +wallpattern_hole_sides = 6; //[4:square, 6:Hex, 64:circle] +//Size of the hole +wallpattern_hole_size = [5,5]; //0.1 +//Radius of corners +wallpattern_hole_radius = 0.5; +// pattern fill mode +wallpattern_fill = "none"; //[none, space, crop, crophorizontal, cropvertical, crophorizontal_spacevertical, cropvertical_spacehorizontal, spacevertical, spacehorizontal] +// border around the wall pattern, default is wall thickness +wallpattern_border = 0; +//grid pattern hole taper +wallpattern_pattern_grid_chamfer = 0; //0.1 +//voronoi pattern noise, +wallpattern_pattern_voronoi_noise = 0.75; //0.01 +//brick pattern center weight +wallpattern_pattern_brick_weight = 5; +//$fs for floor pattern, min size face. +wallpattern_pattern_quality = 0.4;//0.1:0.1:2 + +/* [Floor Pattern] */ +// enable Grid floor patter +floorpattern_enabled=false; +// Style of the pattern +floorpattern_style = "hexgrid"; //[hexgrid, hexgridrotated, grid, gridrotated, voronoi, voronoigrid, voronoihexgrid, brick, brickrotated, brickoffset, brickoffsetrotated] +// Spacing between pattern +floorpattern_hole_spacing = 2; //0.1 +//Number of sides of the hole op +floorpattern_hole_sides = 6; //[4:square, 6:Hex, 64:circle] +//Size of the hole +floorpattern_hole_size = [5,5]; //0.1 +floorpattern_hole_radius = 0.5; +// pattern fill mode +floorpattern_fill = "crop"; //[none, space, crop, crophorizontal, cropvertical, crophorizontal_spacevertical, cropvertical_spacehorizontal, spacevertical, spacehorizontal] +// border around the wall pattern, default is wall thickness +floorpattern_border = 0; +//grid pattern hole taper +floorpattern_pattern_grid_chamfer = 0; //0.1 +//voronoi pattern noise, +floorpattern_pattern_voronoi_noise = 0.75; //0.01 +//brick pattern center weight +floorpattern_pattern_brick_weight = 5; +//$fs for floor pattern, min size face. +floorpattern_pattern_quality = 0.4;//0.1:0.1:2 + +/* [Wall Cutout] */ +wallcutout_vertical ="disabled"; //[disabled, enabled, wallsonly, frontonly, backonly] +// 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; +wallcutout_horizontal ="disabled"; //[disabled, enabled, wallsonly, leftonly, rightonly] +// 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] */ +extension_x_enabled = "disabled"; //[disabled, front, back] +extension_x_position = 0.5; +extension_y_enabled = "disabled"; //[disabled, front, back] +extension_y_position = 0.5; +extension_tabs_enabled = true; +//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 +text_font = "Aldo"; // [Aldo, B612, "Open Sans", Ubuntu] +// 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] */ +//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 = "disabled"; //[info,debug,trace] + +/* [Model detail] */ +//Work in progress, Modify the default grid size. Will break compatibility +pitch = [42,42,7]; //[0:1:9999] +//assign colours to the bin +set_colour = "enable"; //[disabled, enable, preview, lip] +//where to render the model +render_position = "center"; //[default,center,zero] +// minimum angle for a fragment (fragments = 360/fa). Low is more fragments +fa = 6; +// minimum size of a fragment. Low is more fragments +fs = 0.4; +// number of fragments, overrides $fa and $fs +fn = 0; +// set random seed for +random_seed = 0; //0.0001 +// force render on costly components +force_render = true; + +/* [Hidden] */ +module end_of_customizer_opts() {} +/**/ + +//Some online generators do not like direct setting of fa,fs,fn +$fa = fa; +$fs = fs; +$fn = fn; + +set_environment( + width = width, + depth = depth, + height = height, + render_position = render_position, + help = enable_help, + pitch = pitch, + cut = [cutx, cuty, height], + setColour = set_colour, + randomSeed = random_seed, + force_render = force_render) +gridfinity_removable_label( + 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, + flatBaseRoundedRadius = flat_base_rounded_radius, + flatBaseRoundedEasyPrint = flat_base_rounded_easyPrint), + wall_thickness=wall_thickness, + chamber_wall_thickness=chamber_wall_thickness, + chamber_wall_headroom=chamber_wall_headroom, + divider_wall_removable_settings = DividerRemovableSettings( + enabled=divider_walls_enabled, + walls=divider_walls, + headroom=divider_headroom, + support_thickness=divider_walls_support_thickness, + slot_size=divider_wall_slot_size, + divider_spacing=divider_walls_spacing, + divider_thickness=divider_walls_thickness, + divider_clearance=divider_clearance, + divider_slot_spanning=divider_slot_spanning), + 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_settings = LipSettings( + lipStyle=lip_style, + lipSideReliefTrigger=lip_side_relief_trigger, + lipTopReliefHeight=lip_top_relief_height, + lipTopReliefWidth=lip_top_relief_width, + lipNotch=lip_top_notches, + lipClipPosition=lip_clip_position, + lipNonBlocking=lip_non_blocking), + headroom=headroom, + tapered_corner=tapered_corner, + tapered_corner_size = tapered_corner_size, + tapered_setback = tapered_setback, + wallpattern_walls=wallpattern_walls, + wallpattern_dividers_enabled=wallpattern_dividers_enabled, + wall_pattern_settings = PatternSettings( + patternEnabled = wallpattern_enabled, + patternStyle = wallpattern_style, + patternFill = wallpattern_fill, + patternBorder = wallpattern_border, + patternHoleSize = wallpattern_hole_size, + patternHoleSides = wallpattern_hole_sides, + patternHoleSpacing = wallpattern_hole_spacing, + patternHoleRadius = wallpattern_hole_radius, + patternGridChamfer = wallpattern_pattern_grid_chamfer, + patternVoronoiNoise = wallpattern_pattern_voronoi_noise, + patternBrickWeight = wallpattern_pattern_brick_weight, + patternFs = wallpattern_pattern_quality), + floor_pattern_settings = PatternSettings( + patternEnabled = floorpattern_enabled, + patternStyle = floorpattern_style, + patternFill = floorpattern_fill, + patternBorder = floorpattern_border, + patternHoleSize = floorpattern_hole_size, + patternHoleSides = floorpattern_hole_sides, + patternHoleSpacing = floorpattern_hole_spacing, + patternHoleRadius = floorpattern_hole_radius, + patternGridChamfer = floorpattern_pattern_grid_chamfer, + patternVoronoiNoise = floorpattern_pattern_voronoi_noise, + patternBrickWeight = floorpattern_pattern_brick_weight, + patternFs = floorpattern_pattern_quality), + 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)); diff --git a/modules/module_gridfinity.scad b/modules/module_gridfinity.scad index ebf04a6..4fe89e4 100644 --- a/modules/module_gridfinity.scad +++ b/modules/module_gridfinity.scad @@ -116,7 +116,8 @@ module pad_oversize( render_top = true, render_bottom = true, remove_bottom_taper = false, - extend_down = 0) { + extend_down = 0, + clr = 0) { assert(!is_undef(num_x), "num_x is undefined"); assert(is_num(num_x), "num_x must be a number"); diff --git a/modules/module_gridfinity_cup.scad b/modules/module_gridfinity_cup.scad index 1293fec..51eca1a 100644 --- a/modules/module_gridfinity_cup.scad +++ b/modules/module_gridfinity_cup.scad @@ -231,7 +231,7 @@ gridfinity_cup();//execution point // and not by position. The number of parameters makes positional parameters error prone, and // additional parameters may be added over time and break things. // separator positions are defined in units from the left side -module gridfinity_cup( +module gridfinity_removable_label( width=default_width, depth=default_depth, height=default_height, @@ -437,16 +437,8 @@ module gridfinity_cup( ? wallpattern_dividers_enabled ? "vertical" : "disabled" : wallpattern_dividers_enabled; -// debug_cut() + debug_cut() union(){ -// difference() { -// grid_block( -// num_x, num_y, num_z, -// cupBase_settings = cupBase_settings, -// wall_thickness = wall_thickness, -// lip_settings = lip_settings, -// filledin = filled_in); - difference() { intersection() { gridfinity_label( @@ -459,82 +451,47 @@ module gridfinity_cup( render_option = "labelwithsocket"); partitioned_cavity( - num_x, num_y, num_z, - label_settings=label_settings, - cupBase_settings = cupBase_settings, - fingerslide=fingerslide, - fingerslide_radius=fingerslide_radius, - fingerslide_walls=fingerslide_walls, - fingerslide_lip_aligned=fingerslide_lip_aligned, - wall_thickness=wall_thickness+clr, - chamber_wall_thickness=chamber_wall_thickness, - chamber_wall_headroom=chamber_wall_headroom, - calculated_vertical_separator_positions = calculated_vertical_separator_positions, - calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, - lip_settings=lip_settings, - headroom=headroom, - sliding_lid_settings= slidingLidSettings, - divider_wall_removable_settings = divider_wall_removable_settings); + num_x, num_y, num_z, + label_settings=label_settings, + cupBase_settings = cupBase_settings, + fingerslide=fingerslide, + fingerslide_radius=fingerslide_radius, + fingerslide_walls=fingerslide_walls, + fingerslide_lip_aligned=fingerslide_lip_aligned, + wall_thickness=wall_thickness+sliding_clearance, + chamber_wall_thickness=chamber_wall_thickness, + chamber_wall_headroom=chamber_wall_headroom, + calculated_vertical_separator_positions = calculated_vertical_separator_positions, + calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, + lip_settings=lip_settings, + headroom=headroom, + sliding_lid_settings= slidingLidSettings, + divider_wall_removable_settings = divider_wall_removable_settings); } - label_size = calculateLabelSize(label_settings[iLabelSettings_size]); labelCornerRadius = label_size[3]; lipHeight = 3.75; + tz(-lipHeight - labelCornerRadius) tz(zpoint) cupLip( - num_x = num_x, - num_y = num_y, - lipStyle = lip_settings[iLipStyle], - wall_thickness = wall_thickness, - lip_notches = false, - lip_top_relief_height = lip_settings[iLipTopReliefHeight], - lip_top_relief_width = lip_settings[iLipTopReliefWidth], - lip_clip_position = lip_settings[iLipClipPosition], - lip_non_blocking = lip_settings[iLipNonBlocking] + num_x = num_x, + num_y = num_y, + lipStyle = lip_settings[iLipStyle], + wall_thickness = wall_thickness, + lip_notches = false, + lip_top_relief_height = lip_settings[iLipTopReliefHeight], + lip_top_relief_width = lip_settings[iLipTopReliefWidth], + lip_clip_position = lip_settings[iLipClipPosition], + lip_non_blocking = lip_settings[iLipNonBlocking], + lip_as_void=true, + sliding_clearance=sliding_clearance ); - -// label_size = calculateLabelSize(label_settings[iLabelSettings_size]); -// labelCornerRadius = label_size[3]; -// lipHeight = 3.75; -// tz(-lipHeight - labelCornerRadius) -// tz(zpoint) -// #cupLip( -// num_x = num_x, -// num_y = num_y, -// lipStyle = lip_settings[iLipStyle], -// wall_thickness = wall_thickness, -// lip_notches = false, -// lip_top_relief_height = lip_settings[iLipTopReliefHeight], -// lip_top_relief_width = lip_settings[iLipTopReliefWidth], -// lip_clip_position = lip_settings[iLipClipPosition], -// lip_non_blocking = lip_settings[iLipNonBlocking] -// ); } - if(filled_in == FilledIn_disabled) - union(){ - //primary cavity - -// partitioned_cavity( -// num_x, num_y, num_z, -// label_settings=label_settings, -// cupBase_settings = cupBase_settings, -// fingerslide=fingerslide, -// fingerslide_radius=fingerslide_radius, -// fingerslide_walls=fingerslide_walls, -// fingerslide_lip_aligned=fingerslide_lip_aligned, -// wall_thickness=wall_thickness, -// chamber_wall_thickness=chamber_wall_thickness, -// chamber_wall_headroom=chamber_wall_headroom, -// calculated_vertical_separator_positions = calculated_vertical_separator_positions, -// calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, -// lip_settings=lip_settings, -// headroom=headroom, -// sliding_lid_settings= slidingLidSettings, -// divider_wall_removable_settings = divider_wall_removable_settings); - + if(filled_in == FilledIn_disabled) + union(){ color(env_colour(color_wallcutout)) union(){ cavityFloorRadius = calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness, cupBase_settings[iCupBase_EfficientFloor]); @@ -963,7 +920,7 @@ module gridfinity_cup( else translate([0,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),-fudgeFactor]) cube([env_pitch().x*num_x,num_y*env_pitch().x-unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); -// } + if((extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled || extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_disabled) && extendable_Settings[iExtendableTabsEnabled]) { refTabHeight = extendable_Settings[iExtendableTabSize].x; @@ -1026,26 +983,7 @@ module gridfinity_cup( attachment_clip(height=tabHeight, width=tabWidth, thickness=tabThickness, footingThickness=wall_thickness, tabStyle=tabStyle); } } - -// if (lip_settings[iLipStyle] == "reduced_double") { -// label_size=calculateLabelSize(label_settings[iLabelSettings_size]); -// labelCornerRadius = label_size[3]; -// lipHeight = 3.75; -// tz(- lipHeight -labelCornerRadius) -// tz(zpoint) -// cupLip( -// num_x = num_x, -// num_y = num_y, -// lipStyle = lip_settings[iLipStyle], -// wall_thickness = wall_thickness, -// lip_notches = false, -// lip_top_relief_height = lip_settings[iLipTopReliefHeight], -// lip_top_relief_width = lip_settings[iLipTopReliefWidth], -// lip_clip_position = lip_settings[iLipClipPosition], -// lip_non_blocking = lip_settings[iLipNonBlocking]); -// -// } - } + } if(divider_wall_removable_settings[iDividerRemovable_Enabled]) dividers_removable_for_cup( diff --git a/modules/module_gridfinity_label.scad b/modules/module_gridfinity_label.scad index 96f6a10..c54bfe8 100644 --- a/modules/module_gridfinity_label.scad +++ b/modules/module_gridfinity_label.scad @@ -113,7 +113,7 @@ module gridfinity_label( vertical_separator_positions, horizontal_separator_positions, label_settings, - render_option = "labelwithsocket", //"label", "socket", "labelwithsocket" + render_option = "labelwithsocket", //"label", "socket", "labelwithsocket", "removablelabel" socket_padding = [0,0,0] ) { @@ -194,12 +194,18 @@ module gridfinity_label( label_thickness = 3; ratio=label_thickness/(label_size.y+labelCornerRadius); + + labelPoints = render_option == "removablelabel" + ? [[ 0-labelSize.y, -labelCornerRadius], + [ 0, -labelCornerRadius], + [ 0, -labelCornerRadius-labelSize.z*ratio ], + [ 0-labelSize.y*(1-ratio), -labelCornerRadius-labelSize.z*ratio ] + ] + : [[ 0-labelSize.y, -labelCornerRadius], + [ 0, -labelCornerRadius ], + [ 0, -labelCornerRadius-labelSize.z ] + ]; - labelPoints = [[ 0-labelSize.y, -labelCornerRadius], - [ 0, -labelCornerRadius], - [ 0, -labelCornerRadius-labelSize.z*ratio ], - [ 0-labelSize.y*(1-ratio), -labelCornerRadius-labelSize.z*ratio ] - ]; labelWidthmm = labelSize.x <=0 ? wallLocation[ilabelWall_Width] : labelSize.x * wallLocation[6]; // Calculate list of chambers. @@ -237,6 +243,20 @@ module gridfinity_label( union(){ difference(){ if(render_option == "label" || render_option == "labelwithsocket") + union(){ + hull() for (y=[0, 1, 2]) + translate([0, labelPoints[y][0], labelPoints[y][1]]) + rotate([0, 90, 0]) + union(){ + //left + tz(abs(label_num_x-labelCornerRadius*2))//tz(abs(label_num_x)) + sphere(r=labelCornerRadius); + //Right + sphere(r=labelCornerRadius); + } + } + + if(render_option == "removablelabel") union(){ hull() for (y=[0, 1, 2, 3]) translate([0, labelPoints[y][0], labelPoints[y][1]]) @@ -249,6 +269,7 @@ module gridfinity_label( sphere(r=labelCornerRadius); } } + //Create Label Sockets as negative volume if(render_option == "labelwithsocket") diff --git a/modules/module_gridfinity_removable_label.scad b/modules/module_gridfinity_removable_label.scad new file mode 100644 index 0000000..48bf6f3 --- /dev/null +++ b/modules/module_gridfinity_removable_label.scad @@ -0,0 +1,1470 @@ +include +include +include +include +include +include +include +include +include +include + +use +use +use +use + +// X dimension. grid units (multiples of 42mm) or mm. +default_width = [2, 0]; //0.1 +// Y dimension. grid units (multiples of 42mm) or mm. +default_depth = [1, 0]; //0.1 +// Z dimension excluding. grid units (multiples of 7mm) or mm. +default_height = [3, 0]; //0.1 +default_position = "default"; //["default","center","zero"] +default_filled_in = "disabled"; //[disabled, enabled, enabledfilllip:"Fill cup and lip"] +//assign colours to the bin, will may +default_set_colour = "preview"; //[disabled, preview, lip] + +// Thickness of outer walls. default, height < 8 0.95, height < 16 1.2, height > 16 1.6 (Zack's design is 0.95 mm) +default_wall_thickness = 0;// 0.01 + +// Set magnet diameter and depth to 0 to print without magnet holes +// (Zack's design uses magnet diameter of 6.5) +//under size the bin top by this amount to allow for better stacking +default_headroom = 0.8; // 0.1 + +/* [Cup Lip] */ +// Style of the cup lip +default_lip_style = "normal"; // [ normal, reduced, minimum, none:not stackable ] +// Below this the inside of the lip will be reduced for easier access. +default_lip_side_relief_trigger = [1,1]; //0.1 +// Create a relief in the lip +default_lip_top_relief_height = -1; // 0.1 +// add a notch to the lip to prevent sliding. +default_lip_top_notches = 0; // 0.1 + +/* [Label] */ +// Include overhang for labeling +default_label_style = "disabled"; //[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] +// Include overhang for labeling (and specify left/right/center justification) +default_label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber] +// 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. +default_label_size = [0,14,0,0.6]; // 0.01 +// Size in mm of relief where appropriate. Width, depth, height, radius +default_label_relief = [0,0,0,0.6]; // 0.1 +// wall to enable on, front, back, left, right. 0: disabled; 1: enabled; +default_label_walls=[0,1,0,0]; //[0:1:1] + +/* [Sliding Lid] */ +default_sliding_lid_enabled = false; +// 0 = wall thickness *2 +default_sliding_lid_thickness = 0; //0.1 +// 0 = wall_thickness/2 +default_sliding_min_wallThickness = 0;//0.1 +// 0 = default_sliding_lid_thickness/2 +default_sliding_min_support = 0;//0.1 +default_sliding_clearance = 0.1;//0.1 +default_sliding_lid_lip_enabled = false; + +/* [Finger Slide] */ +// Include larger corner fillet +default_fingerslide = "none"; //[none, rounded, chamfered] +// radius of the corner fillet +default_fingerslide_radius = 8; +// wall to enable on, front, back, left, right. 0: disabled; 1: enabled; +default_fingerslide_walls=[1,0,0,0]; //[0:1:1] +default_fingerslide_lip_aligned = true; + +/* [Subdivisions] */ +// X dimension subdivisions +default_chamber_wall_thickness = 1.2;//0.1 +//Reduce the wall height by this amount +default_chamber_wall_headroom = 0;//0.1 +default_vertical_chambers = 1; +default_vertical_separator_bend_position = 0;//0.1 +default_vertical_separator_bend_angle = 45;//0.1 +default_vertical_separator_bend_separation = 0;//0.1 +default_vertical_separator_cut_depth = 0;//0.1 +default_horizontal_chambers = 1; +default_horizontal_separator_bend_position = 0; //0.1 +default_horizontal_separator_bend_angle = 45; //0.1 +default_horizontal_separator_bend_separation = 0; //0.1 +default_horizontal_separator_cut_depth = 0;//0.1 +// Enable irregular subdivisions +default_vertical_irregular_subdivisions = false; +// Separator positions are defined in terms of grid units from the left end +default_vertical_separator_config = "10.5|21|42|50|60"; +// Enable irregular subdivisions +default_horizontal_irregular_subdivisions = false; +// Separator positions are defined in terms of grid units from the left end +default_horizontal_separator_config = "10.5|21|42|50|60"; + +/* [Removable Divider Walls] */ +default_divider_walls_enabled = false; +// Wall to enable on, x direction, y direction +default_divider_walls = [1,1]; //[0:1:1] +// Thickness of the divider walls. +default_divider_walls_thickness = 2.5; //0.1 +// Spacing between the divider walls (0=divider_walls_thickness*2). +default_divider_walls_spacing = 0; //0.1 +// Thickness of the support walls. +default_divider_walls_support_thickness = 2; +// Size of the slot in the divider walls. width(0=divider_walls_thickness), depth(0=divider_walls_support_thickness) +default_divider_wall_slot_size = [0,0]; +// Clearance between the divider walls top +default_divider_headroom = 0.1; +// Clearance subtracted from the removable divider wall. Width, Length +default_divider_clearance = [0.3, 0.2]; +// Number of slot spanning divider to generate. +default_divider_slot_spanning = 0; + +/* [Base] */ +//size of magnet, diameter and height. Zack's original used 6.5 and 2.4 +default_magnet_size = [6.5, 2.4]; // .1 +//create relief for magnet removal +default_magnet_easy_release = "auto";//["off","auto","inner","outer"] +//size of screw, diameter and height. Zack's original used 3 and 6 +default_screw_size = [3, 6]; // .1 +//size of center magnet, diameter and height. +default_center_magnet_size = [0,0]; +// Minimum thickness above cutouts in base (Zack's design is effectively 1.2) +default_floor_thickness = 1.2; +default_cavity_floor_radius = -1; +// Sequential Bridging hole overhang remedy is active only when both screws and magnets are nonzero (and this option is selected) +default_hole_overhang_remedy = 2; +// Save material with thinner floor +default_efficient_floor = "off";//["off","on","rounded","smooth"] +// Remove floor to create a spacer +default_spacer = false; +// Half-pitch base pads for offset stacking +default_half_pitch = false; + +// Limit attachments (magnets and screws) to box corners for faster printing. +default_box_corner_attachments_only = true; +// Removes the base grid from inside the shape +default_flat_base = false; +/* [Tapered Corner] */ +default_tapered_corner = "none"; //[none, rounded, chamfered] +default_tapered_corner_size = 10; +// Set back of the tapered corner, default is the gridfinity corner radius +default_tapered_setback = -1;//gf_cup_corner_radius/2; + +/* [Wall Cutout] */ +default_wallcutout_vertical ="disabled"; //[disabled, enabled, wallsonly, frontonly, backonly] +// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value) +default_wallcutout_vertical_position=-2; //0.1 +//default will be binwidth/2 +default_wallcutout_vertical_width=0; +default_wallcutout_vertical_angle=70; +//default will be binHeight +default_wallcutout_vertical_height=0; +default_wallcutout_vertical_corner_radius=5; +default_wallcutout_horizontal ="disabled"; //[disabled, enabled, wallsonly, leftonly, rightonly] +// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value) +default_wallcutout_horizontal_position=-2; //0.1 +//default will be binwidth/2 +default_wallcutout_horizontal_width=0; +default_wallcutout_horizontal_angle=70; +//default will be binHeight +default_wallcutout_horizontal_height=0; +default_wallcutout_horizontal_corner_radius=5; + +/* [Wall Pattern] */ +default_wallpattern_enabled=false; +default_wallpattern_style = "hexgrid"; //[hexgrid, hexgridrotated, grid, gridrotated, voronoi, voronoigrid, voronoihexgrid, brick, brickrotated, brickoffset, brickoffsetrotated] +default_wallpattern_dividers_enabled ="disabled"; //["disabled", "horizontal", "vertical", "both"] +default_wallpattern_fill = "none"; //["none", "space", "crop", "crophorizontal", "cropvertical", "crophorizontal_spacevertical", "cropvertical_spacehorizontal", "spacevertical", "spacehorizontal"] +default_wallpattern_walls=[1,0,0,0]; //[0:1:1] +default_wallpattern_hole_sides = 6; +default_wallpattern_hole_size = [10,10]; //0.1 +default_wallpattern_hole_spacing = 2; //0.1 +default_wallpattern_hole_radius = 0.5; +default_wallpattern_border = 0; +default_wallpattern_pattern_grid_chamfer = 0; //0.1 +default_wallpattern_pattern_voronoi_noise = 0.75; //0.01 +default_wallpattern_pattern_brick_weight = 5; +default_wallpattern_pattern_quality = 0; + +/* [Extendable] */ +default_extension_x_enabled = "disabled"; //[disabled, front, back] +default_extension_x_position = 0.5; +default_extension_y_enabled = "disabled"; //[disabled, front, back] +default_extension_y_position = 0.5; +default_extension_tabs_enabled = true; +//Tab size, height, width, thickness, style. width default is height, thickness default is 1.4, style {0,1,2}. +default_extension_tab_size= [10,0,0,0]; + +/* [Bottom Text] */ +// Add bin size to bin bottom +default_text_1 = false; +// Size of text, in mm +default_text_size = 0; // 0.1 +// Depth of text, in mm +default_text_depth = 0.3; // 0.01 +// Font to use +default_text_font = "Aldo"; // [Aldo, B612, "Open Sans", Ubuntu] +// Add free-form text line to bin bottom (printing date, serial, etc) +default_text_2 = false; +// Actual text to add +default_text_2_text = "Gridfinity"; + +module end_of_customizer_opts() {} + +/* +//[debug] +default_cutx = 0;//0.01 +default_cuty = 0;//0.01 +default_help = "info"; //["off","info","debug","trace"] + +set_environment(//execution point + width = default_width, + depth = default_depth, + height = default_height, + setColour = default_set_colour,//execution point + help = default_help,//execution point + cut=[default_cutx,default_cuty, default_height]//execution point + )//execution point +gridfinity_cup();//execution point +*/ + +// It's recommended that all parameters other than x, y, z size should be specified by keyword +// and not by position. The number of parameters makes positional parameters error prone, and +// additional parameters may be added over time and break things. +// separator positions are defined in units from the left side +module gridfinity_removable_label( + width=default_width, + depth=default_depth, + height=default_height, + filled_in=default_filled_in, + label_settings=LabelSettings( + labelStyle=default_label_style, + labelPosition=default_label_position, + labelSize=default_label_size, + labelRelief=default_label_relief, + labelWalls=default_label_walls), + sliding_lid_enabled = default_sliding_lid_enabled, + sliding_lid_thickness = default_sliding_lid_thickness, + sliding_lid_lip_enabled=default_sliding_lid_lip_enabled, + fingerslide=default_fingerslide, + fingerslide_radius=default_fingerslide_radius, + fingerslide_walls=default_fingerslide_walls, + fingerslide_lip_aligned=default_fingerslide_lip_aligned, + cupBase_settings = CupBaseSettings( + magnetSize = default_magnet_size, + magnetEasyRelease = default_magnet_easy_release, + centerMagnetSize = default_center_magnet_size, + screwSize = default_screw_size, + holeOverhangRemedy = default_hole_overhang_remedy, + cornerAttachmentsOnly = default_box_corner_attachments_only, + floorThickness = default_floor_thickness, + cavityFloorRadius = default_cavity_floor_radius, + efficientFloor=default_efficient_floor, + halfPitch=default_half_pitch, + flatBase=default_flat_base, + spacer=default_spacer), + wall_thickness=default_wall_thickness, + chamber_wall_thickness=default_chamber_wall_thickness, + chamber_wall_headroom=default_chamber_wall_headroom, + divider_wall_removable_settings = DividerRemovableSettings( + enabled=default_divider_walls_enabled, + walls=default_divider_walls, + headroom=default_divider_headroom, + slot_size=default_divider_wall_slot_size, + divider_spacing=default_divider_walls_spacing, + divider_thickness=default_divider_walls_thickness, + divider_clearance=default_divider_clearance, + divider_slot_spanning=default_divider_slot_spanning), + divider_wall_removable_settings = DividerRemovableSettings( + enabled=divider_walls_enabled, + walls=divider_walls, + headroom=divider_headroom, + support_thickness=divider_walls_support_thickness, + slot_size=divider_wall_slot_size, + divider_spacing=divider_walls_spacing, + divider_thickness=divider_walls_thickness, + divider_clearance=divider_clearance, + divider_slot_spanning=divider_slot_spanning), + vertical_chambers = default_vertical_chambers, + vertical_separator_bend_position = default_vertical_separator_bend_position, + vertical_separator_bend_angle = default_vertical_separator_bend_angle, + vertical_separator_bend_separation = default_vertical_separator_bend_separation, + vertical_separator_cut_depth = default_vertical_separator_cut_depth, + vertical_irregular_subdivisions = default_vertical_irregular_subdivisions, + vertical_separator_config = default_vertical_separator_config, + horizontal_chambers = default_horizontal_chambers, + horizontal_separator_bend_position = default_horizontal_separator_bend_position, + horizontal_separator_bend_angle = default_horizontal_separator_bend_angle, + horizontal_separator_bend_separation = default_horizontal_separator_bend_separation, + horizontal_separator_cut_depth = default_horizontal_separator_cut_depth, + horizontal_irregular_subdivisions = default_horizontal_irregular_subdivisions, + horizontal_separator_config = default_horizontal_separator_config, + lip_settings = LipSettings( + lipStyle=default_lip_style, + lipSideReliefTrigger=default_lip_side_relief_trigger, + lipTopReliefHeight=default_lip_top_relief_height, + lipNotch=default_lip_top_notches), + headroom=default_headroom, + tapered_corner = default_tapered_corner, + tapered_corner_size = default_tapered_corner_size, + tapered_setback = default_tapered_setback, + wallpattern_walls=default_wallpattern_walls, + wallpattern_dividers_enabled = default_wallpattern_dividers_enabled, + wall_pattern_settings = PatternSettings( + patternEnabled = default_wallpattern_enabled, + patternStyle = default_wallpattern_style, + patternFill = default_wallpattern_fill, + patternBorder = default_wallpattern_hole_spacing, + patternHoleSize = default_wallpattern_hole_size, + patternHoleSides = default_wallpattern_hole_sides, + patternHoleSpacing = default_wallpattern_hole_spacing, + patternHoleRadius = default_wallpattern_hole_radius, + patternGridChamfer = default_wallpattern_pattern_grid_chamfer, + patternVoronoiNoise = default_wallpattern_pattern_voronoi_noise, + patternBrickWeight = default_wallpattern_pattern_brick_weight, + patternFs = default_wallpattern_pattern_quality), + floor_pattern_settings = PatternSettings( + patternEnabled = default_wallpattern_enabled, + patternStyle = default_wallpattern_style, + patternFill = default_wallpattern_fill, + patternBorder = default_wallpattern_hole_spacing, + patternHoleSize = default_wallpattern_hole_size, + patternHoleSides = default_wallpattern_hole_sides, + patternHoleSpacing = default_wallpattern_hole_spacing, + patternHoleRadius = default_wallpattern_hole_radius, + patternGridChamfer = default_wallpattern_pattern_grid_chamfer, + patternVoronoiNoise = default_wallpattern_pattern_voronoi_noise, + patternBrickWeight = default_wallpattern_pattern_brick_weight, + patternFs = default_wallpattern_pattern_quality), + wallcutout_vertical=default_wallcutout_vertical, + wallcutout_vertical_position=default_wallcutout_vertical_position, + wallcutout_vertical_width=default_wallcutout_vertical_width, + wallcutout_vertical_angle=default_wallcutout_vertical_angle, + wallcutout_vertical_height=default_wallcutout_vertical_height, + wallcutout_vertical_corner_radius=default_wallcutout_vertical_corner_radius, + wallcutout_horizontal=default_wallcutout_horizontal, + wallcutout_horizontal_position=default_wallcutout_horizontal_position, + wallcutout_horizontal_width=default_wallcutout_horizontal_width, + wallcutout_horizontal_angle=default_wallcutout_horizontal_angle, + wallcutout_horizontal_height=default_wallcutout_horizontal_height, + wallcutout_horizontal_corner_radius=default_wallcutout_horizontal_corner_radius, + extendable_Settings = ExtendableSettings( + extendablexEnabled = default_extension_x_enabled, + extendablexPosition = default_extension_x_position, + extendableyEnabled = default_extension_y_enabled, + extendableyPosition = default_extension_y_position, + extendableTabsEnabled = default_extension_tabs_enabled, + extendableTabSize = default_extension_tab_size), + sliding_lid_enabled = default_sliding_lid_enabled, + sliding_lid_thickness = default_sliding_lid_thickness, + sliding_min_wall_thickness = default_sliding_min_wallThickness, + sliding_min_support = default_sliding_min_support, + sliding_clearance = default_sliding_clearance, + cupBaseTextSettings = CupBaseTextSettings( + baseTextLine1Enabled = default_text_1, + baseTextLine2Enabled = default_text_2, + baseTextLine2Value = default_text_2_text, + baseTextFontSize = default_text_size, + baseTextFont = default_text_font, + baseTextDepth = default_text_depth)) { + + num_x = calcDimensionWidth(width, true); + num_y = calcDimensionDepth(depth, true); + num_z = calcDimensionHeight(height, true); + //wall_thickness default, height < 8 0.95, height < 16 1.2, height > 16 1.6 (Zack's design is 0.95 mm) + wall_thickness = wallThickness(wall_thickness, num_z); + + filled_in = validateFilledIn(filled_in); + label_settings=ValidateLabelSettings(label_settings); + extendable_Settings = ValidateExtendableSettings(extendable_Settings, num_x=num_x, num_y=num_y); + cupBase_settings = ValidateCupBaseSettings(cupBase_settings); + floor_pattern_settings = ValidatePatternSettings(floor_pattern_settings); + wall_pattern_settings = ValidatePatternSettings(wall_pattern_settings); + + divider_wall_removable_settings = ValidateDividerRemovableSettings(divider_wall_removable_settings, wall_thickness); + slidingLidSettings= SlidingLidSettings( + sliding_lid_enabled, + sliding_lid_thickness, + sliding_min_wall_thickness, + sliding_min_support, + sliding_clearance, + wall_thickness, + sliding_lid_lip_enabled); + + headroom = headroom + (sliding_lid_enabled ? slidingLidSettings[iSlidingLidThickness] : 0); + + filledInZ = env_pitch().z*num_z; + zpoint = filledInZ-headroom; + efficient_floor = cupBase_settings[iCupBase_EfficientFloor]; + floor_thickness = cupBase_settings[iCupBase_FloorThickness]; + floorHeight = calculateFloorHeight( + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + floor_thickness=cupBase_settings[iCupBase_FloorThickness], + num_z=num_z, + filled_in=filled_in, + efficient_floor=efficient_floor, + flat_base=cupBase_settings[iCupBase_FlatBase]); + sepFloorHeight = (efficient_floor != "off" ? floor_thickness : floorHeight); + + calculated_vertical_separator_positions = calculateSeparators( + separator_config = vertical_irregular_subdivisions + ? vertical_separator_config + : splitChamber(vertical_chambers-1, num_x*env_pitch().x), + length = env_pitch().y*num_y, + height = env_pitch().z*(num_z)-sepFloorHeight+fudgeFactor*2-max(headroom, chamber_wall_headroom), + wall_thickness = chamber_wall_thickness, + bend_position = vertical_separator_bend_position, + bend_angle = vertical_separator_bend_angle, + bend_separation = vertical_separator_bend_separation, + cut_depth = vertical_separator_cut_depth); + calculated_horizontal_separator_positions = calculateSeparators( + separator_config = horizontal_irregular_subdivisions + ? horizontal_separator_config + : splitChamber(horizontal_chambers-1, num_y*env_pitch().y), + length = env_pitch().x*num_x, + height = env_pitch().z*(num_z)-sepFloorHeight+fudgeFactor*2-max(headroom, chamber_wall_headroom), + wall_thickness = chamber_wall_thickness, + bend_position = horizontal_separator_bend_position, + bend_angle = horizontal_separator_bend_angle, + bend_separation = horizontal_separator_bend_separation, + cut_depth = horizontal_separator_cut_depth); + + //wallpattern_hole_size = is_list(wallpattern_hole_size) ? wallpattern_hole_size : [wallpattern_hole_size,wallpattern_hole_size]; + $gfc=[["num_x",num_x],["num_y",num_y],["num_z",num_z],["calculated_vertical_separator_positions",calculated_vertical_separator_positions],["calculated_horizontal_separator_positions",calculated_horizontal_separator_positions]]; + + //Correct legacy values, values that used to work one way but were then changed. + wallpattern_dividers_enabled = is_bool(wallpattern_dividers_enabled) + ? wallpattern_dividers_enabled ? "vertical" : "disabled" + : wallpattern_dividers_enabled; + + debug_cut() + union(){ + difference() { + intersection() { + gridfinity_label( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + vertical_separator_positions = calculated_vertical_separator_positions, + horizontal_separator_positions = calculated_horizontal_separator_positions, + label_settings = label_settings, + render_option = "removablelabel"); + + partitioned_cavity( + num_x, num_y, num_z, + label_settings=label_settings, + cupBase_settings = cupBase_settings, + fingerslide=fingerslide, + fingerslide_radius=fingerslide_radius, + fingerslide_walls=fingerslide_walls, + fingerslide_lip_aligned=fingerslide_lip_aligned, + wall_thickness=wall_thickness+sliding_clearance, + chamber_wall_thickness=chamber_wall_thickness, + chamber_wall_headroom=chamber_wall_headroom, + calculated_vertical_separator_positions = calculated_vertical_separator_positions, + calculated_horizontal_separator_positions = calculated_horizontal_separator_positions, + lip_settings=lip_settings, + headroom=headroom, + sliding_lid_settings= slidingLidSettings, + divider_wall_removable_settings = divider_wall_removable_settings); + } + + label_size = calculateLabelSize(label_settings[iLabelSettings_size]); + labelCornerRadius = label_size[3]; + lipHeight = 3.75; + + tz(-lipHeight - labelCornerRadius) + tz(zpoint) + cupLip( + num_x = num_x, + num_y = num_y, + lipStyle = lip_settings[iLipStyle], + wall_thickness = wall_thickness, + lip_notches = false, + lip_top_relief_height = lip_settings[iLipTopReliefHeight], + lip_top_relief_width = lip_settings[iLipTopReliefWidth], + lip_clip_position = lip_settings[iLipClipPosition], + lip_non_blocking = lip_settings[iLipNonBlocking], + lip_as_void=true, + sliding_clearance=sliding_clearance + ); + } + + if(filled_in == FilledIn_disabled) + union(){ + color(env_colour(color_wallcutout)) + union(){ + cavityFloorRadius = calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness, cupBase_settings[iCupBase_EfficientFloor]); + wallTop = calculateWallTop(num_z, lip_settings[iLipStyle]); + cutoutclearance_divider = gf_cup_corner_radius/2; + cutoutclearance_border = max(wall_thickness, wall_pattern_settings[iPatternBorder]); + + tapered_setback = tapered_setback < 0 ? gf_cup_corner_radius : tapered_setback; + tapered_corner_size = + tapered_corner_size == -2 ? (wallTop - floorHeight)/2 + : tapered_corner_size < 0 ? wallTop - floorHeight //meant for -1, but also catch others + : tapered_corner_size == 0 ? wallTop - floorHeight - cavityFloorRadius + : tapered_corner_size; + + wallcutouts_vertical = calculateWallCutout( + wall_length = num_x, + opposite_wall_distance = num_y, + wallcutout_type = wallcutout_vertical, + wallcutout_position = wallcutout_vertical_position, + wallcutout_width = wallcutout_vertical_width, + wallcutout_angle = wallcutout_vertical_angle, + wallcutout_height = wallcutout_vertical_height, + wallcutout_corner_radius = wallcutout_vertical_corner_radius, + wallcutout_rotation = [0,0,0], + wallcutout_reposition = [0,0,0], //todo: why does this not match below? + wall_thickness = wall_thickness, + cavityFloorRadius = cavityFloorRadius, + wallTop = wallTop, + floorHeight = floorHeight, + pitch = env_pitch().x, + pitch_opposite = env_pitch().y); + wallcutouts_horizontal = calculateWallCutout( + wall_length = num_y, + opposite_wall_distance = num_x, + wallcutout_type = wallcutout_horizontal, + wallcutout_position = wallcutout_horizontal_position, + wallcutout_width = wallcutout_horizontal_width, + wallcutout_angle = wallcutout_horizontal_angle, + wallcutout_height = wallcutout_horizontal_height, + wallcutout_corner_radius = wallcutout_horizontal_corner_radius, + wallcutout_rotation = [0,0,90], + wallcutout_reposition = [num_x*env_pitch().x,0,0], + wall_thickness = wall_thickness, + cavityFloorRadius = cavityFloorRadius, + wallTop = wallTop, + floorHeight = floorHeight, + pitch = env_pitch().y, + pitch_opposite = env_pitch().x); + + wallcutout_locations = [wallcutouts_vertical[0], wallcutouts_vertical[1], wallcutouts_horizontal[0], wallcutouts_horizontal[1]]; + if(tapered_corner == "rounded" || tapered_corner == "chamfered"){ + //tapered_corner_size = tapered_corner_size == 0 ? env_pitch().z*num_z/2 : tapered_corner_size; + translate([0,tapered_setback+gf_tolerance,env_pitch().z*num_z+gf_Lip_Height-gf_tolerance]) + rotate([270,0,0]) + union(){ + if(tapered_corner == "rounded"){ + roundedCorner( + radius = tapered_corner_size, + length=(num_x+1)*env_pitch().x, + height = tapered_corner_size); + } + else if(tapered_corner == "chamfered"){ + chamferedCorner( + chamferLength = tapered_corner_size, + length=(num_x+1)*env_pitch().x, + height = tapered_corner_size); + } + } + } + + if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) + for(wallcutout_location = wallcutout_locations) + if(wallcutout_location[iwalcutout_enabled] == true) + translate(wallcutout_location[iwalcutout_reposition]) + rotate(wallcutout_location[iwalcutout_rotation]) + translate(wallcutout_location[iwalcutout_position]) + WallCutout( + lowerWidth=wallcutout_location[iwalcutout_size].x, + wallAngle=wallcutout_location[iwalcutout_config][iwalcutoutconfig_angle], + height=wallcutout_location[iwalcutout_size].z, + thickness=wallcutout_location[iwalcutout_size].y, + cornerRadius=wallcutout_location[iwalcutout_config][iwalcutoutconfig_cornerradius]); + + //Wall and floor pattern + //Wall pattern in outerwalls + if(wall_pattern_settings[iPatternEnabled] || floor_pattern_settings[iPatternEnabled]){ + difference(){ + union(){ + if(floor_pattern_settings[iPatternEnabled]){ + difference(){ + pad_copy( + num_x = num_x, + num_y = num_y, + half_pitch = cupBase_settings[iCupBase_HalfPitch], + flat_base = cupBase_settings[iCupBase_FlatBase], + minimium_size = cupBase_settings[iCupBase_MinimumPrintablePadSize]) + translate([$pad_copy_size.x*env_pitch().x/2, $pad_copy_size.y*env_pitch().y/2,-fudgeFactor]) + cutout_pattern( + patternStyle = floor_pattern_settings[iPatternStyle], + canvasSize = [$pad_copy_size.x*env_pitch().x, $pad_copy_size.y*env_pitch().y], + circleFn = floor_pattern_settings[iPatternHoleSides], + holeSize = floor_pattern_settings[iPatternHoleSize], + holeSpacing = [floor_pattern_settings[iPatternHoleSpacing], floor_pattern_settings[iPatternHoleSpacing]], + holeHeight = sepFloorHeight + fudgeFactor*6, + center = true, + fill = floor_pattern_settings[iPatternFill], + patternGridChamfer = floor_pattern_settings[iPatternGridChamfer], + patternVoronoiNoise = floor_pattern_settings[iPatternVoronoiNoise], + patternBrickWeight = floor_pattern_settings[iPatternBrickWeight], + border = max(5, floor_pattern_settings[iPatternBorder], + cupBase_settings[iCupBase_EfficientFloor] == EfficientFloor_smooth? 6.5 : 0), + holeRadius = floor_pattern_settings[iPatternHoleRadius], + patternFs = floor_pattern_settings[iPatternFs], + source="floor_pattern"); + + //subtract dividers from floor pattern + translate([0, 0, -fudgeFactor]) + separators( + calculatedSeparators = calculated_vertical_separator_positions, + separator_orientation = "vertical", + override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); + + //subtract dividers from floor pattern + translate([gf_pitch*num_x, 0, -fudgeFactor]) + separators( + calculatedSeparators = calculated_horizontal_separator_positions, + separator_orientation = "horizontal", + override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); + } + } + + + if(wall_pattern_settings[iPatternEnabled]){ + wallpattern_thickness = wall_thickness + fudgeFactor*4; + border = 0; //Believe this to be no longer needed + + wallpatternzpos = wallpatternClearanceHeight( + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + floor_thickness = cupBase_settings[iCupBase_FloorThickness], + num_z=num_z, + filled_in=FilledIn_disabled, + efficient_floor=efficient_floor, + flat_base=cupBase_settings[iCupBase_FlatBase], + floor_inner_radius = cavityFloorRadius, + outer_cup_radius = 1); + + //I feel this should use wallTop, but it seems to work... + heightz = env_pitch().z*(num_z)-wallpatternzpos + ( + //Position specific to each LIP style + lip_settings[iLipStyle] == "reduced" ? 0.6 : + lip_settings[iLipStyle] == "reduced_double" ? 0.6 : + lip_settings[iLipStyle] == "minimum" ? 3 -border*2 + : -gf_lip_height-1.8); + z=wallpatternzpos+heightz/2; + + labelSize = calculateLabelSize(label_settings[iLabelSettings_size]); + //Subtracting the wallpattern_thickness is a bit of a hack, its needed as the label extends in to the wall. + labelSizez = (label_settings[iLabelSettings_style] != LabelStyle_disabled ? labelSize.z-wallpattern_thickness : 0); + + front = [ + //width,height + [num_x*env_pitch().x-gf_cup_corner_radius*2-border, + heightz - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)], + //Position + [(num_x)*env_pitch().x/2, + gf_tolerance/2+wall_thickness/2, + z - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)/2], + //rotation + [90,0,0], + //enabled + wallpattern_walls[0]]; + back = [ + //width,height + [num_x*env_pitch().x-gf_cup_corner_radius*2-border, + heightz - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)], + //Position + [(num_x)*env_pitch().x/2, + (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, + z - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)/2], + //rotation + [90,0,0], + //enabled + wallpattern_walls[1]]; + left = [ + //width,height + [num_y*env_pitch().y-gf_cup_corner_radius*2-border, + heightz - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)], + //Position + [gf_tolerance/2+wall_thickness/2, + (num_y)*env_pitch().y/2, + z - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)/2], + //rotation + [90,0,90], + //enabled + wallpattern_walls[2]]; + right = [ + //width,height + [num_y*env_pitch().y-gf_cup_corner_radius*2-border, + heightz - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)], + //Position + [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, + (num_y)*env_pitch().y/2, + z - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)/2], + //rotation + [90,0,90], + //enabled + wallpattern_walls[3]]; + + echo("gridfinity_cup_wallpattern", wallpattern_thickness=wallpattern_thickness, heightz=heightz, wallpatternzpos=wallpatternzpos, border=border, ylocations=ylocations, xlocations=xlocations); + + ylocations = [left, right]; + xlocations = [front, back]; + + //patterns in the outer walls x + difference(){ + union(){ + for(i = [0:1:len(ylocations)-1]) + if(ylocations[i][3] > 0) + translate(ylocations[i][1]) + rotate(ylocations[i][2]) + render_conditional(env_force_render()) + cutout_pattern( + patternStyle = wall_pattern_settings[iPatternStyle], + canvasSize = ylocations[i][0], + border = wall_pattern_settings[iPatternBorder], + customShape = false, + circleFn = wall_pattern_settings[iPatternHoleSides], + holeSize = wall_pattern_settings[iPatternHoleSize], + holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], + holeHeight = wallpattern_thickness, + center=true, + centerz = true, + fill = wall_pattern_settings[iPatternFill], //"none", "space", "crop" + patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], + patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], + patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], + holeRadius = wall_pattern_settings[iPatternHoleRadius], + source = "wall_pattern", + patternFs = wall_pattern_settings[iPatternFs]); + + if(wallpattern_dividers_enabled == "vertical" || wallpattern_dividers_enabled == "both") + position_separators( + calculatedSeparators = calculated_vertical_separator_positions, + separator_orientation = "vertical") + let(verSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) + translate([-verSepThickness/2, left[1].y, left[1].z]) + rotate(left[2]) + render_conditional(env_force_render()) + //separator wall pattern + cutout_pattern( + patternStyle = wall_pattern_settings[iPatternStyle], + canvasSize = left[0], + border = wall_pattern_settings[iPatternBorder], + customShape = false, + circleFn = wall_pattern_settings[iPatternHoleSides], + holeSize = wall_pattern_settings[iPatternHoleSize], + holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], + holeHeight = verSepThickness, + center=true, + fill=wall_pattern_settings[iPatternFill], + patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], + patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], + patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], + holeRadius = wall_pattern_settings[iPatternHoleRadius], + source="vertical separator wall pattern", + patternFs = wall_pattern_settings[iPatternFs]); + } + + //subtract dividers from wall patterns + translate([env_pitch().x*num_x, 0, -fudgeFactor]) + separators( + calculatedSeparators = calculated_horizontal_separator_positions, + separator_orientation = "horizontal", + override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); + } + + //patterns in the outer walls y + difference(){ + union(){ + for(i = [0:1:len(xlocations)-1]) + if(xlocations[i][3] > 0) + translate(xlocations[i][1]) + rotate(xlocations[i][2]) + render_conditional(env_force_render()) + cutout_pattern( + patternStyle = wall_pattern_settings[iPatternStyle], + canvasSize = xlocations[i][0], + border = wall_pattern_settings[iPatternBorder], + customShape = false, + circleFn = wall_pattern_settings[iPatternHoleSides], + holeSize = wall_pattern_settings[iPatternHoleSize], + holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], + holeHeight = wallpattern_thickness, + center=true, + centerz = true, + fill = wall_pattern_settings[iPatternFill], //"none", "space", "crop" + patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], + patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], + patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], + holeRadius = wall_pattern_settings[iPatternHoleRadius], + source = "wall_pattern", + patternFs = wall_pattern_settings[iPatternFs]); + + if(wallpattern_dividers_enabled == "horizontal" || wallpattern_dividers_enabled == "both") + position_separators( + calculatedSeparators = calculated_horizontal_separator_positions, + separator_orientation = "horizontal") + let(hozSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) + rotate([0,0,-90]) + translate([front[1].x, hozSepThickness/2, front[1].z]) + rotate(front[2]) + render_conditional(env_force_render()) + //separator wall pattern + cutout_pattern( + patternStyle = wall_pattern_settings[iPatternStyle], + canvasSize = front[0], + border = wall_pattern_settings[iPatternBorder], + customShape = false, + circleFn = wall_pattern_settings[iPatternHoleSides], + holeSize = wall_pattern_settings[iPatternHoleSize], + holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], + holeHeight = hozSepThickness, + center = true, + fill = wall_pattern_settings[iPatternFill], + patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], + patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], + patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], + holeRadius = wall_pattern_settings[iPatternHoleRadius], + source = "horizontal separator wall pattern", + patternFs = wall_pattern_settings[iPatternFs]); + } + + //subtract dividers from outer wall pattern + translate([0, 0, -fudgeFactor]) + separators( + calculatedSeparators = calculated_vertical_separator_positions, + separator_orientation = "vertical", + override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); + } + } + } + + //Subtract setback from wall pattern + if(tapered_corner == "rounded" || tapered_corner == "chamfered") { + translate([ + 0, + tapered_setback+cutoutclearance_border, + env_pitch().z*num_z+gf_Lip_Height-gf_tolerance-cutoutclearance_border]) + rotate([270,0,0]) + union() + if(tapered_corner == "rounded"){ + roundedCorner( + radius = tapered_corner_size+cutoutclearance_border*2, + length=(num_x)*env_pitch().x, + height = tapered_corner_size); + } + else if(tapered_corner == "chamfered"){ + chamferedCorner( + chamferLength = tapered_corner_size, + length=(num_x)*env_pitch().x, + height = max((num_x)*env_pitch().x, (num_z)*env_pitch().z), + angled_extension =false); + } + } + + //Subtract cutout from wall pattern + if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) + for(wallcutout_location = wallcutout_locations) + if(wallcutout_location[iwalcutout_enabled] == true) + translate(wallcutout_location[iwalcutout_reposition]) + rotate(wallcutout_location[iwalcutout_rotation]) + translate(wallcutout_location[iwalcutout_position]) + WallCutout( + lowerWidth=wallcutout_location[iwalcutout_size].x+cutoutclearance_border*2, + wallAngle=wallcutout_location[iwalcutout_config][iwalcutoutconfig_angle], + height=wallcutout_location[iwalcutout_size].z+cutoutclearance_border, + thickness=wallcutout_location[iwalcutout_size].y, + cornerRadius=wallcutout_location[iwalcutout_config][iwalcutoutconfig_cornerradius]); + + + + //Subtract magnet caps from floor pattern + } + } + } + } + + // add text to the bottom + _magnet_position = calculateAttachmentPositions(cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter], cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Diameter]); + + if(env_help_enabled("trace")) echo("cup_base_text", _magnet_position=_magnet_position, iCupBase_MagnetSize=cupBase_settings[iCupBase_MagnetSize]); + cup_base_text( + cupBaseTextSettings = cupBaseTextSettings, + wall_thickness = wall_thickness, + magnet_position = _magnet_position.x); + + if(extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled) + color(env_colour(color_wallcutout)) + if(extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front) + tz(-fudgeFactor) + cube([unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),num_y*env_pitch().y,(num_z+1)*env_pitch().z]); + else + translate([unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),0,-fudgeFactor]) + cube([num_x*env_pitch().x-unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),num_y*env_pitch().y,(num_z+1)*env_pitch().z]); + + if(extendable_Settings.y[0]!=BinExtensionEnabled_disabled) + color(env_colour(color_wallcutout)) + if(extendable_Settings.y[0]==BinExtensionEnabled_front) + tz(-fudgeFactor) + cube([env_pitch().x*num_x,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); + else + translate([0,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),-fudgeFactor]) + cube([env_pitch().x*num_x,num_y*env_pitch().x-unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); + + + if((extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled || extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_disabled) && extendable_Settings[iExtendableTabsEnabled]) { + refTabHeight = extendable_Settings[iExtendableTabSize].x; + tabThickness = extendable_Settings[iExtendableTabSize].z == 0 ? 1.4 : extendable_Settings[iExtendableTabSize].z;//1.4; //This should be calculated + tabWidth = extendable_Settings[iExtendableTabSize].y; + tabStyle = extendable_Settings[iExtendableTabSize][iExtendableTabSizeStyle]; + + floorHeight = calculateFloorHeight( + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + floor_thickness=floor_thickness, + filled_in="disabled", + efficient_floor=cupBase_settings[iCupBase_EfficientFloor], + flat_base=cupBase_settings[iCupBase_FlatBase]) + calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness,efficient_floor)-tabThickness; + + //todo need to correct this + lipheight = lip_settings[iLipStyle] == "none" ? tabThickness + : lip_settings[iLipStyle] == "reduced" ? gf_lip_upper_taper_height+tabThickness + : lip_settings[iLipStyle] == "reduced_double" ? gf_lip_upper_taper_height+tabThickness + //Add tabThickness, as the taper can bleed in to the lip + : gf_lip_upper_taper_height + gf_lip_lower_taper_height-tabThickness; + ceilingHeight = env_pitch().z*num_z-headroom-lipheight; + + //tabWorkingheight = (num_z-1)*env_pitch().z-gf_Lip_Height; + tabWorkingheight = ceilingHeight-floorHeight; + + tabsCount = max(floor(tabWorkingheight/refTabHeight),1); + tabHeight = tabWorkingheight/tabsCount; + if(env_help_enabled("debug")) echo("tabs", binHeight =num_z, tabHeight=tabHeight, floorHeight=floorHeight, cavity_floor_radius=cupBase_settings[iCupBase_CavityFloorRadius], tabThickness=tabThickness); + cutx = extendable_Settings.x[iExtendablePositionmm]; + cuty = extendable_Settings.y[iExtendablePositionmm]; + even = (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_back) ? + [[0,180,90], [cutx,num_y*env_pitch().y-wall_thickness-gf_tolerance/2,floorHeight], "darkgreen"] + : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_front) ? + [[0,180,180], [wall_thickness+gf_tolerance/2,cuty,floorHeight], "green"] + : (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? + [[0,180,270], [cutx,wall_thickness+gf_tolerance/2,floorHeight], "lime"] + : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? + [[0,180,0], [num_x*env_pitch().x-wall_thickness-gf_tolerance/2,cuty,floorHeight], "aqua"] + : [[0,0,0],[0,0,0], extendable_Settings, "grey"]; + odd = (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? + [[0,0,90], [cutx,wall_thickness+gf_tolerance/2,floorHeight], "pink"] + : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_back) ? + [[0,0,180], [num_x*env_pitch().x-wall_thickness-gf_tolerance/2,cuty,floorHeight], "red"] + : (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_back) ? + [[0,0,270], [cutx,num_y*env_pitch().y-wall_thickness-gf_tolerance/2,floorHeight], "orange"] + : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? + [[0,0,0], [wall_thickness+gf_tolerance/2,cuty,floorHeight], "yellow"] + : [[0,0,0],[0,0,0], extendable_Settings, "grey"]; + + for(i=[0:1:tabsCount-1]) + { + isOdd = i % 2; + tabPos = isOdd == 0 ? even : odd; + if(env_help_enabled("trace")) echo("tabs", i=i, isOdd=isOdd, tabPos=tabPos); + tz((i+0.5)*tabHeight) + translate(tabPos[1]) + rotate(tabPos[0]) + attachment_clip(height=tabHeight, width=tabWidth, thickness=tabThickness, footingThickness=wall_thickness, tabStyle=tabStyle); + } + } + } + + if(divider_wall_removable_settings[iDividerRemovable_Enabled]) + dividers_removable_for_cup( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + divider_settings = divider_wall_removable_settings, + wall_thickness = wall_thickness, + floorHeight = floorHeight); + + if(env_help_enabled("info")) + //translate(gridfinityRenderPosition(position,num_x,num_y)) + ShowCalipers( + env_cutx(), + env_cuty(), + size=[num_x,num_y,num_z], + lip_settings[iLipStyle], + cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + floor_thickness = cupBase_settings[iCupBase_FloorThickness], + filled_in, + wall_thickness, + efficient_floor = cupBase_settings[iCupBase_EfficientFloor], + flat_base = cupBase_settings[iCupBase_FlatBase]); + + HelpTxt("gridfinity_cup",[ + "num_x",num_x + ,"num_y",num_y + ,"num_z",num_z + ,"filled_in",filled_in + ,"label_settings",label_settings + ,"fingerslide",fingerslide + ,"fingerslide_radius",fingerslide_radius + ,"fingerslide_walls",fingerslide_walls + ,"fingerslide_lip_aligned",fingerslide_lip_aligned + ,"cupBase_settings",cupBase_settings + ,"wall_thickness",wall_thickness + ,"chamber_wall_thickness",chamber_wall_thickness + ,"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_positions",calculated_vertical_separator_positions + ,"vertical_separator_cut_depth",vertical_separator_cut_depth + ,"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_positions",calculated_horizontal_separator_positions + ,"horizontal_separator_cut_depth",horizontal_separator_cut_depth + ,"lip_settings",lip_settings + ,"headroom",headroom + ,"tapered_corner",tapered_corner + ,"tapered_corner_size",tapered_corner_size + ,"tapered_setback",tapered_setback + ,"wallpattern_walls",wallpattern_walls + ,"wall_pattern_settings",wall_pattern_settings + ,"floor_pattern_settings",floor_pattern_settings + ,"wallcutout_vertical",[ + wallcutout_vertical, + wallcutout_vertical_position, + wallcutout_vertical_width, + wallcutout_vertical_angle, + wallcutout_vertical_height, + wallcutout_vertical_corner_radius] + ,"wallcutout_horizontal",[ + wallcutout_horizontal, + wallcutout_horizontal_position, + wallcutout_horizontal_width, + wallcutout_horizontal_angle, + wallcutout_horizontal_height, + wallcutout_horizontal_corner_radius] + ,"extendable_Settings",extendable_Settings + ] + ,env_help_enabled("info")); +} + + + +module partitioned_cavity(num_x, num_y, num_z, + label_settings=[], + cupBase_settings=[], + fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius, + fingerslide_walls=default_fingerslide_walls, + fingerslide_lip_aligned=fingerslide_lip_aligned, + wall_thickness=default_wall_thickness, + chamber_wall_thickness=default_chamber_wall_thickness, chamber_wall_headroom=default_chamber_wall_headroom, + calculated_vertical_separator_positions=calculated_vertical_separator_positions, + calculated_horizontal_separator_positions=calculated_horizontal_separator_positions, + lip_settings=[], + headroom=default_headroom, + sliding_lid_settings=[], + divider_wall_removable_settings=[]) { + + //Legacy variables + flat_base=cupBase_settings[iCupBase_FlatBase]; + cavity_floor_radius=cupBase_settings[iCupBase_CavityFloorRadius]; + spacer=cupBase_settings[iCupBase_Spacer]; + box_corner_attachments_only=cupBase_settings[iCupBase_CornerAttachmentsOnly]; + efficient_floor=cupBase_settings[iCupBase_EfficientFloor]; + half_pitch=cupBase_settings[iCupBase_HalfPitch]; + magnet_diameter=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter]; + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]; + magnet_easy_release=cupBase_settings[iCupBase_MagnetEasyRelease]; + floor_thickness=cupBase_settings[iCupBase_FloorThickness]; + zpoint = env_pitch().z*num_z-headroom; + + floorHeight = calculateFloorHeight( + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + floor_thickness=cupBase_settings[iCupBase_FloorThickness], + num_z=num_z, + filled_in="disabled", + efficient_floor=efficient_floor, + flat_base=cupBase_settings[iCupBase_FlatBase]); + + difference() { + color(env_colour(color_cupcavity)) + union(){ + basic_cavity(num_x, num_y, num_z, + fingerslide=fingerslide, fingerslide_walls=fingerslide_walls, fingerslide_lip_aligned=fingerslide_lip_aligned, fingerslide_radius=fingerslide_radius, + cupBase_settings=cupBase_settings, + wall_thickness=wall_thickness, + lip_settings=lip_settings, + sliding_lid_settings=sliding_lid_settings, + divider_wall_removable_settings=divider_wall_removable_settings, + headroom=headroom); + } + + if(env_help_enabled("trace")) echo("partitioned_cavity", vertical_separator_positions=calculated_vertical_separator_positions); + + sepFloorHeight = (efficient_floor != "off" ? floor_thickness : floorHeight); + + color(env_colour(color_divider)) + tz(sepFloorHeight-fudgeFactor) + separators( + calculatedSeparators = calculated_vertical_separator_positions, + separator_orientation = "vertical"); + + if(env_help_enabled("trace")) echo("partitioned_cavity", horizontal_separator_positions=calculated_horizontal_separator_positions); + + color(env_colour(color_divider)) + translate([env_pitch().x*num_x, 0, sepFloorHeight-fudgeFactor]) + separators( + calculatedSeparators = calculated_horizontal_separator_positions, + separator_orientation = "horizontal"); + + } +} + +module basic_cavity(num_x, num_y, num_z, + fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius,fingerslide_walls,fingerslide_lip_aligned=default_fingerslide_lip_aligned, + wall_thickness=default_wall_thickness, + lip_settings = [], + cupBase_settings = [], + sliding_lid_settings = [], + divider_wall_removable_settings = [], + headroom = 0) { + + //Legacy variables + floor_thickness=cupBase_settings[iCupBase_FloorThickness]; + magnet_diameter=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter]; + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]; + magnet_easy_release=cupBase_settings[iCupBase_MagnetEasyRelease]; + flat_base=cupBase_settings[iCupBase_FlatBase]; + spacer=cupBase_settings[iCupBase_Spacer]; + box_corner_attachments_only=cupBase_settings[iCupBase_CornerAttachmentsOnly]; + half_pitch=cupBase_settings[iCupBase_HalfPitch]; + + //zpoint = env_pitch().z*num_z-headroom; + + AssertSlidingLidSettings(sliding_lid_settings); + + seventeen = [env_pitch().x/2-4,env_pitch().y/2-4]; + + reducedlipstyle = + // replace "reduced" with "none" if z-height is less than 1.2 + (num_z < 1.2) ? "none" + // replace with "reduced" if z-height is less than 1.8 + : (num_z < 1.8) ? "reduced" + : lip_settings[iLipStyle]; + + filledInZ = env_pitch().z*num_z; + zpoint = filledInZ-headroom; + + floorht = min(filledInZ, calculateFloorHeight( + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + floor_thickness=cupBase_settings[iCupBase_FloorThickness], + num_z=num_z, + filled_in=FilledIn_disabled, + efficient_floor=cupBase_settings[iCupBase_EfficientFloor], + flat_base=cupBase_settings[iCupBase_FlatBase])); + + //Remove floor to create a vertical spacer. + nofloor = spacer && fingerslide == "none"; + + //Difference between the wall and support thickness + lipSupportThickness = (reducedlipstyle == "minimum" || reducedlipstyle == "none") ? 0 + : reducedlipstyle == "reduced" ? gf_lip_upper_taper_height - wall_thickness + : reducedlipstyle == "reduced_double" ? gf_lip_upper_taper_height - wall_thickness + : gf_lip_upper_taper_height + gf_lip_lower_taper_height- wall_thickness; + lipHeight = (reducedlipstyle == "none") ? 0 : gf_Lip_Height-0.65; + //bottom of the lip where it touches the wall + lipBottomZ = ((reducedlipstyle == "minimum" || reducedlipstyle == "none") ? env_pitch().z*num_z +fudgeFactor*3 + : reducedlipstyle == "reduced" ? env_pitch().z*num_z+fudgeFactor*3 + : reducedlipstyle == "reduced_double" ? env_pitch().z*num_z+fudgeFactor*3 + : env_pitch().z*num_z-gf_lip_height-lipSupportThickness); + //lipBottomZ = env_pitch().z*num_z+fudgeFactor*3; + innerLipRadius = gf_cup_corner_radius-gf_lip_lower_taper_height-gf_lip_upper_taper_height; //1.15 + innerWallRadius = gf_cup_corner_radius-wall_thickness; + + + aboveLidHeight = sliding_lid_settings[iSlidingLidThickness] + lipHeight; + + //cavityHeight= max(lipBottomZ-floorht,0); + cavityHeight= max(lipBottomZ-floorht,0); + cavity_floor_radius = calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness,cupBase_settings[iCupBase_EfficientFloor]); + + // I couldn't think of a good name for this ('q') but effectively it's the + // size of the overhang that produces a wall thickness that's less than the lip + // arount the top inside edge. + q = 1.65-wall_thickness+0.95; // default 1.65 corresponds to wall thickness of 0.95 + + if(env_help_enabled("trace")) echo("basic_cavity", floorht=floorht, efficient_floor=cupBase_settings[iCupBase_EfficientFloor], nofloor=nofloor, lipSupportThickness=lipSupportThickness, lipBottomZ=lipBottomZ, innerLipRadius=innerLipRadius, innerWallRadius=innerWallRadius, cavityHeight=cavityHeight, cavity_floor_radius=cavity_floor_radius, flat_base=cupBase_settings[iCupBase_FlatBase]); + + if(filledInZ>floorht) { + union(){ + difference() { + union() { + if (reducedlipstyle == "minimum" || reducedlipstyle == "none") { + } + else if (reducedlipstyle == "reduced") { + } + else if (reducedlipstyle == "reduced_double") { + } + else { // normal + lowerTaperZ = filledInZ-gf_lip_height-lipSupportThickness; + if(lowerTaperZ <= floorht){ + hull() cornercopy(seventeen, num_x, num_y) + tz(floorht) + cylinder(r=innerLipRadius, h=filledInZ-floorht+fudgeFactor*4); // lip + } else { + hull() cornercopy(seventeen, num_x, num_y) + tz(filledInZ-gf_lip_height-fudgeFactor) + cylinder(r=innerLipRadius, h=gf_lip_height+fudgeFactor*4); // lip + + hull() cornercopy(seventeen, num_x, num_y) + tz(filledInZ-gf_lip_height-lipSupportThickness-fudgeFactor) + cylinder( + r1=innerWallRadius, + r2=innerLipRadius, h=q+fudgeFactor); // ... to top of thin wall ... + } + } + + //Cavity below lip + if(cavityHeight > 0) + hull() cornercopy(seventeen, num_x, num_y) + tz(floorht) + roundedCylinder( + h=cavityHeight, + r=innerWallRadius, + roundedr1=min(cavityHeight, cavity_floor_radius), + roundedr2=0); + } //union of main cavity + + if(sliding_lid_settings[iSlidingLidEnabled]) + SlidingLidSupportMaterial( + num_x = num_x, + num_y = num_y, + wall_thickness = wall_thickness, + sliding_lid_settings = sliding_lid_settings, + zpoint=zpoint); + + // fingerslide inside bottom of cutout + if(fingerslide != "none"){ + FingerSlide( + num_x = num_x, + num_y = num_y, + num_z = num_z, + fingerslide_walls=fingerslide_walls, + lipAligned=fingerslide_lip_aligned, + fingerslide=fingerslide, + fingerslide_radius=fingerslide_radius, + reducedlipstyle=reducedlipstyle, + wall_thickness=wall_thickness, + floorht=floorht, + seventeen=seventeen); + } + + if(divider_wall_removable_settings[iDividerRemovable_Enabled]) + removable_dividers_support( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + divider_settings = divider_wall_removable_settings, + wall_thickness=wall_thickness, + floorHeight=floorht); + + if (cupBase_settings[iCupBase_EfficientFloor] != "off") { + magnetPosition = calculateAttachmentPositions(magnet_diameter, cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Diameter]); + magnetCoverHeight = max( + cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]); + hasCornerAttachments = magnet_diameter > 0 || screw_depth > 0; + efficientFloorGridHeight = max(magnetCoverHeight,gfBaseHeight())+floor_thickness; + if(env_help_enabled("trace")) echo("basic_cavity", efficient_floor=cupBase_settings[iCupBase_EfficientFloor], efficientFloorGridHeight=efficientFloorGridHeight, floor_thickness=floor_thickness); + difference(){ + tz(-fudgeFactor) + cube([num_x*env_pitch().x, num_y*env_pitch().y, efficientFloorGridHeight]); + + difference(){ + efficient_floor_grid( + num_x, num_y, + floorStyle = cupBase_settings[iCupBase_EfficientFloor], + half_pitch=half_pitch, + flat_base=flat_base, + floor_thickness=floor_thickness, + efficientFloorGridHeight=efficientFloorGridHeight, + margins=q); + + //Screw and magnet covers required for efficient floor + if(hasCornerAttachments) + gridcopycorners(num_x, num_y, magnetPosition, box_corner_attachments_only) + EfficientFloorAttachmentCaps( + grid_copy_corner_index = $gcci, + floor_thickness = floor_thickness, + magnet_size = cupBase_settings[iCupBase_MagnetSize], + screw_size = cupBase_settings[iCupBase_ScrewSize], + wall_thickness = magnet_easy_release == MagnetEasyRelease_inner ? wall_thickness*2 : wall_thickness ); + } + } + } + } // difference removals from main body. + + if(divider_wall_removable_settings[iDividerRemovable_Enabled]) + removable_dividers_slots( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + divider_settings = divider_wall_removable_settings, + wall_thickness=wall_thickness, + floorHeight=floorht); + + //Sliding lid rebate. + if(sliding_lid_settings[iSlidingLidEnabled]) + tz(zpoint) + SlidingLidCavity( + num_x = num_x, + num_y = num_y, + wall_thickness = wall_thickness, + sliding_lid_settings = sliding_lid_settings, + aboveLidHeight = aboveLidHeight); + }} + + // cut away side lips if num_x is less than 1 + if(env_help_enabled("trace")) echo(str("cutaway input:", num_x, " rounded:", roundtoDecimal(num_x, sigFigs = 2), " numx<1:", num_x < 1," round<1:", roundtoDecimal(num_x, sigFigs = 2)<1, " numx=round:", num_x==roundtoDecimal(num_x, sigFigs = 2))); + if (roundtoDecimal(num_x,2) < lip_settings[iLipSideReliefTrigger].x) { + top = num_z*env_pitch().z+gf_Lip_Height; + height = top-lipBottomZ+fudgeFactor*2; + + hull() + for (x=[1.5+0.25+wall_thickness, num_x*env_pitch().x-1.5-0.25-wall_thickness]){ + for (y=[11, (num_y)*env_pitch().y-seventeen.y]) + translate([x, y, top-height]) + cylinder(d=3, h=height); + } + } + + if (roundtoDecimal(num_y,2) < lip_settings[iLipSideReliefTrigger].y) { + top = num_z*env_pitch().z+gf_Lip_Height; + height = top-lipBottomZ+fudgeFactor*2; + + hull() + for (y=[1.5+0.25+wall_thickness, num_y*env_pitch().y-1.5-0.25-wall_thickness]){ + for (x=[11, (num_x)*env_pitch().x-seventeen.x]) + translate([x, y, top-height]) + cylinder(d=3, h=height); + } + } + + if (nofloor) { + tz(-fudgeFactor) + hull() + cornercopy(num_x=num_x, num_y=num_y, r=seventeen) + cylinder(r=2, h=gf_cupbase_lower_taper_height+fudgeFactor); + gridcopy(1, 1) + EfficientFloor(num_x, num_y,-fudgeFactor, q); + } +} + +///Creates the finger slide that will be subtracted from the cavity +module FingerSlide( + num_x = num_x, + num_y = num_y, + num_z = num_z, + fingerslide_walls=fingerslide_walls, + fingerslide=fingerslide, + fingerslide_radius=fingerslide_radius, + reducedlipstyle=reducedlipstyle, + wall_thickness=wall_thickness, + floorht=floorht, + lipAligned = true, + seventeen=seventeen) { + assert(is_num(num_x), "num_x must be a number"); + assert(is_num(num_y), "num_y must be a number"); + assert(is_num(num_z), "num_z must be a number"); + assert(is_list(fingerslide_walls), "fingerslide_walls must be a list"); + assert(is_string(fingerslide), "fingerslide must be a string"); + assert(is_num(fingerslide_radius), "fingerslide_radius must be a number"); + assert(is_string(reducedlipstyle), "reducedlipstyle must be a string"); + assert(is_num(wall_thickness), "wall_thickness must be a number"); + assert(is_num(floorht), "floorht must be a number"); + assert(is_bool(lipAligned), "lipAligned must be a bool"); + assert(is_list(seventeen), "seventeen must be a number"); + + echo("fingerslide", fingerslide_walls=fingerslide_walls, fingerslide=fingerslide); + front = [ + //width + num_x*env_pitch().x, + //Position + [0, 0, 0], + //rotation + [0,0,0], + //cup width for finger slide (opposide dimention) + num_y*env_pitch().y, + //cup height + num_z*env_pitch().z]; + back = [ + //width + num_x*env_pitch().x, + //Position + [num_x*env_pitch().x, num_y*env_pitch().y, 0], + //rotation + [0,0,180], + //cup width for finger slide (opposide dimention) + num_y*env_pitch().y, + //cup height + num_z*env_pitch().z]; + left = [ + //width + num_y*env_pitch().y, + //Position + [0, num_y*env_pitch().y, 0], + //rotation + [0,0,270], + //cup width for finger slide (opposide dimention) + num_x*env_pitch().x, + //cup height + num_z*env_pitch().z]; + right = [ + //width + num_y*env_pitch().y, + //Position + [num_x*env_pitch().x, 0, 0], + //rotation + [0,0,90], + //cup width for finger slide (opposide dimention) + num_x*env_pitch().x, + //cup height + num_z*env_pitch().z]; + + locations = [front, back, left, right]; + function get_fingerslide_radius(wall, cup_size, cup_height, fingerslide_radius) = + let(radius_start = wall == 1 ? fingerslide_radius : wall, + calculated_radius = radius_start < 0 ? cup_size/abs(radius_start) : radius_start, + limited_radius = min(calculated_radius,cup_height,cup_size/2)) + echo("get_fingerslide_radius", is_ratio=(wall < 0),result=limited_radius, wall=wall, cup_size=cup_size, cup_height=cup_height, fingerslide_radius=fingerslide_radius) + limited_radius; + + for(i = [0:1:len(locations)-1]) + union() + if(fingerslide_walls[i] != 0) + //patterns in the outer walls + translate(locations[i][1]) + rotate(locations[i][2]) + translate([0, + lipAligned && reducedlipstyle =="normal" ? -seventeen.x-1.15+env_pitch().x/2 + : lipAligned && reducedlipstyle == "reduced" ? -seventeen.x-1.15+env_pitch().x/2-gf_lip_lower_taper_height + : lipAligned && reducedlipstyle == "reduced_double" ? -seventeen.x-1.15+env_pitch().x/2-gf_lip_lower_taper_height + : 0.25+wall_thickness, floorht]) //todo:pitch issue here? + //translate([0,-seventeen-1.15+env_pitch().x/2, floorht]) + union(){ + if(fingerslide == "rounded"){ + roundedCorner( + radius = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), + length=locations[i][0], + height = env_pitch().z*num_z-floorht+fudgeFactor); + } + else if(fingerslide == "chamfered"){ + chamferedCorner( + chamferLength = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), + length=locations[i][0], + height = env_pitch().z*num_z-floorht+fudgeFactor); + } + } +} \ No newline at end of file diff --git a/modules/module_lip.scad b/modules/module_lip.scad index 287576e..3eafe3c 100644 --- a/modules/module_lip.scad +++ b/modules/module_lip.scad @@ -2,9 +2,6 @@ include include include - -clr = 0; -clr = 0.1; //Lip object configuration iLipStyle=0; iLipSideReliefTrigger=1; @@ -75,7 +72,9 @@ module cupLip( lip_top_relief_height = -1, lip_top_relief_width = -1, lip_clip_position = LipClipPosition_disabled, - lip_non_blocking = false){ + lip_non_blocking = false, + lip_as_void = false, + sliding_clearance = 0.1){ assert(is_num(num_x) && num_x > 0, "num_x must be a number greater than 0"); assert(is_num(num_y) && num_y > 0, "num_y must be a number greater than 0"); @@ -166,6 +165,8 @@ module cupLip( pitch.z]); } + clr = lip_as_void?sliding_clearance:0; + if (lipStyle == "minimum" || lipStyle == "none") { hull() cornercopy(seventeen, num_x, num_y) tz(-fudgeFactor) From 7ffe5cf4881572525c6801a0c3ac1a4340469f90 Mon Sep 17 00:00:00 2001 From: Danilo Sanchi Date: Wed, 11 Jun 2025 23:02:22 +0200 Subject: [PATCH 3/4] ok --- gridfinity_basic_cup.json | 60 ++++- gridfinity_basic_cup.scad | 391 ++++++++++++++++++++--------- modules/module_gridfinity.scad | 6 +- modules/module_gridfinity_cup.scad | 157 ++++++------ modules/module_lip.scad | 8 +- 5 files changed, 419 insertions(+), 203 deletions(-) diff --git a/gridfinity_basic_cup.json b/gridfinity_basic_cup.json index c2808d4..8032ff3 100644 --- a/gridfinity_basic_cup.json +++ b/gridfinity_basic_cup.json @@ -4,13 +4,24 @@ "Label": { "box_corner_attachments_only": "true", "cavity_floor_radius": "-1", + "center_magnet_diameter": "0", + "center_magnet_thickness": "0", "chamber_wall_thickness": "1.2", "cutx": "0", "cuty": "0", + "depth": "1", + "efficient_floor": "false", + "enable_help": "false", + "extention_tabs_enabled": "true", + "extention_x_enabled": "false", + "extention_y_enabled": "false", + "filled_in": "off", "fingerslide": "rounded", "fingerslide_radius": "8", + "flat_base": "false", "floor_thickness": "0.69999999999999996", "half_pitch": "false", + "height": "4", "hole_overhang_remedy": "2", "horizontal_chambers": "1", "horizontal_irregular_subdivisions": "false", @@ -19,8 +30,13 @@ "horizontal_separator_bend_separation": "0", "horizontal_separator_config": "10.5|21|42|50|60", "horizontal_separator_cut_depth": "0", + "label": "leftchamber", + "label_relief": "0", "label_size": "[0, 14, 0, 0.6]", "lip_style": "normal", + "magnet_diameter": "0", + "position": "default", + "screw_depth": "0", "spacer": "false", "tapered_corner": "none", "tapered_corner_size": "10", @@ -33,23 +49,46 @@ "vertical_separator_config": "10.5|21|42|50|60", "vertical_separator_cut_depth": "0", "wall_thickness": "0", + "wallcutout_angle": "70", + "wallcutout_corner_radius": "5", + "wallcutout_enabled": "false", + "wallcutout_height": "0", + "wallcutout_walls": "[1, 0, 0, 0]", + "wallcutout_width": "0", + "wallpattern_dividers_enabled": "false", "wallpattern_enabled": "false", "wallpattern_fill": "none", "wallpattern_hole_sides": "6", + "wallpattern_hole_size": "10", "wallpattern_hole_spacing": "2", "wallpattern_style": "grid", - "wallpattern_walls": "[1, 1, 1, 1]" + "wallpattern_voronoi_noise": "0.75", + "wallpattern_voronoi_radius": "0.5", + "wallpattern_walls": "[1, 1, 1, 1]", + "width": "1", + "zClearance": "2" }, "solid": { "box_corner_attachments_only": "true", "cavity_floor_radius": "-1", + "center_magnet_diameter": "0", + "center_magnet_thickness": "0", "chamber_wall_thickness": "1.2", "cutx": "0", "cuty": "0", + "depth": "4", + "efficient_floor": "false", + "enable_help": "false", + "extention_tabs_enabled": "true", + "extention_x_enabled": "false", + "extention_y_enabled": "false", + "filled_in": "on", "fingerslide": "none", "fingerslide_radius": "8", + "flat_base": "false", "floor_thickness": "0.69999999999999996", "half_pitch": "false", + "height": "3", "hole_overhang_remedy": "2", "horizontal_chambers": "1", "horizontal_irregular_subdivisions": "false", @@ -58,8 +97,13 @@ "horizontal_separator_bend_separation": "0", "horizontal_separator_config": "10.5|21|42|50|60", "horizontal_separator_cut_depth": "0", + "label": "disabled", + "label_relief": "0", "label_size": "[0, 14, 0, 0.6]", "lip_style": "normal", + "magnet_diameter": "0", + "position": "center", + "screw_depth": "0", "spacer": "false", "tapered_corner": "none", "tapered_corner_size": "10", @@ -72,12 +116,24 @@ "vertical_separator_config": "10.5|21|42|50|60", "vertical_separator_cut_depth": "0", "wall_thickness": "0", + "wallcutout_angle": "70", + "wallcutout_corner_radius": "5", + "wallcutout_enabled": "false", + "wallcutout_height": "0", + "wallcutout_walls": "[1, 0, 0, 0]", + "wallcutout_width": "0", + "wallpattern_dividers_enabled": "false", "wallpattern_enabled": "false", "wallpattern_fill": "none", "wallpattern_hole_sides": "6", + "wallpattern_hole_size": "10", "wallpattern_hole_spacing": "2", "wallpattern_style": "grid", - "wallpattern_walls": "[1, 1, 1, 1]" + "wallpattern_voronoi_noise": "0.75", + "wallpattern_voronoi_radius": "0.5", + "wallpattern_walls": "[1, 1, 1, 1]", + "width": "2", + "zClearance": "0" } } } diff --git a/gridfinity_basic_cup.scad b/gridfinity_basic_cup.scad index 751dead..3100011 100644 --- a/gridfinity_basic_cup.scad +++ b/gridfinity_basic_cup.scad @@ -9,14 +9,15 @@ include use +use use /**/ /* [General Cup] */ // X dimension. grid units (multiples of 42mm) or mm. -width = [2, 0]; //0.1 +width = [1, 0]; //0.1 // Y dimension. grid units (multiples of 42mm) or mm. -depth = [1, 0]; //0.1 +depth = [2, 0]; //0.1 // Z dimension excluding. grid units (multiples of 7mm) or mm. height = [3, 0]; //0.1 // Fill in solid block (overrides all following options) @@ -28,7 +29,7 @@ headroom = 0.8; // 0.1 /* [Cup Lip] */ // Style of the cup lip -lip_style = "normal"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] +lip_style = "reduced_double"; // [ normal, reduced, reduced_double, minimum, none:not stackable ] // Below this the inside of the lip will be reduced for easier access. lip_side_relief_trigger = [1,1]; //0.1 // Create a relief in the lip @@ -122,11 +123,11 @@ flat_base_rounded_radius = -1; flat_base_rounded_easyPrint = -1; /* [Label] */ -label_style = "disabled"; //[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"; //[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] // Include overhang for labeling (and specify left/right/center justification) label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber] // 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 +label_size = [0,10,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; @@ -292,142 +293,292 @@ $fa = fa; $fs = fs; $fn = fn; -set_environment( - width = width, - depth = depth, - height = height, - render_position = render_position, - help = enable_help, - pitch = pitch, - cut = [cutx, cuty, height], - setColour = set_colour, - randomSeed = random_seed, - force_render = force_render) -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, +intersection() { + + union() { +// translate([0.1,0.1,0]) + set_environment( + width = width, + depth = depth, + height = height, + render_position = render_position, + help = enable_help, + pitch = pitch, + cut = [cutx, cuty, height], + setColour = set_colour, + randomSeed = random_seed, + force_render = force_render) + gridfinity_cup( + width = width, depth = depth, height = height, + filled_in = filled_in, + label_settings = LabelSettings( + labelStyle = "disabled", + 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, + efficientFloor = efficient_floor, + halfPitch = half_pitch, + flatBase = flat_base, + spacer = spacer, + minimumPrintablePadSize = minimum_printable_pad_size, flatBaseRoundedRadius = flat_base_rounded_radius, flatBaseRoundedEasyPrint = flat_base_rounded_easyPrint), - wall_thickness=wall_thickness, - chamber_wall_thickness=chamber_wall_thickness, - chamber_wall_headroom=chamber_wall_headroom, - divider_wall_removable_settings = DividerRemovableSettings( - enabled=divider_walls_enabled, - walls=divider_walls, - headroom=divider_headroom, - support_thickness=divider_walls_support_thickness, - slot_size=divider_wall_slot_size, - divider_spacing=divider_walls_spacing, - divider_thickness=divider_walls_thickness, - divider_clearance=divider_clearance, - divider_slot_spanning=divider_slot_spanning), - 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_settings = LipSettings( - lipStyle=lip_style, - lipSideReliefTrigger=lip_side_relief_trigger, - lipTopReliefHeight=lip_top_relief_height, - lipTopReliefWidth=lip_top_relief_width, - lipNotch=lip_top_notches, - lipClipPosition=lip_clip_position, - lipNonBlocking=lip_non_blocking), - headroom=headroom, - tapered_corner=tapered_corner, - tapered_corner_size = tapered_corner_size, - tapered_setback = tapered_setback, - wallpattern_walls=wallpattern_walls, - wallpattern_dividers_enabled=wallpattern_dividers_enabled, - wall_pattern_settings = PatternSettings( - patternEnabled = wallpattern_enabled, - patternStyle = wallpattern_style, + wall_thickness = wall_thickness, + chamber_wall_thickness = chamber_wall_thickness, + chamber_wall_headroom = chamber_wall_headroom, + divider_wall_removable_settings = DividerRemovableSettings( + enabled = divider_walls_enabled, + walls = divider_walls, + headroom = divider_headroom, + support_thickness = divider_walls_support_thickness, + slot_size = divider_wall_slot_size, + divider_spacing = divider_walls_spacing, + divider_thickness = divider_walls_thickness, + divider_clearance = divider_clearance, + divider_slot_spanning = divider_slot_spanning), + 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_settings = LipSettings( + lipStyle = lip_style, + lipSideReliefTrigger = lip_side_relief_trigger, + lipTopReliefHeight = lip_top_relief_height, + lipTopReliefWidth = lip_top_relief_width, + lipNotch = lip_top_notches, + lipClipPosition = lip_clip_position, + lipNonBlocking = lip_non_blocking), + headroom = headroom, + tapered_corner = tapered_corner, + tapered_corner_size = tapered_corner_size, + tapered_setback = tapered_setback, + wallpattern_walls = wallpattern_walls, + wallpattern_dividers_enabled = wallpattern_dividers_enabled, + wall_pattern_settings = PatternSettings( + patternEnabled = wallpattern_enabled, + patternStyle = wallpattern_style, patternFill = wallpattern_fill, - patternBorder = wallpattern_border, - patternHoleSize = wallpattern_hole_size, + patternBorder = wallpattern_border, + patternHoleSize = wallpattern_hole_size, patternHoleSides = wallpattern_hole_sides, - patternHoleSpacing = wallpattern_hole_spacing, + patternHoleSpacing = wallpattern_hole_spacing, patternHoleRadius = wallpattern_hole_radius, patternGridChamfer = wallpattern_pattern_grid_chamfer, patternVoronoiNoise = wallpattern_pattern_voronoi_noise, patternBrickWeight = wallpattern_pattern_brick_weight, - patternFs = wallpattern_pattern_quality), - floor_pattern_settings = PatternSettings( - patternEnabled = floorpattern_enabled, - patternStyle = floorpattern_style, + patternFs = wallpattern_pattern_quality), + floor_pattern_settings = PatternSettings( + patternEnabled = floorpattern_enabled, + patternStyle = floorpattern_style, patternFill = floorpattern_fill, - patternBorder = floorpattern_border, - patternHoleSize = floorpattern_hole_size, + patternBorder = floorpattern_border, + patternHoleSize = floorpattern_hole_size, patternHoleSides = floorpattern_hole_sides, - patternHoleSpacing = floorpattern_hole_spacing, + patternHoleSpacing = floorpattern_hole_spacing, patternHoleRadius = floorpattern_hole_radius, patternGridChamfer = floorpattern_pattern_grid_chamfer, patternVoronoiNoise = floorpattern_pattern_voronoi_noise, patternBrickWeight = floorpattern_pattern_brick_weight, - patternFs = floorpattern_pattern_quality), - 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, + patternFs = floorpattern_pattern_quality), + 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( + 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)); + + + set_environment( + width = width, + depth = depth, + height = height, + render_position = render_position, + help = enable_help, + pitch = pitch, + cut = [cutx, cuty, height], + setColour = set_colour, + randomSeed = random_seed, + force_render = force_render) + gridfinity_removable_label( + 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, + flatBaseRoundedRadius = flat_base_rounded_radius, + flatBaseRoundedEasyPrint = flat_base_rounded_easyPrint), + wall_thickness = wall_thickness, + chamber_wall_thickness = chamber_wall_thickness, + chamber_wall_headroom = chamber_wall_headroom, + divider_wall_removable_settings = DividerRemovableSettings( + enabled = divider_walls_enabled, + walls = divider_walls, + headroom = divider_headroom, + support_thickness = divider_walls_support_thickness, + slot_size = divider_wall_slot_size, + divider_spacing = divider_walls_spacing, + divider_thickness = divider_walls_thickness, + divider_clearance = divider_clearance, + divider_slot_spanning = divider_slot_spanning), + 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_settings = LipSettings( + lipStyle = lip_style, + lipSideReliefTrigger = lip_side_relief_trigger, + lipTopReliefHeight = lip_top_relief_height, + lipTopReliefWidth = lip_top_relief_width, + lipNotch = lip_top_notches, + lipClipPosition = lip_clip_position, + lipNonBlocking = lip_non_blocking), + headroom = headroom, + tapered_corner = tapered_corner, + tapered_corner_size = tapered_corner_size, + tapered_setback = tapered_setback, + wallpattern_walls = wallpattern_walls, + wallpattern_dividers_enabled = wallpattern_dividers_enabled, + wall_pattern_settings = PatternSettings( + patternEnabled = wallpattern_enabled, + patternStyle = wallpattern_style, + patternFill = wallpattern_fill, + patternBorder = wallpattern_border, + patternHoleSize = wallpattern_hole_size, + patternHoleSides = wallpattern_hole_sides, + patternHoleSpacing = wallpattern_hole_spacing, + patternHoleRadius = wallpattern_hole_radius, + patternGridChamfer = wallpattern_pattern_grid_chamfer, + patternVoronoiNoise = wallpattern_pattern_voronoi_noise, + patternBrickWeight = wallpattern_pattern_brick_weight, + patternFs = wallpattern_pattern_quality), + floor_pattern_settings = PatternSettings( + patternEnabled = floorpattern_enabled, + patternStyle = floorpattern_style, + patternFill = floorpattern_fill, + patternBorder = floorpattern_border, + patternHoleSize = floorpattern_hole_size, + patternHoleSides = floorpattern_hole_sides, + patternHoleSpacing = floorpattern_hole_spacing, + patternHoleRadius = floorpattern_hole_radius, + patternGridChamfer = floorpattern_pattern_grid_chamfer, + patternVoronoiNoise = floorpattern_pattern_voronoi_noise, + patternBrickWeight = floorpattern_pattern_brick_weight, + patternFs = floorpattern_pattern_quality), + 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)); + + } + + cube([500, 500, 500]); +} \ No newline at end of file diff --git a/modules/module_gridfinity.scad b/modules/module_gridfinity.scad index 4fe89e4..4c88187 100644 --- a/modules/module_gridfinity.scad +++ b/modules/module_gridfinity.scad @@ -48,7 +48,8 @@ module frame_cavity( reducedWallHeight = -1, reducedWallWidth = -1, reducedWallOuterEdgesOnly=false, - enable_grippers = false) { + enable_grippers = false, + clr=0) { assert(is_num(num_x)); assert(is_num(num_y)); @@ -99,7 +100,8 @@ module frame_cavity( extend_down=extra_down, render_top=render_top, render_bottom=render_bottom, - remove_bottom_taper=remove_bottom_taper) + remove_bottom_taper=remove_bottom_taper, + clr=clr) //cell cavity if($children >=1) children(0); } diff --git a/modules/module_gridfinity_cup.scad b/modules/module_gridfinity_cup.scad index 51eca1a..300faff 100644 --- a/modules/module_gridfinity_cup.scad +++ b/modules/module_gridfinity_cup.scad @@ -231,7 +231,7 @@ gridfinity_cup();//execution point // and not by position. The number of parameters makes positional parameters error prone, and // additional parameters may be added over time and break things. // separator positions are defined in units from the left side -module gridfinity_removable_label( +module gridfinity_cup( width=default_width, depth=default_depth, height=default_height, @@ -440,16 +440,16 @@ module gridfinity_removable_label( debug_cut() union(){ difference() { - intersection() { - gridfinity_label( - num_x = num_x, - num_y = num_y, - zpoint = zpoint, - vertical_separator_positions = calculated_vertical_separator_positions, - horizontal_separator_positions = calculated_horizontal_separator_positions, - label_settings = label_settings, - render_option = "labelwithsocket"); + grid_block( + num_x, num_y, num_z, + cupBase_settings = cupBase_settings, + wall_thickness = wall_thickness, + lip_settings = lip_settings, + filledin = filled_in); + if(filled_in == FilledIn_disabled) + union(){ + //primary cavity partitioned_cavity( num_x, num_y, num_z, label_settings=label_settings, @@ -458,7 +458,7 @@ module gridfinity_removable_label( fingerslide_radius=fingerslide_radius, fingerslide_walls=fingerslide_walls, fingerslide_lip_aligned=fingerslide_lip_aligned, - wall_thickness=wall_thickness+sliding_clearance, + wall_thickness=wall_thickness, chamber_wall_thickness=chamber_wall_thickness, chamber_wall_headroom=chamber_wall_headroom, calculated_vertical_separator_positions = calculated_vertical_separator_positions, @@ -467,31 +467,7 @@ module gridfinity_removable_label( headroom=headroom, sliding_lid_settings= slidingLidSettings, divider_wall_removable_settings = divider_wall_removable_settings); - } - - label_size = calculateLabelSize(label_settings[iLabelSettings_size]); - labelCornerRadius = label_size[3]; - lipHeight = 3.75; - tz(-lipHeight - labelCornerRadius) - tz(zpoint) - cupLip( - num_x = num_x, - num_y = num_y, - lipStyle = lip_settings[iLipStyle], - wall_thickness = wall_thickness, - lip_notches = false, - lip_top_relief_height = lip_settings[iLipTopReliefHeight], - lip_top_relief_width = lip_settings[iLipTopReliefWidth], - lip_clip_position = lip_settings[iLipClipPosition], - lip_non_blocking = lip_settings[iLipNonBlocking], - lip_as_void=true, - sliding_clearance=sliding_clearance - ); - } - - if(filled_in == FilledIn_disabled) - union(){ color(env_colour(color_wallcutout)) union(){ cavityFloorRadius = calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness, cupBase_settings[iCupBase_EfficientFloor]); @@ -583,10 +559,10 @@ module gridfinity_removable_label( if(floor_pattern_settings[iPatternEnabled]){ difference(){ pad_copy( - num_x = num_x, - num_y = num_y, - half_pitch = cupBase_settings[iCupBase_HalfPitch], - flat_base = cupBase_settings[iCupBase_FlatBase], + num_x = num_x, + num_y = num_y, + half_pitch = cupBase_settings[iCupBase_HalfPitch], + flat_base = cupBase_settings[iCupBase_FlatBase], minimium_size = cupBase_settings[iCupBase_MinimumPrintablePadSize]) translate([$pad_copy_size.x*env_pitch().x/2, $pad_copy_size.y*env_pitch().y/2,-fudgeFactor]) cutout_pattern( @@ -629,15 +605,15 @@ module gridfinity_removable_label( border = 0; //Believe this to be no longer needed wallpatternzpos = wallpatternClearanceHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], floor_thickness = cupBase_settings[iCupBase_FloorThickness], - num_z=num_z, - filled_in=FilledIn_disabled, - efficient_floor=efficient_floor, - flat_base=cupBase_settings[iCupBase_FlatBase], - floor_inner_radius = cavityFloorRadius, + num_z=num_z, + filled_in=FilledIn_disabled, + efficient_floor=efficient_floor, + flat_base=cupBase_settings[iCupBase_FlatBase], + floor_inner_radius = cavityFloorRadius, outer_cup_radius = 1); //I feel this should use wallTop, but it seems to work... @@ -658,8 +634,8 @@ module gridfinity_removable_label( [num_x*env_pitch().x-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x/2, - gf_tolerance/2+wall_thickness/2, + [(num_x)*env_pitch().x/2, + gf_tolerance/2+wall_thickness/2, z - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)/2], //rotation [90,0,0], @@ -670,11 +646,11 @@ module gridfinity_removable_label( [num_x*env_pitch().x-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x/2, - (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, + [(num_x)*env_pitch().x/2, + (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, z - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)/2], //rotation - [90,0,0], + [90,0,0], //enabled wallpattern_walls[1]]; left = [ @@ -682,8 +658,8 @@ module gridfinity_removable_label( [num_y*env_pitch().y-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)], //Position - [gf_tolerance/2+wall_thickness/2, - (num_y)*env_pitch().y/2, + [gf_tolerance/2+wall_thickness/2, + (num_y)*env_pitch().y/2, z - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)/2], //rotation [90,0,90], @@ -694,8 +670,8 @@ module gridfinity_removable_label( [num_y*env_pitch().y-gf_cup_corner_radius*2-border, heightz - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)], //Position - [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, - (num_y)*env_pitch().y/2, + [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, + (num_y)*env_pitch().y/2, z - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)/2], //rotation [90,0,90], @@ -736,16 +712,16 @@ module gridfinity_removable_label( if(wallpattern_dividers_enabled == "vertical" || wallpattern_dividers_enabled == "both") position_separators( - calculatedSeparators = calculated_vertical_separator_positions, + calculatedSeparators = calculated_vertical_separator_positions, separator_orientation = "vertical") let(verSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) - translate([-verSepThickness/2, left[1].y, left[1].z]) + translate([-verSepThickness/2, left[1].y, left[1].z]) rotate(left[2]) render_conditional(env_force_render()) //separator wall pattern cutout_pattern( patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = left[0], + canvasSize = left[0], border = wall_pattern_settings[iPatternBorder], customShape = false, circleFn = wall_pattern_settings[iPatternHoleSides], @@ -760,8 +736,8 @@ module gridfinity_removable_label( holeRadius = wall_pattern_settings[iPatternHoleRadius], source="vertical separator wall pattern", patternFs = wall_pattern_settings[iPatternFs]); - } - + } + //subtract dividers from wall patterns translate([env_pitch().x*num_x, 0, -fudgeFactor]) separators( @@ -769,7 +745,7 @@ module gridfinity_removable_label( separator_orientation = "horizontal", override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); } - + //patterns in the outer walls y difference(){ union(){ @@ -799,7 +775,7 @@ module gridfinity_removable_label( if(wallpattern_dividers_enabled == "horizontal" || wallpattern_dividers_enabled == "both") position_separators( - calculatedSeparators = calculated_horizontal_separator_positions, + calculatedSeparators = calculated_horizontal_separator_positions, separator_orientation = "horizontal") let(hozSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) rotate([0,0,-90]) @@ -809,7 +785,7 @@ module gridfinity_removable_label( //separator wall pattern cutout_pattern( patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = front[0], + canvasSize = front[0], border = wall_pattern_settings[iPatternBorder], customShape = false, circleFn = wall_pattern_settings[iPatternHoleSides], @@ -817,7 +793,7 @@ module gridfinity_removable_label( holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], holeHeight = hozSepThickness, center = true, - fill = wall_pattern_settings[iPatternFill], + fill = wall_pattern_settings[iPatternFill], patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], @@ -825,7 +801,7 @@ module gridfinity_removable_label( source = "horizontal separator wall pattern", patternFs = wall_pattern_settings[iPatternFs]); } - + //subtract dividers from outer wall pattern translate([0, 0, -fudgeFactor]) separators( @@ -835,7 +811,7 @@ module gridfinity_removable_label( } } } - + //Subtract setback from wall pattern if(tapered_corner == "rounded" || tapered_corner == "chamfered") { translate([ @@ -846,18 +822,18 @@ module gridfinity_removable_label( union() if(tapered_corner == "rounded"){ roundedCorner( - radius = tapered_corner_size+cutoutclearance_border*2, - length=(num_x)*env_pitch().x, + radius = tapered_corner_size+cutoutclearance_border*2, + length=(num_x)*env_pitch().x, height = tapered_corner_size); } else if(tapered_corner == "chamfered"){ chamferedCorner( - chamferLength = tapered_corner_size, - length=(num_x)*env_pitch().x, + chamferLength = tapered_corner_size, + length=(num_x)*env_pitch().x, height = max((num_x)*env_pitch().x, (num_z)*env_pitch().z), angled_extension =false); } - } + } //Subtract cutout from wall pattern if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) @@ -920,7 +896,7 @@ module gridfinity_removable_label( else translate([0,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),-fudgeFactor]) cube([env_pitch().x*num_x,num_y*env_pitch().x-unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); - + } if((extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled || extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_disabled) && extendable_Settings[iExtendableTabsEnabled]) { refTabHeight = extendable_Settings[iExtendableTabSize].x; @@ -983,7 +959,26 @@ module gridfinity_removable_label( attachment_clip(height=tabHeight, width=tabWidth, thickness=tabThickness, footingThickness=wall_thickness, tabStyle=tabStyle); } } - } + + if (lip_settings[iLipStyle] == "reduced_double") { + label_size=calculateLabelSize(label_settings[iLabelSettings_size]); + labelCornerRadius = label_size[3]; + lipHeight = 3.75; + tz(- lipHeight -labelCornerRadius) + tz(zpoint) + cupLip( + num_x = num_x, + num_y = num_y, + lipStyle = lip_settings[iLipStyle], + wall_thickness = wall_thickness, + lip_notches = false, + lip_top_relief_height = lip_settings[iLipTopReliefHeight], + lip_top_relief_width = lip_settings[iLipTopReliefWidth], + lip_clip_position = lip_settings[iLipClipPosition], + lip_non_blocking = lip_settings[iLipNonBlocking]); + + } + } if(divider_wall_removable_settings[iDividerRemovable_Enabled]) dividers_removable_for_cup( @@ -1129,9 +1124,19 @@ module partitioned_cavity(num_x, num_y, num_z, separators( calculatedSeparators = calculated_horizontal_separator_positions, separator_orientation = "horizontal"); - + + if(label_settings[iLabelSettings_style] != LabelStyle_disabled){ + gridfinity_label( + num_x = num_x, + num_y = num_y, + zpoint = zpoint, + vertical_separator_positions = calculated_vertical_separator_positions, + horizontal_separator_positions = calculated_horizontal_separator_positions, + label_settings=label_settings, + render_option = "labelwithsocket"); + } } -} +} module basic_cavity(num_x, num_y, num_z, fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius,fingerslide_walls,fingerslide_lip_aligned=default_fingerslide_lip_aligned, diff --git a/modules/module_lip.scad b/modules/module_lip.scad index 3eafe3c..2e87b91 100644 --- a/modules/module_lip.scad +++ b/modules/module_lip.scad @@ -113,6 +113,9 @@ module cupLip( coloredLipHeight=min(2,lipHeight); + clr = lip_as_void?sliding_clearance:0; + + if(lipStyle != "none") color(env_colour(color_topcavity, isLip = true)) @@ -162,10 +165,9 @@ module cupLip( $pitch=[ pitch.x*(lip_non_blocking ? ceil(num_x) : num_x), pitch.y*(lip_non_blocking ? ceil(num_y) : num_y), - pitch.z]); + pitch.z], clr=clr); } - - clr = lip_as_void?sliding_clearance:0; + if (lipStyle == "minimum" || lipStyle == "none") { hull() cornercopy(seventeen, num_x, num_y) From d8d2611ea1f28d9d4f57f1dccd15cf0403b06c77 Mon Sep 17 00:00:00 2001 From: Danilo Sanchi Date: Wed, 11 Jun 2025 23:16:29 +0200 Subject: [PATCH 4/4] WIP --- .../module_gridfinity_removable_label.scad | 593 ++---------------- 1 file changed, 44 insertions(+), 549 deletions(-) diff --git a/modules/module_gridfinity_removable_label.scad b/modules/module_gridfinity_removable_label.scad index 48bf6f3..c1d2fcc 100644 --- a/modules/module_gridfinity_removable_label.scad +++ b/modules/module_gridfinity_removable_label.scad @@ -489,515 +489,10 @@ module gridfinity_removable_label( sliding_clearance=sliding_clearance ); } - - if(filled_in == FilledIn_disabled) - union(){ - color(env_colour(color_wallcutout)) - union(){ - cavityFloorRadius = calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness, cupBase_settings[iCupBase_EfficientFloor]); - wallTop = calculateWallTop(num_z, lip_settings[iLipStyle]); - cutoutclearance_divider = gf_cup_corner_radius/2; - cutoutclearance_border = max(wall_thickness, wall_pattern_settings[iPatternBorder]); - - tapered_setback = tapered_setback < 0 ? gf_cup_corner_radius : tapered_setback; - tapered_corner_size = - tapered_corner_size == -2 ? (wallTop - floorHeight)/2 - : tapered_corner_size < 0 ? wallTop - floorHeight //meant for -1, but also catch others - : tapered_corner_size == 0 ? wallTop - floorHeight - cavityFloorRadius - : tapered_corner_size; - - wallcutouts_vertical = calculateWallCutout( - wall_length = num_x, - opposite_wall_distance = num_y, - wallcutout_type = wallcutout_vertical, - wallcutout_position = wallcutout_vertical_position, - wallcutout_width = wallcutout_vertical_width, - wallcutout_angle = wallcutout_vertical_angle, - wallcutout_height = wallcutout_vertical_height, - wallcutout_corner_radius = wallcutout_vertical_corner_radius, - wallcutout_rotation = [0,0,0], - wallcutout_reposition = [0,0,0], //todo: why does this not match below? - wall_thickness = wall_thickness, - cavityFloorRadius = cavityFloorRadius, - wallTop = wallTop, - floorHeight = floorHeight, - pitch = env_pitch().x, - pitch_opposite = env_pitch().y); - wallcutouts_horizontal = calculateWallCutout( - wall_length = num_y, - opposite_wall_distance = num_x, - wallcutout_type = wallcutout_horizontal, - wallcutout_position = wallcutout_horizontal_position, - wallcutout_width = wallcutout_horizontal_width, - wallcutout_angle = wallcutout_horizontal_angle, - wallcutout_height = wallcutout_horizontal_height, - wallcutout_corner_radius = wallcutout_horizontal_corner_radius, - wallcutout_rotation = [0,0,90], - wallcutout_reposition = [num_x*env_pitch().x,0,0], - wall_thickness = wall_thickness, - cavityFloorRadius = cavityFloorRadius, - wallTop = wallTop, - floorHeight = floorHeight, - pitch = env_pitch().y, - pitch_opposite = env_pitch().x); - - wallcutout_locations = [wallcutouts_vertical[0], wallcutouts_vertical[1], wallcutouts_horizontal[0], wallcutouts_horizontal[1]]; - if(tapered_corner == "rounded" || tapered_corner == "chamfered"){ - //tapered_corner_size = tapered_corner_size == 0 ? env_pitch().z*num_z/2 : tapered_corner_size; - translate([0,tapered_setback+gf_tolerance,env_pitch().z*num_z+gf_Lip_Height-gf_tolerance]) - rotate([270,0,0]) - union(){ - if(tapered_corner == "rounded"){ - roundedCorner( - radius = tapered_corner_size, - length=(num_x+1)*env_pitch().x, - height = tapered_corner_size); - } - else if(tapered_corner == "chamfered"){ - chamferedCorner( - chamferLength = tapered_corner_size, - length=(num_x+1)*env_pitch().x, - height = tapered_corner_size); - } - } - } - - if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) - for(wallcutout_location = wallcutout_locations) - if(wallcutout_location[iwalcutout_enabled] == true) - translate(wallcutout_location[iwalcutout_reposition]) - rotate(wallcutout_location[iwalcutout_rotation]) - translate(wallcutout_location[iwalcutout_position]) - WallCutout( - lowerWidth=wallcutout_location[iwalcutout_size].x, - wallAngle=wallcutout_location[iwalcutout_config][iwalcutoutconfig_angle], - height=wallcutout_location[iwalcutout_size].z, - thickness=wallcutout_location[iwalcutout_size].y, - cornerRadius=wallcutout_location[iwalcutout_config][iwalcutoutconfig_cornerradius]); - - //Wall and floor pattern - //Wall pattern in outerwalls - if(wall_pattern_settings[iPatternEnabled] || floor_pattern_settings[iPatternEnabled]){ - difference(){ - union(){ - if(floor_pattern_settings[iPatternEnabled]){ - difference(){ - pad_copy( - num_x = num_x, - num_y = num_y, - half_pitch = cupBase_settings[iCupBase_HalfPitch], - flat_base = cupBase_settings[iCupBase_FlatBase], - minimium_size = cupBase_settings[iCupBase_MinimumPrintablePadSize]) - translate([$pad_copy_size.x*env_pitch().x/2, $pad_copy_size.y*env_pitch().y/2,-fudgeFactor]) - cutout_pattern( - patternStyle = floor_pattern_settings[iPatternStyle], - canvasSize = [$pad_copy_size.x*env_pitch().x, $pad_copy_size.y*env_pitch().y], - circleFn = floor_pattern_settings[iPatternHoleSides], - holeSize = floor_pattern_settings[iPatternHoleSize], - holeSpacing = [floor_pattern_settings[iPatternHoleSpacing], floor_pattern_settings[iPatternHoleSpacing]], - holeHeight = sepFloorHeight + fudgeFactor*6, - center = true, - fill = floor_pattern_settings[iPatternFill], - patternGridChamfer = floor_pattern_settings[iPatternGridChamfer], - patternVoronoiNoise = floor_pattern_settings[iPatternVoronoiNoise], - patternBrickWeight = floor_pattern_settings[iPatternBrickWeight], - border = max(5, floor_pattern_settings[iPatternBorder], - cupBase_settings[iCupBase_EfficientFloor] == EfficientFloor_smooth? 6.5 : 0), - holeRadius = floor_pattern_settings[iPatternHoleRadius], - patternFs = floor_pattern_settings[iPatternFs], - source="floor_pattern"); - - //subtract dividers from floor pattern - translate([0, 0, -fudgeFactor]) - separators( - calculatedSeparators = calculated_vertical_separator_positions, - separator_orientation = "vertical", - override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); - - //subtract dividers from floor pattern - translate([gf_pitch*num_x, 0, -fudgeFactor]) - separators( - calculatedSeparators = calculated_horizontal_separator_positions, - separator_orientation = "horizontal", - override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); - } - } - - - if(wall_pattern_settings[iPatternEnabled]){ - wallpattern_thickness = wall_thickness + fudgeFactor*4; - border = 0; //Believe this to be no longer needed - - wallpatternzpos = wallpatternClearanceHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], - floor_thickness = cupBase_settings[iCupBase_FloorThickness], - num_z=num_z, - filled_in=FilledIn_disabled, - efficient_floor=efficient_floor, - flat_base=cupBase_settings[iCupBase_FlatBase], - floor_inner_radius = cavityFloorRadius, - outer_cup_radius = 1); - - //I feel this should use wallTop, but it seems to work... - heightz = env_pitch().z*(num_z)-wallpatternzpos + ( - //Position specific to each LIP style - lip_settings[iLipStyle] == "reduced" ? 0.6 : - lip_settings[iLipStyle] == "reduced_double" ? 0.6 : - lip_settings[iLipStyle] == "minimum" ? 3 -border*2 - : -gf_lip_height-1.8); - z=wallpatternzpos+heightz/2; - - labelSize = calculateLabelSize(label_settings[iLabelSettings_size]); - //Subtracting the wallpattern_thickness is a bit of a hack, its needed as the label extends in to the wall. - labelSizez = (label_settings[iLabelSettings_style] != LabelStyle_disabled ? labelSize.z-wallpattern_thickness : 0); - - front = [ - //width,height - [num_x*env_pitch().x-gf_cup_corner_radius*2-border, - heightz - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)], - //Position - [(num_x)*env_pitch().x/2, - gf_tolerance/2+wall_thickness/2, - z - (label_settings[iLabelSettings_walls][0] != 0 ? labelSizez : 0)/2], - //rotation - [90,0,0], - //enabled - wallpattern_walls[0]]; - back = [ - //width,height - [num_x*env_pitch().x-gf_cup_corner_radius*2-border, - heightz - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)], - //Position - [(num_x)*env_pitch().x/2, - (num_y)*env_pitch().y-gf_tolerance/2-wall_thickness/2, - z - (label_settings[iLabelSettings_walls][1] != 0 ? labelSizez : 0)/2], - //rotation - [90,0,0], - //enabled - wallpattern_walls[1]]; - left = [ - //width,height - [num_y*env_pitch().y-gf_cup_corner_radius*2-border, - heightz - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)], - //Position - [gf_tolerance/2+wall_thickness/2, - (num_y)*env_pitch().y/2, - z - (label_settings[iLabelSettings_walls][2] != 0 ? labelSizez : 0)/2], - //rotation - [90,0,90], - //enabled - wallpattern_walls[2]]; - right = [ - //width,height - [num_y*env_pitch().y-gf_cup_corner_radius*2-border, - heightz - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)], - //Position - [(num_x)*env_pitch().x-wall_thickness/2-gf_tolerance/2, - (num_y)*env_pitch().y/2, - z - (label_settings[iLabelSettings_walls][3] != 0 ? labelSizez : 0)/2], - //rotation - [90,0,90], - //enabled - wallpattern_walls[3]]; - - echo("gridfinity_cup_wallpattern", wallpattern_thickness=wallpattern_thickness, heightz=heightz, wallpatternzpos=wallpatternzpos, border=border, ylocations=ylocations, xlocations=xlocations); - - ylocations = [left, right]; - xlocations = [front, back]; - - //patterns in the outer walls x - difference(){ - union(){ - for(i = [0:1:len(ylocations)-1]) - if(ylocations[i][3] > 0) - translate(ylocations[i][1]) - rotate(ylocations[i][2]) - render_conditional(env_force_render()) - cutout_pattern( - patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = ylocations[i][0], - border = wall_pattern_settings[iPatternBorder], - customShape = false, - circleFn = wall_pattern_settings[iPatternHoleSides], - holeSize = wall_pattern_settings[iPatternHoleSize], - holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], - holeHeight = wallpattern_thickness, - center=true, - centerz = true, - fill = wall_pattern_settings[iPatternFill], //"none", "space", "crop" - patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], - patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], - patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], - holeRadius = wall_pattern_settings[iPatternHoleRadius], - source = "wall_pattern", - patternFs = wall_pattern_settings[iPatternFs]); - - if(wallpattern_dividers_enabled == "vertical" || wallpattern_dividers_enabled == "both") - position_separators( - calculatedSeparators = calculated_vertical_separator_positions, - separator_orientation = "vertical") - let(verSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) - translate([-verSepThickness/2, left[1].y, left[1].z]) - rotate(left[2]) - render_conditional(env_force_render()) - //separator wall pattern - cutout_pattern( - patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = left[0], - border = wall_pattern_settings[iPatternBorder], - customShape = false, - circleFn = wall_pattern_settings[iPatternHoleSides], - holeSize = wall_pattern_settings[iPatternHoleSize], - holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], - holeHeight = verSepThickness, - center=true, - fill=wall_pattern_settings[iPatternFill], - patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], - patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], - patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], - holeRadius = wall_pattern_settings[iPatternHoleRadius], - source="vertical separator wall pattern", - patternFs = wall_pattern_settings[iPatternFs]); - } - - //subtract dividers from wall patterns - translate([env_pitch().x*num_x, 0, -fudgeFactor]) - separators( - calculatedSeparators = calculated_horizontal_separator_positions, - separator_orientation = "horizontal", - override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); - } - - //patterns in the outer walls y - difference(){ - union(){ - for(i = [0:1:len(xlocations)-1]) - if(xlocations[i][3] > 0) - translate(xlocations[i][1]) - rotate(xlocations[i][2]) - render_conditional(env_force_render()) - cutout_pattern( - patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = xlocations[i][0], - border = wall_pattern_settings[iPatternBorder], - customShape = false, - circleFn = wall_pattern_settings[iPatternHoleSides], - holeSize = wall_pattern_settings[iPatternHoleSize], - holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], - holeHeight = wallpattern_thickness, - center=true, - centerz = true, - fill = wall_pattern_settings[iPatternFill], //"none", "space", "crop" - patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], - patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], - patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], - holeRadius = wall_pattern_settings[iPatternHoleRadius], - source = "wall_pattern", - patternFs = wall_pattern_settings[iPatternFs]); - - if(wallpattern_dividers_enabled == "horizontal" || wallpattern_dividers_enabled == "both") - position_separators( - calculatedSeparators = calculated_horizontal_separator_positions, - separator_orientation = "horizontal") - let(hozSepThickness = $sepCfg[iSeparatorWallThickness]+$sepCfg[iSeparatorBendSeparation]+fudgeFactor*2) - rotate([0,0,-90]) - translate([front[1].x, hozSepThickness/2, front[1].z]) - rotate(front[2]) - render_conditional(env_force_render()) - //separator wall pattern - cutout_pattern( - patternStyle = wall_pattern_settings[iPatternStyle], - canvasSize = front[0], - border = wall_pattern_settings[iPatternBorder], - customShape = false, - circleFn = wall_pattern_settings[iPatternHoleSides], - holeSize = wall_pattern_settings[iPatternHoleSize], - holeSpacing = [wall_pattern_settings[iPatternHoleSpacing],wall_pattern_settings[iPatternHoleSpacing]], - holeHeight = hozSepThickness, - center = true, - fill = wall_pattern_settings[iPatternFill], - patternGridChamfer = wall_pattern_settings[iPatternGridChamfer], - patternVoronoiNoise = wall_pattern_settings[iPatternVoronoiNoise], - patternBrickWeight = wall_pattern_settings[iPatternBrickWeight], - holeRadius = wall_pattern_settings[iPatternHoleRadius], - source = "horizontal separator wall pattern", - patternFs = wall_pattern_settings[iPatternFs]); - } - - //subtract dividers from outer wall pattern - translate([0, 0, -fudgeFactor]) - separators( - calculatedSeparators = calculated_vertical_separator_positions, - separator_orientation = "vertical", - override_wall_thickness = chamber_wall_thickness+cutoutclearance_divider*2); - } - } - } - - //Subtract setback from wall pattern - if(tapered_corner == "rounded" || tapered_corner == "chamfered") { - translate([ - 0, - tapered_setback+cutoutclearance_border, - env_pitch().z*num_z+gf_Lip_Height-gf_tolerance-cutoutclearance_border]) - rotate([270,0,0]) - union() - if(tapered_corner == "rounded"){ - roundedCorner( - radius = tapered_corner_size+cutoutclearance_border*2, - length=(num_x)*env_pitch().x, - height = tapered_corner_size); - } - else if(tapered_corner == "chamfered"){ - chamferedCorner( - chamferLength = tapered_corner_size, - length=(num_x)*env_pitch().x, - height = max((num_x)*env_pitch().x, (num_z)*env_pitch().z), - angled_extension =false); - } - } - - //Subtract cutout from wall pattern - if(wallcutout_vertical != "disabled" || wallcutout_horizontal !="disabled" ) - for(wallcutout_location = wallcutout_locations) - if(wallcutout_location[iwalcutout_enabled] == true) - translate(wallcutout_location[iwalcutout_reposition]) - rotate(wallcutout_location[iwalcutout_rotation]) - translate(wallcutout_location[iwalcutout_position]) - WallCutout( - lowerWidth=wallcutout_location[iwalcutout_size].x+cutoutclearance_border*2, - wallAngle=wallcutout_location[iwalcutout_config][iwalcutoutconfig_angle], - height=wallcutout_location[iwalcutout_size].z+cutoutclearance_border, - thickness=wallcutout_location[iwalcutout_size].y, - cornerRadius=wallcutout_location[iwalcutout_config][iwalcutoutconfig_cornerradius]); - - - - //Subtract magnet caps from floor pattern - } - } - } - } - - // add text to the bottom - _magnet_position = calculateAttachmentPositions(cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter], cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Diameter]); - - if(env_help_enabled("trace")) echo("cup_base_text", _magnet_position=_magnet_position, iCupBase_MagnetSize=cupBase_settings[iCupBase_MagnetSize]); - cup_base_text( - cupBaseTextSettings = cupBaseTextSettings, - wall_thickness = wall_thickness, - magnet_position = _magnet_position.x); - - if(extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled) - color(env_colour(color_wallcutout)) - if(extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front) - tz(-fudgeFactor) - cube([unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),num_y*env_pitch().y,(num_z+1)*env_pitch().z]); - else - translate([unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),0,-fudgeFactor]) - cube([num_x*env_pitch().x-unitPositionTo_mm(extendable_Settings.x[1],num_x,env_pitch().x),num_y*env_pitch().y,(num_z+1)*env_pitch().z]); - - if(extendable_Settings.y[0]!=BinExtensionEnabled_disabled) - color(env_colour(color_wallcutout)) - if(extendable_Settings.y[0]==BinExtensionEnabled_front) - tz(-fudgeFactor) - cube([env_pitch().x*num_x,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); - else - translate([0,unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),-fudgeFactor]) - cube([env_pitch().x*num_x,num_y*env_pitch().x-unitPositionTo_mm(extendable_Settings.y[1],num_y,env_pitch().y),(num_z+1)*env_pitch().z]); - - - if((extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_disabled || extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_disabled) && extendable_Settings[iExtendableTabsEnabled]) { - refTabHeight = extendable_Settings[iExtendableTabSize].x; - tabThickness = extendable_Settings[iExtendableTabSize].z == 0 ? 1.4 : extendable_Settings[iExtendableTabSize].z;//1.4; //This should be calculated - tabWidth = extendable_Settings[iExtendableTabSize].y; - tabStyle = extendable_Settings[iExtendableTabSize][iExtendableTabSizeStyle]; - - floorHeight = calculateFloorHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], - floor_thickness=floor_thickness, - filled_in="disabled", - efficient_floor=cupBase_settings[iCupBase_EfficientFloor], - flat_base=cupBase_settings[iCupBase_FlatBase]) + calculateCavityFloorRadius(cupBase_settings[iCupBase_CavityFloorRadius], wall_thickness,efficient_floor)-tabThickness; - - //todo need to correct this - lipheight = lip_settings[iLipStyle] == "none" ? tabThickness - : lip_settings[iLipStyle] == "reduced" ? gf_lip_upper_taper_height+tabThickness - : lip_settings[iLipStyle] == "reduced_double" ? gf_lip_upper_taper_height+tabThickness - //Add tabThickness, as the taper can bleed in to the lip - : gf_lip_upper_taper_height + gf_lip_lower_taper_height-tabThickness; - ceilingHeight = env_pitch().z*num_z-headroom-lipheight; - - //tabWorkingheight = (num_z-1)*env_pitch().z-gf_Lip_Height; - tabWorkingheight = ceilingHeight-floorHeight; - - tabsCount = max(floor(tabWorkingheight/refTabHeight),1); - tabHeight = tabWorkingheight/tabsCount; - if(env_help_enabled("debug")) echo("tabs", binHeight =num_z, tabHeight=tabHeight, floorHeight=floorHeight, cavity_floor_radius=cupBase_settings[iCupBase_CavityFloorRadius], tabThickness=tabThickness); - cutx = extendable_Settings.x[iExtendablePositionmm]; - cuty = extendable_Settings.y[iExtendablePositionmm]; - even = (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_back) ? - [[0,180,90], [cutx,num_y*env_pitch().y-wall_thickness-gf_tolerance/2,floorHeight], "darkgreen"] - : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_front) ? - [[0,180,180], [wall_thickness+gf_tolerance/2,cuty,floorHeight], "green"] - : (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? - [[0,180,270], [cutx,wall_thickness+gf_tolerance/2,floorHeight], "lime"] - : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? - [[0,180,0], [num_x*env_pitch().x-wall_thickness-gf_tolerance/2,cuty,floorHeight], "aqua"] - : [[0,0,0],[0,0,0], extendable_Settings, "grey"]; - odd = (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? - [[0,0,90], [cutx,wall_thickness+gf_tolerance/2,floorHeight], "pink"] - : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_front && extendable_Settings.x[iExtendableEnabled]!=BinExtensionEnabled_back) ? - [[0,0,180], [num_x*env_pitch().x-wall_thickness-gf_tolerance/2,cuty,floorHeight], "red"] - : (extendable_Settings.x[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_back) ? - [[0,0,270], [cutx,num_y*env_pitch().y-wall_thickness-gf_tolerance/2,floorHeight], "orange"] - : (extendable_Settings.y[iExtendableEnabled]==BinExtensionEnabled_back && extendable_Settings.y[iExtendableEnabled]!=BinExtensionEnabled_front) ? - [[0,0,0], [wall_thickness+gf_tolerance/2,cuty,floorHeight], "yellow"] - : [[0,0,0],[0,0,0], extendable_Settings, "grey"]; - - for(i=[0:1:tabsCount-1]) - { - isOdd = i % 2; - tabPos = isOdd == 0 ? even : odd; - if(env_help_enabled("trace")) echo("tabs", i=i, isOdd=isOdd, tabPos=tabPos); - tz((i+0.5)*tabHeight) - translate(tabPos[1]) - rotate(tabPos[0]) - attachment_clip(height=tabHeight, width=tabWidth, thickness=tabThickness, footingThickness=wall_thickness, tabStyle=tabStyle); - } - } } - if(divider_wall_removable_settings[iDividerRemovable_Enabled]) - dividers_removable_for_cup( - num_x = num_x, - num_y = num_y, - zpoint = zpoint, - divider_settings = divider_wall_removable_settings, - wall_thickness = wall_thickness, - floorHeight = floorHeight); - if(env_help_enabled("info")) - //translate(gridfinityRenderPosition(position,num_x,num_y)) - ShowCalipers( - env_cutx(), - env_cuty(), - size=[num_x,num_y,num_z], - lip_settings[iLipStyle], - cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], - floor_thickness = cupBase_settings[iCupBase_FloorThickness], - filled_in, - wall_thickness, - efficient_floor = cupBase_settings[iCupBase_EfficientFloor], - flat_base = cupBase_settings[iCupBase_FlatBase]); - - HelpTxt("gridfinity_cup",[ + HelpTxt("gridfinity_removable_label",[ "num_x",num_x ,"num_y",num_y ,"num_z",num_z @@ -1049,7 +544,7 @@ module gridfinity_removable_label( -module partitioned_cavity(num_x, num_y, num_z, +module partitioned_cavity(num_x, num_y, num_z, label_settings=[], cupBase_settings=[], fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius, @@ -1059,8 +554,8 @@ module partitioned_cavity(num_x, num_y, num_z, chamber_wall_thickness=default_chamber_wall_thickness, chamber_wall_headroom=default_chamber_wall_headroom, calculated_vertical_separator_positions=calculated_vertical_separator_positions, calculated_horizontal_separator_positions=calculated_horizontal_separator_positions, - lip_settings=[], - headroom=default_headroom, + lip_settings=[], + headroom=default_headroom, sliding_lid_settings=[], divider_wall_removable_settings=[]) { @@ -1069,32 +564,32 @@ module partitioned_cavity(num_x, num_y, num_z, cavity_floor_radius=cupBase_settings[iCupBase_CavityFloorRadius]; spacer=cupBase_settings[iCupBase_Spacer]; box_corner_attachments_only=cupBase_settings[iCupBase_CornerAttachmentsOnly]; - efficient_floor=cupBase_settings[iCupBase_EfficientFloor]; - half_pitch=cupBase_settings[iCupBase_HalfPitch]; + efficient_floor=cupBase_settings[iCupBase_EfficientFloor]; + half_pitch=cupBase_settings[iCupBase_HalfPitch]; magnet_diameter=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter]; screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]; magnet_easy_release=cupBase_settings[iCupBase_MagnetEasyRelease]; - floor_thickness=cupBase_settings[iCupBase_FloorThickness]; + floor_thickness=cupBase_settings[iCupBase_FloorThickness]; zpoint = env_pitch().z*num_z-headroom; floorHeight = calculateFloorHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], floor_thickness=cupBase_settings[iCupBase_FloorThickness], num_z=num_z, - filled_in="disabled", - efficient_floor=efficient_floor, + filled_in="disabled", + efficient_floor=efficient_floor, flat_base=cupBase_settings[iCupBase_FlatBase]); difference() { color(env_colour(color_cupcavity)) union(){ basic_cavity(num_x, num_y, num_z, - fingerslide=fingerslide, fingerslide_walls=fingerslide_walls, fingerslide_lip_aligned=fingerslide_lip_aligned, fingerslide_radius=fingerslide_radius, + fingerslide=fingerslide, fingerslide_walls=fingerslide_walls, fingerslide_lip_aligned=fingerslide_lip_aligned, fingerslide_radius=fingerslide_radius, cupBase_settings=cupBase_settings, wall_thickness=wall_thickness, - lip_settings=lip_settings, - sliding_lid_settings=sliding_lid_settings, + lip_settings=lip_settings, + sliding_lid_settings=sliding_lid_settings, divider_wall_removable_settings=divider_wall_removable_settings, headroom=headroom); } @@ -1114,13 +609,13 @@ module partitioned_cavity(num_x, num_y, num_z, color(env_colour(color_divider)) translate([env_pitch().x*num_x, 0, sepFloorHeight-fudgeFactor]) separators( - calculatedSeparators = calculated_horizontal_separator_positions, + calculatedSeparators = calculated_horizontal_separator_positions, separator_orientation = "horizontal"); } } -module basic_cavity(num_x, num_y, num_z, +module basic_cavity(num_x, num_y, num_z, fingerslide=default_fingerslide, fingerslide_radius=default_fingerslide_radius,fingerslide_walls,fingerslide_lip_aligned=default_fingerslide_lip_aligned, wall_thickness=default_wall_thickness, lip_settings = [], @@ -1130,7 +625,7 @@ module basic_cavity(num_x, num_y, num_z, headroom = 0) { //Legacy variables - floor_thickness=cupBase_settings[iCupBase_FloorThickness]; + floor_thickness=cupBase_settings[iCupBase_FloorThickness]; magnet_diameter=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Diameter]; screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]; magnet_easy_release=cupBase_settings[iCupBase_MagnetEasyRelease]; @@ -1144,22 +639,22 @@ module basic_cavity(num_x, num_y, num_z, AssertSlidingLidSettings(sliding_lid_settings); seventeen = [env_pitch().x/2-4,env_pitch().y/2-4]; - - reducedlipstyle = + + reducedlipstyle = // replace "reduced" with "none" if z-height is less than 1.2 - (num_z < 1.2) ? "none" + (num_z < 1.2) ? "none" // replace with "reduced" if z-height is less than 1.8 - : (num_z < 1.8) ? "reduced" + : (num_z < 1.8) ? "reduced" : lip_settings[iLipStyle]; filledInZ = env_pitch().z*num_z; zpoint = filledInZ-headroom; floorht = min(filledInZ, calculateFloorHeight( - magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], - screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], - center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], - floor_thickness=cupBase_settings[iCupBase_FloorThickness], + magnet_depth=cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + screw_depth=cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height], + center_magnet=cupBase_settings[iCupBase_CenterMagnetSize][iCylinderDimension_Height], + floor_thickness=cupBase_settings[iCupBase_FloorThickness], num_z=num_z, filled_in=FilledIn_disabled, efficient_floor=cupBase_settings[iCupBase_EfficientFloor], @@ -1202,24 +697,24 @@ module basic_cavity(num_x, num_y, num_z, difference() { union() { if (reducedlipstyle == "minimum" || reducedlipstyle == "none") { - } + } else if (reducedlipstyle == "reduced") { - } + } else if (reducedlipstyle == "reduced_double") { } else { // normal lowerTaperZ = filledInZ-gf_lip_height-lipSupportThickness; if(lowerTaperZ <= floorht){ hull() cornercopy(seventeen, num_x, num_y) - tz(floorht) + tz(floorht) cylinder(r=innerLipRadius, h=filledInZ-floorht+fudgeFactor*4); // lip } else { hull() cornercopy(seventeen, num_x, num_y) - tz(filledInZ-gf_lip_height-fudgeFactor) + tz(filledInZ-gf_lip_height-fudgeFactor) cylinder(r=innerLipRadius, h=gf_lip_height+fudgeFactor*4); // lip hull() cornercopy(seventeen, num_x, num_y) - tz(filledInZ-gf_lip_height-lipSupportThickness-fudgeFactor) + tz(filledInZ-gf_lip_height-lipSupportThickness-fudgeFactor) cylinder( r1=innerWallRadius, r2=innerLipRadius, h=q+fudgeFactor); // ... to top of thin wall ... @@ -1239,7 +734,7 @@ module basic_cavity(num_x, num_y, num_z, if(sliding_lid_settings[iSlidingLidEnabled]) SlidingLidSupportMaterial( - num_x = num_x, + num_x = num_x, num_y = num_y, wall_thickness = wall_thickness, sliding_lid_settings = sliding_lid_settings, @@ -1248,7 +743,7 @@ module basic_cavity(num_x, num_y, num_z, // fingerslide inside bottom of cutout if(fingerslide != "none"){ FingerSlide( - num_x = num_x, + num_x = num_x, num_y = num_y, num_z = num_z, fingerslide_walls=fingerslide_walls, @@ -1263,7 +758,7 @@ module basic_cavity(num_x, num_y, num_z, if(divider_wall_removable_settings[iDividerRemovable_Enabled]) removable_dividers_support( - num_x = num_x, + num_x = num_x, num_y = num_y, zpoint = zpoint, divider_settings = divider_wall_removable_settings, @@ -1273,7 +768,7 @@ module basic_cavity(num_x, num_y, num_z, if (cupBase_settings[iCupBase_EfficientFloor] != "off") { magnetPosition = calculateAttachmentPositions(magnet_diameter, cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Diameter]); magnetCoverHeight = max( - cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], + cupBase_settings[iCupBase_MagnetSize][iCylinderDimension_Height], cupBase_settings[iCupBase_ScrewSize][iCylinderDimension_Height]); hasCornerAttachments = magnet_diameter > 0 || screw_depth > 0; efficientFloorGridHeight = max(magnetCoverHeight,gfBaseHeight())+floor_thickness; @@ -1308,7 +803,7 @@ module basic_cavity(num_x, num_y, num_z, if(divider_wall_removable_settings[iDividerRemovable_Enabled]) removable_dividers_slots( - num_x = num_x, + num_x = num_x, num_y = num_y, zpoint = zpoint, divider_settings = divider_wall_removable_settings, @@ -1362,9 +857,9 @@ module basic_cavity(num_x, num_y, num_z, } } -///Creates the finger slide that will be subtracted from the cavity +///Creates the finger slide that will be subtracted from the cavity module FingerSlide( - num_x = num_x, + num_x = num_x, num_y = num_y, num_z = num_z, fingerslide_walls=fingerslide_walls, @@ -1434,20 +929,20 @@ module FingerSlide( num_z*env_pitch().z]; locations = [front, back, left, right]; - function get_fingerslide_radius(wall, cup_size, cup_height, fingerslide_radius) = + function get_fingerslide_radius(wall, cup_size, cup_height, fingerslide_radius) = let(radius_start = wall == 1 ? fingerslide_radius : wall, calculated_radius = radius_start < 0 ? cup_size/abs(radius_start) : radius_start, limited_radius = min(calculated_radius,cup_height,cup_size/2)) echo("get_fingerslide_radius", is_ratio=(wall < 0),result=limited_radius, wall=wall, cup_size=cup_size, cup_height=cup_height, fingerslide_radius=fingerslide_radius) limited_radius; - + for(i = [0:1:len(locations)-1]) union() if(fingerslide_walls[i] != 0) //patterns in the outer walls translate(locations[i][1]) - rotate(locations[i][2]) - translate([0, + rotate(locations[i][2]) + translate([0, lipAligned && reducedlipstyle =="normal" ? -seventeen.x-1.15+env_pitch().x/2 : lipAligned && reducedlipstyle == "reduced" ? -seventeen.x-1.15+env_pitch().x/2-gf_lip_lower_taper_height : lipAligned && reducedlipstyle == "reduced_double" ? -seventeen.x-1.15+env_pitch().x/2-gf_lip_lower_taper_height @@ -1456,13 +951,13 @@ module FingerSlide( union(){ if(fingerslide == "rounded"){ roundedCorner( - radius = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), - length=locations[i][0], + radius = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), + length=locations[i][0], height = env_pitch().z*num_z-floorht+fudgeFactor); } else if(fingerslide == "chamfered"){ chamferedCorner( - chamferLength = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), + chamferLength = get_fingerslide_radius(fingerslide_walls[i], locations[i][3], locations[i][4], fingerslide_radius), length=locations[i][0], height = env_pitch().z*num_z-floorht+fudgeFactor); }