The project has one basis: 엑셀 z (default) or 도면 EL.X. On ②, the bearing card lists EL.X, h1 and h2 for each bearing (per pier), with a button to fill the reference values. With the drawing basis the model takes the drawing EL.X as the bearing height; the coping tops stay within the 5 mm tolerance, the front block is 164 mm and the back 139 mm (excluding the pad). The check compares EL.X − h1 − h2 with the Excel-basis coping top. The basis and the drawing values are saved in the project file (optional fields). Changes regenerate every pier at once. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
36 lines
1.8 KiB
TypeScript
36 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { buildPier } from '../src/core/geometry';
|
|
import { BEARING_ELEVATION_REF, DRAWING_TOL_MM, drawingCopingCheck, withDrawingBasis, type DrawingBearing } from '../src/core/bearing-ref';
|
|
import { loadP1 } from './helpers';
|
|
|
|
const drawing: DrawingBearing[] = BEARING_ELEVATION_REF.map((r) => ({ no: r.no, elx: r.elx, h1: r.h1, h2: r.h2 }));
|
|
|
|
describe('받침 기준: 도면 EL.X (Q16 option 2, 승인 2026-10-23)', () => {
|
|
it('the default basis (엑셀 z) keeps the model as before: the drawing check still reports the EL.X gap', () => {
|
|
const excel = buildPier(loadP1());
|
|
expect(excel.blocks.filter((b) => b.row === '전열')[0].padTop).toBeCloseTo(43.561, 3);
|
|
});
|
|
|
|
it('with the drawing basis the pads sit at the drawing EL.X and the coping tops stay within the 5 mm tolerance', () => {
|
|
const m = buildPier(withDrawingBasis(loadP1(), drawing));
|
|
expect(m.blocks.filter((b) => b.row === '전열')[0].padTop).toBeCloseTo(43.625, 3);
|
|
for (const c of drawingCopingCheck(m, drawing)) {
|
|
expect(Math.abs(c.diffMm), `No ${c.no}`).toBeLessThanOrEqual(DRAWING_TOL_MM);
|
|
}
|
|
});
|
|
|
|
it('with the drawing basis the front block (h1) is 164 mm and the back block 139 mm, excluding the 50 mm pad', () => {
|
|
const m = buildPier(withDrawingBasis(loadP1(), drawing));
|
|
const front = m.blocks.filter((b) => b.row === '전열')[0];
|
|
const back = m.blocks.filter((b) => b.row === '후열')[0];
|
|
expect(Math.round((front.top - front.bottom) * 1000)).toBe(164);
|
|
expect(Math.round((back.top - back.bottom) * 1000)).toBe(139);
|
|
});
|
|
|
|
it('a drawing row that is off by more than 5 mm is flagged', () => {
|
|
const bad = drawing.map((d) => (d.no === 3 ? { ...d, elx: d.elx + 0.02 } : d));
|
|
const c = drawingCopingCheck(buildPier(loadP1()), bad).find((x) => x.no === 3)!;
|
|
expect(c.ok).toBe(false);
|
|
});
|
|
});
|