| 123456789101112 |
- // Produce a deduplicated seated batch: keep the pilot's unique buildings, then remove all pilot ids
- // from the overlapping urban batch before re-exporting it.
- import { readFileSync, writeFileSync } from 'node:fs'
- const root = 'tools/city-massing/city/cad-bim/'
- const seated = JSON.parse(readFileSync(root + 'seated-plan.json', 'utf8'))
- const pilot = JSON.parse(readFileSync(root + 'lod-pilot/manifest.json', 'utf8'))
- const oldBatch = JSON.parse(readFileSync(root + 'seated-batch-urban8000.json', 'utf8'))
- const pilotIds = new Set(pilot.cells.flatMap((cell) => cell.buildingIds))
- const buildings = oldBatch.buildings.filter((building) => !pilotIds.has(building.id))
- const out = { ...oldBatch, buildings, batch: { ...(oldBatch.batch || {}), deduplicatedAgainst: 'lod-pilot', selected: buildings.length } }
- writeFileSync(root + 'seated-batch-urban8000-dedup.json', JSON.stringify(out, null, 2))
- console.log(JSON.stringify({ pilot: pilotIds.size, before: oldBatch.buildings.length, after: buildings.length, removed: oldBatch.buildings.length - buildings.length }))
|