Added dogbones with circles offset in x and y directions.

This commit is contained in:
Martin Budden 2020-12-21 23:28:39 +00:00
parent 76ea28e88e
commit 0a00f244e4
2 changed files with 35 additions and 3 deletions

View File

@ -26,6 +26,12 @@ module dogbones() {
#translate([15, 0]) #translate([15, 0])
dogbone_rectangle([10, 20, 5], center = false); dogbone_rectangle([10, 20, 5], center = false);
#translate([30, 0])
dogbone_rectangle_x([10, 20, 5], center = false);
#translate([45, 0])
dogbone_rectangle_y([10, 20, 5], center = false);
sq = 3; sq = 3;
translate([-5 + sq / 2 + eps, -10 + sq / 2 + eps]) translate([-5 + sq / 2 + eps, -10 + sq / 2 + eps])
%cube([sq, sq, 1], center = true); %cube([sq, sq, 1], center = true);

View File

@ -23,24 +23,50 @@
// //
include <../utils/core/core.scad> include <../utils/core/core.scad>
module dogbone_square(size, r = cnc_bit_r, center = true) //! Square with circles at the corners module dogbone(size, r, center, offset_x, offset_y) //! Dogbone utility module
{ {
union() { union() {
square(size, center = center); square(size, center = center);
if(r > 0) { if(r > 0) {
origin = center ? [0, 0] : size / 2; origin = center ? [0, 0] : size / 2;
offset = r / sqrt(2);
for(x = [-1, 1], y = [-1, 1]) for(x = [-1, 1], y = [-1, 1])
translate(origin + [x * (size.x / 2 - offset), y * (size.y / 2 - offset)]) translate(origin + [x * (size.x / 2 - offset_x), y * (size.y / 2 - offset_y)])
drill(r, 0); drill(r, 0);
} }
} }
} }
module dogbone_square(size, r = cnc_bit_r, center = true) //! Square with circles at the corners
{
dogbone([size.x, size.y], r, center, r / sqrt(2), r / sqrt(2));
}
module dogbone_square_x(size, r = cnc_bit_r, center = true) //! Square with circles at the corners, offset in the x direction
{
dogbone([size.x, size.y], r, center, 0, r);
}
module dogbone_square_y(size, r = cnc_bit_r, center = true) //! Square with circles at the corners, offset in the y direction
{
dogbone([size.x, size.y], r, center, r, 0);
}
module dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners module dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners
{ {
extrude_if(h = size.z, center = center) extrude_if(h = size.z, center = center)
dogbone_square([size.x, size.y], r, xy_center); dogbone_square([size.x, size.y], r, xy_center);
} }
module dogbone_rectangle_x(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners, offset in the x direction
{
extrude_if(h = size.z, center = center)
dogbone_square_x([size.x, size.y], r, xy_center);
}
module dogbone_rectangle_y(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners, offset in the y direction
{
extrude_if(h = size.z, center = center)
dogbone_square_y([size.x, size.y], r, xy_center);
}