# Kitchen with a long island: a 23'10" x 11'6" kitchen from the architect's drawing, in feet with the
# library's parts in cm (c), re-planned to its owner's wish: the fridge moved to the mudroom end of the
# west wall, both pantries out, and 58 in of counter in their place for the microwave and a coffee and
# tea station under 15 in uppers. The range sits between the two north windows; the island holds 9 ft of
# storage (drawers, sink, dishwasher) and 4 ft of seating. Checked: 4'5" from the fridge to the island's
# end, 3'4" between the island and the range run. x: 0 = west wall; y: 0 = the living-room side.
units("ft")
c = 1 / 30.48
WALL, CAB, TOP, WH, GLASS = "#f1eee8", "#e8e4dc", "#c9a27a", "#f4f2ee", "#9ec3d6"
H = 3.0

def door_in(x, y, turn, w, open, hinge, swing, color, wl):
    t = door(w=w, h=203, turn=turn, open=open, hinge=hinge, swing=swing, at=(0, 0, 0))
    fx, fy = t.part("frame top").min[0], t.part("frame top").min[1]
    t.delete()
    return door(w=w, h=203, turn=turn, open=open, hinge=hinge, swing=swing, color=color, at=(x - fx, y - fy, 0), wall=wl)

box(23.83, 11.5, 0.1, at=(0, 0, -0.1), name="floor", color="oak planks")
box(23.83, 4.0, 0.1, at=(0, -4.0, -0.1), name="living room floor", color="#d8cbb5 wood")
nw = box(24.83, 0.5, 8.0, at=(-0.5, 11.5, 0), name="north wall", color=WALL)
window(w=61, h=107, panes=1, at=(8.78, 11.5, 3.5), wall=nw)
window(w=61, h=107, panes=1, at=(14.0, 11.5, 3.5), wall=nw)
box(0.5, 8.8, H, at=(-0.5, 2.7, 0), name="west wall", color=WALL)
box(0.5, 8.8, H, at=(23.83, 2.7, 0), name="east wall", color=WALL)
box(2.4, 0.5, H, at=(-0.5, -0.5, 0), name="wall", color=WALL)
box(2.43, 0.5, H, at=(21.9, -0.5, 0), name="wall", color=WALL)
door_in(2.57, 11.52, 0, 81, 70, "left", "in", WH, nw)
door_in(20.5, 11.52, 0, 81, 90, "right", "out", WH, nw)

# north run: the range between the windows
x = 5.70
for w, kind in ((81, "drawers"), (82, "doors"), (76, "hob_oven"), (84, "drawers"), (83, "doors")):
    base_unit(w=w, d=61, h=91, kind=kind, at=(x, 11.5 - 61 * c, 0))
    x += w * c
box(2.5, 1.6, 0.4, at=(11.05, 9.9, 5.6), name="hood", color="#c9ccd2")
box(1.2, 0.9, 2.0, at=(11.7, 10.6, 6.0), name="hood chimney", color="#c9ccd2")

# west wall, the change: the fridge at the mudroom end, 58 in of counter for the microwave and the coffee and tea things
fridge(w=91, d=75, h=178, at=(0, 8.42, 0), turn=90)
base_unit(w=74, d=61, h=91, kind="drawers", at=(0, 3.52, 0), turn=90)
base_unit(w=74, d=61, h=91, kind="doors", at=(0, 3.52 + 74 * c, 0), turn=90)
wall_units(w=148, d=38, h=76, lift=137, at=(0, 3.52, 137 * c), turn=90)
box(1.3, 1.6, 1.0, at=(0.3, 6.2, 91 * c), name="microwave", color="#2f3033")
box(0.9, 0.5, 1.1, at=(0.3, 4.2, 91 * c), name="coffee machine", color="#4a4440")
cylinder(0.3, 0.8, at=(0.75, 5.1, 91 * c), name="kettle", color="#c9ccd2")

# the island: 9 ft of storage + 4 ft of seating, 3 ft deep, at counter height
x = 6.86
for w, kind in ((61, "drawers"), (59, "doors"), (91, "sink"), (61, "dishwasher")):
    base_unit(w=w, d=61, h=91, kind=kind, at=(x, 4.06, 0), turn=180)
    x += w * c
box(9.0, 1.03, 2.87, at=(6.86, 3.03, 0), name="island back", color=CAB)
box(0.1, 3.03, 2.87, at=(19.77, 3.03, 0), name="island end panel", color=CAB)
box(0.1, 3.03, 2.87, at=(15.86, 3.03, 0), name="island panel", color=CAB)
box(9.0, 1.03, 0.12, at=(6.86, 3.03, 2.87), name="island top, back", color=TOP)
box(4.01, 3.03, 0.12, at=(15.86, 3.03, 2.87), name="island top, seating", color=TOP)
bar_stool(w=40, h=65, at=(16.6, 1.6, 0))
bar_stool(w=40, h=65, at=(18.2, 1.6, 0))

dim((12.3, 6.06, 0), (12.3, 9.5, 0), offset=0, text="3'4\"")
dim((2.46, 7.0, 0), (6.86, 7.0, 0), offset=0, text="4'5\"")
dim((2.2, 3.52, 3.2), (2.2, 8.34, 3.2), offset=0, text="58\"")
label("fridge moved to the mudroom end", at=(4.0, 9.6, 0), to=(1.3, 9.9, 3.0))
label("58\" counter: microwave + coffee, tea", at=(-3.0, 1.6, 0), to=(0.6, 4.6, 3.0))
label("to mudroom", at=(3.9, 12.8, 0))
label("patio", at=(21.9, 12.8, 0))
label("to master suite", at=(-1.5, 0.6, 0))
label("living room", at=(12.0, -2.5, 0))
