feat(core): parse P1 workbook and build T-type pier shape
- parse Excel input by header strings (pier, IP, bearing tables) - DMS azimuth parser (E03), input validation (E01, E02) - pure geometry: axis, bearings, stepped coping, column, footing, piles, blinding - warnings W01, W02, W05, W07, I01 - regression tests against spec.md section 12 (P1) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
d963d8ed3c
15 files changed
+2527
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { parseWorkbook } from '../src/core/parseWorkbook';
|
||||
import type { PierInput } from '../src/core/types';
|
||||
|
||||
const P1_PATH = fileURLToPath(new URL('../public/samples/P1.xlsx', import.meta.url));
|
||||
|
||||
export function loadWorkbook(path: string = P1_PATH): XLSX.WorkBook {
|
||||
return XLSX.read(readFileSync(path), { type: 'buffer' });
|
||||
}
|
||||
|
||||
export function loadP1(): PierInput {
|
||||
const { piers, issues } = parseWorkbook(loadWorkbook());
|
||||
if (issues.length) throw new Error(`P1 parse issues: ${JSON.stringify(issues)}`);
|
||||
const p1 = piers.find((p) => p.name === 'P1');
|
||||
if (!p1) throw new Error('P1 not found');
|
||||
return p1;
|
||||
}
|
||||
Reference in new issue
Block a user