fix(rebar): cut the C–C section through the selected pair only

- The section was drawing every bearing on the same 교축 line, so the blocks and
  dimension text stacked on top of each other. It now cuts through the selected
  pair (①·⑥ …), which the ③ card also shows as chips, shared with ②.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-26 14:14:31 +09:00
1 parent 38bb26eda5
commit 521979b437
2 files changed
+28 -9

No files matched your search

+12 -7
View File
@@ -1,24 +1,29 @@
import type { PierModel } from '../core/geometry';
import { barDepths, barsAcross, type BlockRebarSettings } from '../core/rebar/bearing-block';
import { INTEGRATED_BLOCK } from '../core/integrated-block';
import { pairEccentricities } from '../core/bearing-layout';
/**
* 받침블럭 배근 · 단면 C–C (승인 2026-10-26, 시안 ③): a section along the 교축, through the blocks. x = 교축 (n), y = EL
* (down from the highest block top). S2 bars are dots along the top, S1 bars are lines with legs down into the coping.
* Dimensions: the block widths and gap, the bar layout (end · n@spacing = span), and the top cover.
*/
export function blockRebarSectionSvg(m: PierModel): string {
export function blockRebarSectionSvg(m: PierModel, pairIndex = 0): string {
const s: BlockRebarSettings = m.blockRebar;
const depth = barDepths(s);
const ib = m.integratedBlocks;
const pair = pairEccentricities(m.blocks)[pairIndex];
if (!pair) return '';
const f = m.blocks.find((b) => b.no === pair.frontNo && b.row === '전열')!;
const k = m.blocks.find((b) => b.no === pair.backNo && b.row === '후열')!;
const ib = m.integratedBlocks.find((x) => x.frontNo === pair.frontNo);
const parts: string[] = [];
const topRef = Math.max(...m.blocks.map((b) => b.top));
const topRef = Math.max(f.top, k.top, ib?.topFront ?? 0, ib?.topBack ?? 0);
const Y = (el: number) => (topRef - el) * 1000;
// Spans to draw: one 2500 span per 일체 pair, else one 1200 span per bearing.
const spans = ib.length > 0
? ib.map((x) => ({ nc: x.n, width: INTEGRATED_BLOCK.length, bottom: x.bottom, topL: x.topFront, topR: x.topBack, depthTopL: x.topFront, depthTopR: x.topBack, stepped: true }))
: m.blocks.map((b) => ({ nc: b.n, width: 1200, bottom: b.bottom, topL: b.top, topR: b.top, depthTopL: b.top, depthTopR: b.top, stepped: false }));
// One section through the selected pair: a 2500 span (일체) or the two 1200 blocks (분리), along the 교축.
const spans = ib
? [{ nc: ib.n, width: INTEGRATED_BLOCK.length, bottom: ib.bottom, topL: ib.topFront, topR: ib.topBack, depthTopL: ib.topFront, depthTopR: ib.topBack, stepped: true }]
: [f, k].map((b) => ({ nc: b.n, width: 1200, bottom: b.bottom, topL: b.top, topR: b.top, depthTopL: b.top, depthTopR: b.top, stepped: false }));
const nAll = spans.map((x) => x.nc);
const nc = (Math.min(...nAll) + Math.max(...nAll)) / 2;
const X = (n: number) => (n - nc) * 1000;