""" The Interiors pack's hall as a unit, shortened and made to fit a hull. In the demo the hall is four 6.7 m bays long (a raised pad with a door at each end, a sunken floor between), 15.8 m wide inside, with machine alcoves outside its long walls (fans, tanks, pipes: 2 to 4.5 m deep). Only its flush wall bays fit the vessel, so: * one middle bay is taken out (pad, middle, pad: 20.1 m); * every alcove and everything behind the wall line is left out; * the middle bay keeps the pack's flush "gate" wall on both sides; the pad bays get the pack's window wall with a plain back panel 0.5 m behind the glass instead of an alcove. Frame of the returned unit: origin on the hall's EAST door plane at threshold level, the hall lies along -X. """ from mathutils import Matrix from units import Demo, Item, Unit, frame WHITE_MAP = "ModSci_Engineer__Example_Dynamic_White" E_DOOR = (-42.65, -15.6) Z_DOOR = 0.2 BAY_H = 6.7 HALF = 8.05 # everything of the hall body lies within this distance of its axis LENGTH_4 = 27.55 # door plane to door plane, four bays ALCOVE_PREFIX = ("SM_WVB_", "SM_WVC_", "SM_WVA_Fan", "SM_WVA_Floor", "SM_WVA_Ceiling_B", "SM_WVA_Wall_A", "SM_WVA_Wall_B") WINDOW_PREFIX = ("SM_WVA_MainWall", "SM_WVA_LowerWall", "SM_WVA_Wall_End_A", "SM_WVA_Ceiling_A") def build_hall(demo=None, props="all", loose=()): """Three-bay hall. props: "all" | "tidy" (names in `loose` left out) | "bare" (kit structure of the Interiors pack, lights and lettering only).""" demo = demo or Demo(WHITE_MAP) f = frame(E_DOOR[0], E_DOOR[1], Z_DOOR, 0.0) def pred(it, p): if not (-LENGTH_4 - 0.5 <= p.x <= 0.45 and abs(p.y) <= HALF): return False if it.kind == "mesh" and it.name.startswith(ALCOVE_PREFIX): return False return True src = demo.unit(f, pred) # bays from the east: E (-7.05, -0.35), 3 (-13.75, -7.05), 2 (-20.45, -13.75), W (-27.15, -20.45) x3a, x3b = -DOOR_GAP_H - 2 * BAY_H, -DOOR_GAP_H - BAY_H items = [] for it in src.items: x = it.center.x if x3a - 1e-3 <= x < x3b - 1e-3: continue # the middle bay that is taken out if props != "all" and it.kind == "mesh": interiors = it.key.split("/")[2] == "ModSciInteriors" if props == "bare" and not interiors: continue if props == "tidy" and it.name in loose: continue items.append(it.moved(Matrix.Translation((BAY_H, 0, 0))) if x < x3a - 1e-3 else it) # bays now: E (-7.05, -0.35), C (-13.75, -7.05), W (-20.45, -13.75); west door plane at -20.85 def in_bay(it, lo, hi): return lo <= it.center.x < hi xe, xc, xw = (-DOOR_GAP_H - BAY_H, -DOOR_GAP_H), (-DOOR_GAP_H - 2 * BAY_H, -DOOR_GAP_H - BAY_H), (-DOOR_GAP_H - 3 * BAY_H, -DOOR_GAP_H - 2 * BAY_H) extra = [] for sgn in (1, -1): def on_side(it): return it.center.y * sgn > 7.2 window_w = [it for it in items if it.kind == "mesh" and on_side(it) and in_bay(it, *xw) and it.name.startswith(WINDOW_PREFIX)] window_e = [it for it in items if it.kind == "mesh" and on_side(it) and in_bay(it, *xe) and it.name.startswith(WINDOW_PREFIX)] if not any(it.name == "SM_WVA_MainWall" for it in window_e) and window_w: extra += [it.moved(Matrix.Translation((2 * BAY_H, 0, 0))) for it in window_w] elif not any(it.name == "SM_WVA_MainWall" for it in window_w) and window_e: extra += [it.moved(Matrix.Translation((-2 * BAY_H, 0, 0))) for it in window_e] back = [it for it in items if it.kind == "mesh" and on_side(it) and in_bay(it, *xc) and it.name == "SM_WVD_Wall_C"] for b in back: extra.append(b.moved(Matrix.Translation((BAY_H, 0, 0)))) extra.append(b.moved(Matrix.Translation((-BAY_H, 0, 0)))) return Unit(items + extra) DOOR_GAP_H = 0.35 LENGTH_3 = 3 * BAY_H + 2 * DOOR_GAP_H + 0.05 # 20.85: east door plane to west door plane of the 3-bay hall