diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index b06496a..bd3885c 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -321,7 +321,7 @@ module baseplate_lip(height=0, width=l_grid, length=l_grid) { additional_height = height + BASEPLATE_CLEARANCE_HEIGHT; - sweep_rounded(width-2*BASEPLATE_OUTSIDE_RADIUS, length-2*BASEPLATE_OUTSIDE_RADIUS) + sweep_rounded([width-2*BASEPLATE_OUTSIDE_RADIUS, length-2*BASEPLATE_OUTSIDE_RADIUS]) translate([translation_x, additional_height, 0]) polygon(concat(BASEPLATE_LIP, [ [0, -additional_height], diff --git a/src/core/gridfinity-rebuilt-utility.scad b/src/core/gridfinity-rebuilt-utility.scad index 9084fb3..0f0c38a 100644 --- a/src/core/gridfinity-rebuilt-utility.scad +++ b/src/core/gridfinity-rebuilt-utility.scad @@ -324,7 +324,7 @@ module block_base(hole_options, off=0, size=[BASE_SIZE, BASE_SIZE], thumbscrew=f render(convexity = 2) difference() { union() { - sweep_rounded(base_profile_size.x, base_profile_size.y) + sweep_rounded(base_profile_size) translate([translation_x, 0, 0]) polygon(BASE_PROFILE); @@ -448,7 +448,7 @@ module profile_wall2(height_mm) { module block_wall(gx, gy, l) { translate([0,0,h_base]) - sweep_rounded(gx*l-2*r_base-0.5-0.001, gy*l-2*r_base-0.5-0.001) + sweep_rounded([gx*l-2*r_base-0.5-0.001, gy*l-2*r_base-0.5-0.001]) children(); } diff --git a/src/helpers/generic-helpers.scad b/src/helpers/generic-helpers.scad index d8e3a25..3c1a96e 100644 --- a/src/helpers/generic-helpers.scad +++ b/src/helpers/generic-helpers.scad @@ -175,11 +175,21 @@ function affine_scale(vector) = [ /** * @brief Create a rectangle with rounded corners by sweeping a 2d object along a path. - * Centered on origin. + * @Details Centered on origin. + * Result is on the X,Y plane. + * Expects children to be a 2D shape in Quardrant 1 of the X,Y plane. + * @param size Dimensions of the resulting object. + * Either a single number or [width, length] */ -module sweep_rounded(width=10, length=10) { - assert(width > 0 && length > 0); +module sweep_rounded(size) { + assert((is_num(size) && size > 0) || ( + is_list(size) && len(size) == 2 && + is_num(size.x) && size.x > 0 && is_num(size.y) && size.y > 0 + ) + ); + width = is_num(size) ? size : size.x; + length = is_num(size) ? size : size.y; half_width = width/2; half_length = length/2; path_points = [