diff --git a/house/door.scad b/house/door.scad index f4e7bc5..2f2e526 100644 --- a/house/door.scad +++ b/house/door.scad @@ -3,7 +3,10 @@ // Usage: door(open_rotation = 45) // The open_rotation parameter rotates the door in the z-plane. -module door(open_rotation = 45) { +DOOR_LEFT = "left"; +DOOR_RIGHT = "right"; + +module door(open_rotation = 45, door_position = DOOR_LEFT) { frame_depth = 65; frame_outer_list_width = 45; frame_outer_receded_width = 15; @@ -14,17 +17,28 @@ module door(open_rotation = 45) { door_to_ground = 15; door_to_frame = 3; - door_outline(); - //door_list_receded(); - door_door(); - + 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(); + } + } + 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 + full_width(), + full_depth(), + full_height() ]); translate([frame_outer_list_width, 0, 0]) door_list_receded(); } @@ -43,16 +57,46 @@ module door(open_rotation = 45) { 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 - ]); + 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 + ]); + } } + + 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; } \ No newline at end of file diff --git a/house/door_test.scad b/house/door_test.scad new file mode 100644 index 0000000..c1b2b68 --- /dev/null +++ b/house/door_test.scad @@ -0,0 +1,7 @@ +include + +distance = 1150; + +door(); + +translate([distance, 0, 0]) door(door_position = DOOR_RIGHT);