""" A straight lining wall made of the Engineer pack's wall panels, for a room whose shell is not the pack's own. The pack's cars have 3.6 m wall panels, 0.42 m deep and 4.8 m tall, with what the author mounted on them (lights, distribution boxes, pipes, a valve column, stickers). Here one wall of the "white" demo car is taken bay by bay and set out again as a free-standing run, so a room with a curved or leaning shell gets flat walls of whole panels. Frame of the returned unit: origin at the start of the run on the wall's BACK plane, at the foot of the panels; +X along the wall, the room is on +Y (the wall occupies y 0..0.42), z 0..4.8. """ from mathutils import Matrix from cars import DOOR_GAP, Engineer from units import BAY, LOOSE, Unit PANEL_DEPTH = 0.42 PANEL_HEIGHT = 4.8 WALL_BACK = 2.6 # the car's wall back plane is this far from its axis FOOT = 0.9 # the panels' foot is this far below the car's door threshold NOT_WALL = ("SM_Doorway_SideBrace", "SM_Wall_HB_Edge", "SM_Rail_A") SOUTH_PANELS = ("mesh", "padded", "mesh") # what the three source bays show (SM_Wall_HB_A3, _A2, _A3) def wall_liner(eng, seq=(0, 1, 2, 0, 1, 2), kind="white", foot_strip=True): """Run of len(seq) panels; seq[j] = which bay (0..2) of the source car's south wall stands at place j. Loose things on the floor are left out; what hangs on the wall comes along.""" src = eng._src_car(kind) to_liner = Matrix.Translation((-DOOR_GAP, WALL_BACK, FOOT)) bays = {0: [], 1: [], 2: []} for it in src.items: if it.center.y > -1.95: continue # not on the south wall if it.kind == "mesh": if it.name in LOOSE or it.name.startswith(NOT_WALL): continue if it.name == "SM_GlassFloor_Side_A" and not foot_strip: continue b = int((it.center.x - DOOR_GAP + 1e-4) // BAY) bays[max(0, min(2, b))].append(it.moved(to_liner)) out = [] for j, b in enumerate(seq): t = Matrix.Translation(((j - b) * BAY, 0.0, 0.0)) out += [it.moved(t) for it in bays[b]] return Unit(out) def run_length(n): return n * BAY