Adapter: The Lego Builder

Converts multi-storey massing Breps into floor blocks for the Masterplan Engine: slices each Brep's footprint, counts the whole floors that fit its height and outputs the JSON payload grouped per building.

JSON Masterplan (Beta) Nickname: AD_LEGO

Overview

STAGE 1 ADAPTER: THE LEGO BUILDER (METHOD 3) - VERBOSE DIAGNOSTICS & FIXED STACKING

Inputs (6)

  • MassingBlocks (Brep): MassingBlocks
  • Programs (Text): Programs
  • TowerIDs (Text): TowerIDs
  • BuildingNames (Text): BuildingNames
  • FloorHeights (Number): FloorHeights
  • HeightResolution (Integer): 0 = Strict Cutoff, 1 = Stretch Top Floor

Outputs (2)

  • JSON_Payload (Text): JSON Payload
  • Info (Text): Method, assumptions, simplifications and references.

Method, assumptions and simplifications

The same notes appear in the component's Info output.

Method

  1. For each MassingBlocks Brep, the bounding box gives the bottom and top and the total height; the Brep is cut 0.01 m above its bottom and the largest closed section is taken as the footprint.
  2. Floor count = whole number of FloorHeights that fit in the block height, with a 1 mm tolerance (a block of 11.9999 m with 4 m floors counts 3 floors); FloorHeights per block, default 4.0 m, zero or negative also falls back to 4.0 m.
  3. HeightResolution 0 (Strict Cutoff): one block with that many floors; the leftover height is discarded.
  4. HeightResolution 1 (Stretch Top Floor): if the leftover is more than 0.1 m, the block is split into the standard floors plus one top floor whose height is FloorHeight plus the leftover (program tagged (Top)).
  5. base_z of each block = block bottom minus the lowest bottom of its building (true_base_elevation), rounded to 1 mm. Footprints are written as line, arc or polyline segments, as in AD_CAKE.
  6. The JSON payload groups blocks per building name.

Assumptions

  • Each Brep is a vertical extrusion of one footprint, so the section 0.01 m above its base is valid for all its floors.
  • Programs, TowerIDs, BuildingNames and FloorHeights match MassingBlocks item by item; missing items default to Mixed_Use, Main_Mass, Building_01 and 4.0 m.
  • Model units are metres.

Simplifications and limits

  • Blocks lower than one FloorHeight produce no floors and are left out without a warning.
  • In Stretch mode a leftover of 0.1 m or less is dropped; in Strict mode all leftover height is dropped.
  • Only the largest closed section is kept: holes and extra pieces are lost; setbacks inside a block are ignored.
  • boundary_segments keep their absolute world Z while base_z is relative to the building base.

Workflow

  • Multi-storey massing Breps -> AD_LEGO -> JSON payload for the Masterplan Engine.
  • Use AD_CAKE instead when the model is already sliced floor by floor.