Merge branch 'martinbudden-dogbone_xy'
This commit is contained in:
commit
ec891c8013
|
@ -5511,8 +5511,10 @@ a square cornered part fits in the hole then circles are placed in the corners m
|
||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| ```dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners |
|
| ```dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true, x_offset, y_offset)``` | Rectangle with cylinders at the corners |
|
||||||
| ```dogbone_square(size, r = cnc_bit_r, center = true)``` | Square with circles at the corners |
|
| ```dogbone_rectangle_x(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners, offset in the x direction |
|
||||||
|
| ```dogbone_rectangle_y(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners, offset in the y direction |
|
||||||
|
| ```dogbone_square(size, r = cnc_bit_r, center = true, x_offset, y_offset)``` | Square with circles at the corners, with optional offsets |
|
||||||
|
|
||||||
![dogbones](tests/png/dogbones.png)
|
![dogbones](tests/png/dogbones.png)
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 55 KiB |
|
@ -23,24 +23,36 @@
|
||||||
//
|
//
|
||||||
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_square(size, r = cnc_bit_r, center = true, x_offset, y_offset) //! Square with circles at the corners, with optional offsets
|
||||||
{
|
{
|
||||||
|
x_offset = is_undef(x_offset) ? r / sqrt(2) : x_offset;
|
||||||
|
y_offset = is_undef(y_offset) ? r / sqrt(2) : y_offset;
|
||||||
|
|
||||||
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 - x_offset), y * (size.y / 2 - y_offset)])
|
||||||
drill(r, 0);
|
drill(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, x_offset, y_offset) //! 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, x_offset, y_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
dogbone_rectangle(size = size, r = r, center = center, x_offset = 0, y_offset = r);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
dogbone_rectangle(size = size, r = r, center = center, x_offset = r, y_offset = 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue