Add helper function
This commit is contained in:
parent
07b2586a7e
commit
d67673241e
@ -25,21 +25,9 @@ module base_plane(width, height, hole_size, hole_spacing_x, hole_spacing_y) {
|
|||||||
* base_plane(...) with rounded edges, using helper function __radius_cutout(...)
|
* base_plane(...) with rounded edges, using helper function __radius_cutout(...)
|
||||||
*/
|
*/
|
||||||
module round_base_plane(width, height, hole_size, hole_spacing_x, hole_spacing_y, radius) {
|
module round_base_plane(width, height, hole_size, hole_spacing_x, hole_spacing_y, radius) {
|
||||||
difference() {
|
intersection() {
|
||||||
base_plane(width, height, hole_size, hole_spacing_x, hole_spacing_y);
|
base_plane(width, height, hole_size, hole_spacing_x, hole_spacing_y);
|
||||||
|
__round_square(width, height, radius);
|
||||||
translate([width-radius, height-radius])
|
|
||||||
__radius_cutout(radius);
|
|
||||||
translate([radius, height-radius])
|
|
||||||
rotate([0, 0, 90])
|
|
||||||
__radius_cutout(radius);
|
|
||||||
translate([radius, radius])
|
|
||||||
rotate([0, 0, 180])
|
|
||||||
__radius_cutout(radius);
|
|
||||||
translate([width-radius, radius])
|
|
||||||
rotate([0, 0, 270])
|
|
||||||
__radius_cutout(radius);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,3 +94,23 @@ module __radius_cutout(radius) {
|
|||||||
circle(radius, $fn=RESOLUTION);
|
circle(radius, $fn=RESOLUTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function for square with round edges
|
||||||
|
*/
|
||||||
|
module __round_square(width, height, radius) {
|
||||||
|
difference() {
|
||||||
|
square([width, height]);
|
||||||
|
translate([width-radius, height-radius])
|
||||||
|
__radius_cutout(radius);
|
||||||
|
translate([radius, height-radius])
|
||||||
|
rotate([0, 0, 90])
|
||||||
|
__radius_cutout(radius);
|
||||||
|
translate([radius, radius])
|
||||||
|
rotate([0, 0, 180])
|
||||||
|
__radius_cutout(radius);
|
||||||
|
translate([width-radius, radius])
|
||||||
|
rotate([0, 0, 270])
|
||||||
|
__radius_cutout(radius);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user