Files
Aislo/B07_DesignDetail/openwebcad/src/tools/scale-tool.ts
T
eomsangdonandClaude Opus 5.5 d35bdfa69d feat(CAD): 337-5 라 옮기기 무리 1 단계 — MOVE · ROTATE · SCALE 오토캐드 물음 차례
- MOVE: 기준점 [변위(D)] <변위> · 두 번째 점 <첫 번째 점을 변위로 사용> · 변위 기억(MOVE.DISP) · 한 번 뒤 끝 · Esc 제자리 끝
- ROTATE · SCALE: 공용 틀(pivot-tool) — 누름 한 번 = 값 · 복사(C) · 참조(R) → 새 값 [점(P)] · 각 · 비율 기억 · 0 이하 축척 거절
- 공용 고르기 상태(transform.helpers) — PICKFIRST · 빈 고르기 Enter = 끝 · OPTION.* 넘김 · 원본은 확정까지 도면에 그대로(N1 · N2)
- 시험 transform-acad(15) · scale-tool 단위 시험 새 상태 이름

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
2026-10-16 00:17:16 +09:00

26 lines
1.2 KiB
TypeScript

/**
* SCALE(337 라 · 설계 1-3) — 「기준점 지정:」 → 「축척 비율 지정 또는 [복사(C)/참조(R)] <1.0000>:」 ·
* 누름 = 기준점~점 거리 · 숫자 > 0 · R → 「참조 길이 지정 <1.0000>:」(숫자 · 두 점) → 「새 길이 지정 또는 [점(P)] <1.0000>:」 ·
* 0 이하 거절 · 비율 기억(SCALE.FACTOR).
*/
import { Tool } from '../tools';
import { PivotState, createPivotTool } from './pivot-tool';
import { distanceOf } from './transform.helpers';
export { PivotState as ScaleState };
export const scaleToolStateMachine = createPivotTool({
tool: Tool.SCALE,
format: 'len',
value: { text: '축척 비율 지정', remember: 'SCALE.FACTOR', initial: 1 },
reference: { text: '참조 길이 지정', remember: 'SCALE.REF', initial: 1 },
next: { text: '새 길이 지정', remember: 'SCALE.NEW', initial: 1 },
number: { positive: true },
copyNotice: ['선택한 객체의 사본을 축척함.', '선택한 객체를 축척함.'],
invalidNotice: '값은 양수이고 0이 아니어야 함.',
measure: distanceOf,
combine: (next, reference) => (reference > 0 ? next / reference : null),
valid: (factor) => factor > 0,
apply: (entity, base, factor) => entity.scale(base, factor),
});