67 lines
2.2 KiB
OpenSCAD
67 lines
2.2 KiB
OpenSCAD
module roundedBox(
|
|
length = 60,
|
|
width = 35,
|
|
height = 50,
|
|
corner_rd = 10,
|
|
corner_ld = 10,
|
|
corner_ru = 10,
|
|
corner_lu = 10
|
|
) {
|
|
|
|
linear_extrude(height) {
|
|
|
|
corneroff_d_big = (corner_ld >= corner_rd) ? corner_ld : corner_rd;
|
|
corneroff_d_small = (corner_ld >= corner_rd) ? corner_rd : corner_ld;
|
|
|
|
corneroff_l_big = (corner_lu >= corner_ld) ? corner_lu : corner_ld;
|
|
corneroff_l_small = (corner_lu >= corner_ld) ? corner_ld : corner_lu;
|
|
|
|
corneroff_u_big = (corner_lu >= corner_ru) ? corner_lu : corner_ru;
|
|
corneroff_u_small = (corner_lu >= corner_ru) ? corner_ru : corner_lu;
|
|
|
|
corneroff_r_big = (corner_ru >= corner_rd) ? corner_ru : corner_rd;
|
|
corneroff_r_small = (corner_ru >= corner_rd) ? corner_rd : corner_ru;
|
|
// corner lu
|
|
translate([corner_lu, width - corner_lu, 0])
|
|
circle(corner_lu);
|
|
// corner ru
|
|
translate([length - corner_ru, width - corner_ru, 0])
|
|
circle(corner_ru);
|
|
// corner ld
|
|
translate([corner_ld, corner_ld, 0])
|
|
circle(corner_ld);
|
|
// corner rd
|
|
translate([length - corner_rd, corner_rd, 0])
|
|
circle(corner_rd);
|
|
// main square
|
|
translate([0, corneroff_d_big, 0])
|
|
square([
|
|
length - corneroff_r_big,
|
|
width - corneroff_d_big - corneroff_u_big
|
|
]);
|
|
// right support square
|
|
translate([length - corneroff_r_big, corner_rd, 0])
|
|
square([
|
|
corneroff_r_big,
|
|
width - corner_ru - corner_rd
|
|
]);
|
|
// lower support square
|
|
translate([corner_ld, 0, 0])
|
|
square([
|
|
length - corner_rd - corner_ld,
|
|
corneroff_d_big
|
|
]);
|
|
// upper support square
|
|
translate([corner_lu, width - corneroff_u_big, 0])
|
|
square([
|
|
length - corner_ru - corner_lu,
|
|
corneroff_u_big
|
|
]);
|
|
// left support square
|
|
translate([0, corner_ld, 0])
|
|
square([
|
|
corneroff_l_big,
|
|
width - corner_lu - corner_ld
|
|
]);
|
|
}
|
|
} |