feat(B07 CAD): 337-4b 다-2 늘이기 · 재기 · 치수 오토캐드 조작 — LENGTHEN · DIVIDE · MEASURE · DIST · DIM 류

- LENGTHEN 새 도구(lengthen-tool.ts) — 측정할 객체 [증분(DE)/퍼센트(P)/전체(T)] <마지막 방식> · 누름 = 현재 길이 알림 · 방식별 값 기억 · 변경할 객체 되풀이 · U = 이 명령 안 바꿈만 · 빈 Enter · Esc 끝 · 선 · 호
- DIVIDE · MEASURE — 기본값 없음 · 정수 2~32767 · 양수 · 블록(B) 없음 안내 · MEASURE 누른 끝부터
- DIST — 오토캐드 꼴 두 줄 기록(거리 · 각도 · 증분) · 다중 점(M) 없음 안내
- DIMLINEAR · DIMALIGNED — 빈 Enter = 객체 선택 · [문자(T)/수평(H)/수직(V)] · 치수 문자 = 기록 · 치수 객체 문자 바꿈 칸(<> = 잰 값)
- DIMCONTINUE · DIMBASELINE — 되풀이 · 명령 취소(U) · 빈 Enter 끝 · DIMRADIUS · DIMDIAMETER [문자(T)] · 그 밖 치수 물음 글
- 시험 measure-acad 11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
This commit is contained in:
2026-10-16 00:15:35 +09:00
co-authored by Claude Opus 5.5
parent 7c35341002
commit c15be5116a
8 changed files with 1022 additions and 148 deletions
@@ -1,5 +1,9 @@
/** 등분(DIVIDE)·길이분할(MEASURE) — 객체를 자르지 않고 점만 놓는다 */
/**
* 등분(DIVIDE)·길이분할(MEASURE) — 객체를 자르지 않고 점만 놓는다.
* 오토캐드 물음 차례(337 설계 1-2) · 기본값 없음 · 한 번 뒤 끝 · 블록(B) 없음.
*/
import { toast } from 'react-toastify';
import type { OptionSpec } from '../../commands/prompt';
import {
dividePoints,
measurePoints,
@@ -10,12 +14,21 @@ import { Tool } from '../../tools';
import { pointEntity } from '../factories/entity-factory';
import { createSequenceTool } from '../factories/sequence-tool';
const BLOCK: OptionSpec = { key: 'BLOCK', kw: 'B', en: 'BLOCK', label: '블록' };
export const divideToolStateMachine = createSequenceTool({
tool: Tool.DIVIDE,
helpers: false,
steps: [
{ kind: 'entity', instructions: '등분할 객체를 선택하십시오.' },
{ kind: 'number', instructions: '세그먼트 수를 입력하십시오 <4>.', defaultValue: 4 },
{ kind: 'entity', prompt: { text: '등분할 객체 선택' } },
{
kind: 'number',
prompt: {
text: '세그먼트 수 입력',
absent: [BLOCK],
number: { int: true, min: 2, max: 32767 },
},
},
],
commit: (input) => {
const points = dividePoints(sampleEntityPoints(input.entity(0)), input.number(1));
@@ -31,11 +44,19 @@ export const measureLengthToolStateMachine = createSequenceTool({
tool: Tool.MEASURE_LENGTH,
helpers: false,
steps: [
{ kind: 'entity', instructions: '길이로 분할할 객체를 선택하십시오.' },
{ kind: 'number', instructions: '세그먼트 길이를 입력하십시오 <10>.', defaultValue: 10 },
{ kind: 'entity', prompt: { text: '길이 분할 객체 선택' } },
{
kind: 'number',
prompt: { text: '세그먼트의 길이 지정', absent: [BLOCK], number: { positive: true } },
},
],
commit: (input) => {
const points = measurePoints(sampleEntityPoints(input.entity(0)), input.number(1));
// 누른 자리에 가까운 끝부터 잼(오토캐드)
const path = sampleEntityPoints(input.entity(0));
const pick = input.pick(0);
const nearEnd =
path.length > 1 && path[path.length - 1].distanceTo(pick)[0] < path[0].distanceTo(pick)[0];
const points = measurePoints(nearEnd ? [...path].reverse() : path, input.number(1));
if (!points.length) {
toast.warn('지정한 길이로 나눌 수 없습니다.');
return;