From 60f7c8e24fd450840ab3694a8936c2d65c2253a2 Mon Sep 17 00:00:00 2001 From: Jacob Kiers Date: Sat, 8 Jan 2022 01:28:55 +0100 Subject: [PATCH] Add a door module Signed-off-by: Jacob Kiers --- house/door.scad | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ house/house.scad | 7 +++++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 house/door.scad diff --git a/house/door.scad b/house/door.scad new file mode 100644 index 0000000..f4e7bc5 --- /dev/null +++ b/house/door.scad @@ -0,0 +1,58 @@ +// Builds a door with default measurements + +// Usage: door(open_rotation = 45) +// The open_rotation parameter rotates the door in the z-plane. + +module door(open_rotation = 45) { + 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; + + door_outline(); + //door_list_receded(); + door_door(); + + module door_outline() + { + difference() { + cube([ + door_width + 2 * door_to_frame + 2 * (frame_outer_list_width + frame_outer_receded_width), + door_depth + 2 * frame_depth, + door_to_ground + door_height + door_to_frame + frame_depth + ]); + 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() + { + translate([ + frame_depth + door_to_frame, + frame_depth, + door_to_ground + ]) + rotate([0, 0, open_rotation]) + cube([ + door_width, + door_depth, + door_height + ]); + } +} \ No newline at end of file diff --git a/house/house.scad b/house/house.scad index 73ca32c..c507625 100644 --- a/house/house.scad +++ b/house/house.scad @@ -1,3 +1,6 @@ +// Includes +include + // All measurements are in millimeters. // Dimensions @@ -153,4 +156,6 @@ module rectangle(start = [0, 0, 0], dimensions = [0, 0, 0], color) cube([dx, dy, dz]); translate([1,1,1]) cube([dx-2, dy-2, dz]); } -} \ No newline at end of file +} + +color("white") door();