From d67673241e816674783f58265e10bfa336bda066 Mon Sep 17 00:00:00 2001 From: maride Date: Thu, 21 Dec 2017 15:17:43 +0100 Subject: [PATCH] Add helper function --- Matekiste_Laser_Stencil.scad | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Matekiste_Laser_Stencil.scad b/Matekiste_Laser_Stencil.scad index 676a27b..09beb66 100644 --- a/Matekiste_Laser_Stencil.scad +++ b/Matekiste_Laser_Stencil.scad @@ -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); + } } \ No newline at end of file