2022-01-08 00:28:55 +00:00
|
|
|
// Builds a door with default measurements
|
|
|
|
|
|
|
|
// Usage: door(open_rotation = 45)
|
|
|
|
// The open_rotation parameter rotates the door in the z-plane.
|
|
|
|
|
2022-01-08 21:16:56 +00:00
|
|
|
DOOR_LEFT = "left";
|
|
|
|
DOOR_RIGHT = "right";
|
|
|
|
|
|
|
|
module door(open_rotation = 45, door_position = DOOR_LEFT) {
|
2022-01-08 00:28:55 +00:00
|
|
|
frame_depth = 65;
|
|
|
|
frame_outer_list_width = 45;
|
|
|
|
frame_outer_receded_width = 15;
|
|
|
|
|
|
|
|
door_width = 775;
|
|
|
|
door_depth = 50;
|
|
|
|
door_height = 2100;
|
|
|
|
door_to_ground = 15;
|
|
|
|
door_to_frame = 3;
|
|
|
|
|
2022-01-08 21:16:56 +00:00
|
|
|
if (door_position == DOOR_LEFT) {
|
|
|
|
door_outline();
|
|
|
|
//door_list_receded();
|
|
|
|
door_door();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (door_position == DOOR_RIGHT) {
|
|
|
|
translate([full_width(), full_depth(), 0])
|
|
|
|
rotate([0, 0, 180]) {
|
|
|
|
door_outline();
|
|
|
|
//door_list_receded();
|
|
|
|
door_door();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 00:28:55 +00:00
|
|
|
module door_outline()
|
|
|
|
{
|
|
|
|
difference() {
|
|
|
|
cube([
|
2022-01-08 21:16:56 +00:00
|
|
|
full_width(),
|
|
|
|
full_depth(),
|
|
|
|
full_height()
|
2022-01-08 00:28:55 +00:00
|
|
|
]);
|
|
|
|
translate([frame_outer_list_width, 0, 0]) door_list_receded();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module door_list_receded()
|
|
|
|
{
|
|
|
|
difference() {
|
|
|
|
color("yellow") cube([
|
|
|
|
door_width + 2 * door_to_frame + 2 * frame_outer_receded_width,
|
|
|
|
door_depth + 2 * frame_depth,
|
|
|
|
door_to_ground + door_height + door_to_frame
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module door_door()
|
|
|
|
{
|
2022-01-08 21:16:56 +00:00
|
|
|
if (door_position == DOOR_LEFT) {
|
|
|
|
translate([
|
|
|
|
frame_depth + door_to_frame,
|
|
|
|
frame_depth,
|
|
|
|
door_to_ground
|
|
|
|
])
|
|
|
|
rotate([0, 0, open_rotation])
|
|
|
|
cube([
|
|
|
|
door_width,
|
|
|
|
door_depth,
|
|
|
|
door_height
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
if (door_position == DOOR_RIGHT) {
|
|
|
|
translate([
|
|
|
|
frame_depth + door_to_frame,
|
|
|
|
frame_depth,
|
|
|
|
door_to_ground
|
|
|
|
])
|
|
|
|
rotate([0, 0, open_rotation])
|
|
|
|
cube([
|
|
|
|
door_width,
|
|
|
|
door_depth,
|
|
|
|
door_height
|
|
|
|
]);
|
|
|
|
}
|
2022-01-08 00:28:55 +00:00
|
|
|
}
|
2022-01-08 21:16:56 +00:00
|
|
|
|
|
|
|
function full_width() =
|
|
|
|
door_width +
|
|
|
|
2 * door_to_frame +
|
|
|
|
2 * (frame_outer_list_width + frame_outer_receded_width);
|
|
|
|
|
|
|
|
function full_depth() =
|
|
|
|
door_depth +
|
|
|
|
2 * frame_depth;
|
|
|
|
|
|
|
|
function full_height() =
|
|
|
|
door_to_ground +
|
|
|
|
door_height +
|
|
|
|
door_to_frame +
|
|
|
|
frame_depth;
|
2022-01-08 00:28:55 +00:00
|
|
|
}
|