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(...)
|
||||
*/
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
__round_square(width, height, radius);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,4 +93,24 @@ module __radius_cutout(radius) {
|
||||
square([radius, radius], center=true);
|
||||
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