feat(B07): CAD를 AutoCAD 명령 체계로 재구성한다 (조사표 1·2·3·5절)

저장소 사고로 잃은 4개 커밋(38eb7cd4·b8a11756·281528bf·f60b488d)의 작업물을
하나로 다시 담았다. 내용은 동일하다.

■ 구조
- commands/: 명령 정의(id·AutoCAD 별칭·글리프·도구/즉시실행)를 단일 소스로 두고
  리본·명령행·단축키가 모두 이 레지스트리를 읽는다. tools/tool.consts.ts 폐지.
- ribbon/: 탭→패널→명령 데이터(ribbon.config.ts)와 범용 렌더러 분리.
  AutoCAD 배치(홈·삽입·주석·뷰·출력)와 패널 확장(▾)을 따른다.
- tools/factories/sequence-tool.ts: 점·숫자·문자·객체·선택 단계를 선언하면
  xstate 머신을 만들어 주는 공장. 명령당 170줄 보일러플레이트 제거.
- helpers/geometry/: 3점 호·정다각형·타원·스플라인·구름형·평행이동·해치 스캔선·
  점렬 샘플링 등 상태 없는 순수 함수.
- Toolbar 483줄을 QuickAccessBar/Ribbon/InspectorPanel/StatusBar/CommandLine/
  ViewControls/PropertiesEditor/QuickProperties로 분해.

■ 명령 (조사표 기준)
- 1절 그리기 21건, 2절 수정 27건, 3절 도면층·특성·그룹·유틸리티 39건 전부 반영.
- 5절 주석 34건 중 26건 반영(문자·치수 16종·지시선·표·구름형·주석 축척).
- HatchEntity 추가(solid·pattern·cross·gradient) + JSON 왕복, Layer에 색·선가중치·
  선종류·동결·투명도 필드 추가, 그리기 루프가 동결·숨김·투명도를 반영.

■ 화면 실측에서 고친 결함
- 명령행 포커스 상태에서 ENTER가 도구로 가지 않던 문제
- 명령행 문자 입력이 접두사가 같은 명령으로 실행되던 문제
- 명령이 끝나도 입력을 계속 먹던 문제(점 입력 명령만 반복, 나머지는 선택 도구 복귀)
- 시퀀스 단계 인덱스 오사용 9건 + 단계 값 종류 검사 추가
- 해치 내부를 클릭해도 선택되지 않던 문제

미반영 8건(맞춤법 검사·꺾기 치수·치수 끊기/재연관/검사 치수·기하공차·지시선 수집·
축척 리스트 편집)은 조사표 `반영` 열과 PLAN.md에 사유를 적었다.
This commit is contained in:
2026-08-30 01:34:13 +09:00
parent 60bbe89edb
commit ea9d9685be
88 changed files with 8052 additions and 850 deletions
@@ -0,0 +1,299 @@
/** 주석 탭 명령 (조사표 5절 전 항목) */
import { toast } from 'react-toastify';
import type { CadCommand } from './command.types';
import { setActiveRibbonTab } from '../components/ui-state';
import { Tool } from '../tools';
import {
centerLineToolStateMachine,
centerMarkToolStateMachine,
dimAngularToolStateMachine,
dimArcToolStateMachine,
dimDiameterToolStateMachine,
dimOrdinateToolStateMachine,
dimRadiusToolStateMachine,
dimSpaceToolStateMachine,
} from '../tools/annotate/dimension-radial-tools';
import {
dimAlignedToolStateMachine,
dimAutoToolStateMachine,
dimBaselineToolStateMachine,
dimContinueToolStateMachine,
dimLinearToolStateMachine,
qDimToolStateMachine,
} from '../tools/annotate/dimension-tools';
import {
annotationScaleToolStateMachine,
dimStyleToolStateMachine,
mleaderAlignToolStateMachine,
mleaderStyleToolStateMachine,
mleaderToolStateMachine,
revCloudToolStateMachine,
tableStyleToolStateMachine,
tableToolStateMachine,
updateDimensions,
} from '../tools/annotate/leader-table-tools';
import {
findToolStateMachine,
mtextToolStateMachine,
textEditToolStateMachine,
textToolStateMachine,
} from '../tools/annotate/text-tools';
export const TEXT_COMMANDS: CadCommand[] = [
{
id: 'MTEXT',
label: '여러 줄 문자',
aliases: ['T', 'MT'],
glyph: '¶',
hint: '여러 줄 문자를 작성한다 (줄바꿈은 \\P)',
tool: Tool.MTEXT,
machine: mtextToolStateMachine,
},
{
id: 'TEXT',
label: '단일 행 문자',
aliases: ['DT'],
glyph: 'A',
hint: '한 줄짜리 문자를 작성한다',
tool: Tool.TEXT,
machine: textToolStateMachine,
},
{
id: 'STYLE',
label: '문자 스타일',
aliases: ['ST'],
glyph: '🅰',
hint: '리본 문자 패널에서 글꼴·크기·색을 지정한다',
run: () => {
setActiveRibbonTab('annotate');
toast.info('주석 탭 문자 패널에서 글꼴과 크기를 지정하십시오.');
return '문자 스타일';
},
},
{
id: 'TEXTEDIT',
label: '문자 편집',
aliases: ['TEDIT'],
glyph: '✎',
hint: '기존 문자의 내용을 고친다',
tool: Tool.TEXTEDIT,
machine: textEditToolStateMachine,
},
{
id: 'FIND',
label: '찾기·대치',
glyph: '🔍',
hint: '도면 문자를 찾고 바꾼다',
tool: Tool.FIND,
machine: findToolStateMachine,
},
];
export const DIMENSION_COMMANDS: CadCommand[] = [
{
id: 'DIM',
label: '치수',
glyph: '⟺',
hint: '선택 객체에 맞는 치수를 자동으로 넣는다',
tool: Tool.DIM,
machine: dimAutoToolStateMachine,
},
{
id: 'DIMLINEAR',
label: '선형 치수',
aliases: ['DLI'],
glyph: '↔',
hint: '수평 또는 수직 거리를 기입한다',
tool: Tool.DIMLINEAR,
machine: dimLinearToolStateMachine,
},
{
id: 'DIMALIGNED',
label: '정렬 치수',
aliases: ['DAL'],
glyph: '⤢',
hint: '두 점과 평행한 실제 길이를 기입한다',
tool: Tool.DIMALIGNED,
machine: dimAlignedToolStateMachine,
},
{
id: 'DIMANGULAR',
label: '각도 치수',
aliases: ['DAN'],
glyph: '∠',
hint: '세 점이 이루는 각도를 기입한다',
tool: Tool.DIMANGULAR,
machine: dimAngularToolStateMachine,
},
{
id: 'DIMARC',
label: '호 길이 치수',
aliases: ['DAR'],
glyph: '⌒',
hint: '호의 곡선 길이를 기입한다',
tool: Tool.DIMARC,
machine: dimArcToolStateMachine,
},
{
id: 'DIMRADIUS',
label: '반지름 치수',
aliases: ['DRA'],
glyph: 'R',
hint: '원·호의 반지름을 기입한다',
tool: Tool.DIMRADIUS,
machine: dimRadiusToolStateMachine,
},
{
id: 'DIMDIAMETER',
label: '지름 치수',
aliases: ['DDI'],
glyph: 'Ø',
hint: '원·호의 지름을 기입한다',
tool: Tool.DIMDIAMETER,
machine: dimDiameterToolStateMachine,
},
{
id: 'DIMORDINATE',
label: '세로좌표 치수',
aliases: ['DOR'],
glyph: '⌐',
hint: '기준 원점에 대한 X 또는 Y 좌표를 기입한다',
tool: Tool.DIMORDINATE,
machine: dimOrdinateToolStateMachine,
},
{
id: 'DIMBASELINE',
label: '기준선 치수',
aliases: ['DBA'],
glyph: '⊞',
hint: '직전 치수의 시작점을 기준으로 이어 기입한다',
tool: Tool.DIMBASELINE,
machine: dimBaselineToolStateMachine,
},
{
id: 'DIMCONTINUE',
label: '연속 치수',
aliases: ['DCO'],
glyph: '⋯',
hint: '직전 치수의 끝점에서 이어 기입한다',
tool: Tool.DIMCONTINUE,
machine: dimContinueToolStateMachine,
},
{
id: 'QDIM',
label: '빠른 치수',
glyph: '⚡',
hint: '선택 객체에 치수를 한 번에 넣는다',
tool: Tool.QDIM,
machine: qDimToolStateMachine,
},
{
id: 'CENTERMARK',
label: '중심 표식',
glyph: '✛',
hint: '원·호 중심에 표식을 넣는다',
tool: Tool.CENTERMARK,
machine: centerMarkToolStateMachine,
},
{
id: 'CENTERLINE',
label: '중심선',
glyph: '┈',
hint: '두 선 사이에 중심선을 넣는다',
tool: Tool.CENTERLINE,
machine: centerLineToolStateMachine,
},
{
id: 'DIMSTYLE',
label: '치수 스타일',
aliases: ['D'],
glyph: '⚙',
hint: '치수 문자 높이·화살표 크기·소수 자릿수를 정한다',
tool: Tool.DIMSTYLE,
machine: dimStyleToolStateMachine,
},
{
id: 'DIMUPDATE',
label: '치수 업데이트',
glyph: '⟳',
hint: '바꾼 치수 스타일을 기존 치수에 반영한다',
run: updateDimensions,
},
{
id: 'DIMSPACE',
label: '치수 간격',
glyph: '⇕',
hint: '평행한 치수선의 간격을 고르게 맞춘다',
tool: Tool.DIMSPACE,
machine: dimSpaceToolStateMachine,
},
];
export const LEADER_COMMANDS: CadCommand[] = [
{
id: 'MLEADER',
label: '다중 지시선',
aliases: ['MLD'],
glyph: '➤',
hint: '화살표와 문자를 잇는 지시선을 작성한다',
tool: Tool.MLEADER,
machine: mleaderToolStateMachine,
},
{
id: 'MLEADERSTYLE',
label: '지시선 스타일',
aliases: ['MLS'],
glyph: '⚙',
hint: '지시선 문자 높이와 화살표 크기를 정한다',
tool: Tool.MLEADERSTYLE,
machine: mleaderStyleToolStateMachine,
},
{
id: 'MLEADERALIGN',
label: '지시선 정렬',
glyph: '≡',
hint: '선택한 지시선 문자의 위치를 맞춘다',
tool: Tool.MLEADERALIGN,
machine: mleaderAlignToolStateMachine,
},
];
export const TABLE_COMMANDS: CadCommand[] = [
{
id: 'TABLE',
label: '테이블',
aliases: ['TB'],
glyph: '▦',
hint: '행·열 격자를 도면에 배치한다',
tool: Tool.TABLE,
machine: tableToolStateMachine,
},
{
id: 'TABLESTYLE',
label: '테이블 스타일',
aliases: ['TS'],
glyph: '⚙',
hint: '표의 열 너비와 행 높이를 정한다',
tool: Tool.TABLESTYLE,
machine: tableStyleToolStateMachine,
},
];
export const MARKUP_COMMANDS: CadCommand[] = [
{
id: 'REVCLOUD',
label: '구름형 리비전',
glyph: '☁',
hint: '검토 범위를 구름형 선으로 표시한다',
tool: Tool.REVCLOUD,
machine: revCloudToolStateMachine,
},
{
id: 'ANNOSCALE',
label: '주석 축척',
glyph: '⚖',
hint: '치수·문자·화살표 크기에 곱할 축척을 정한다',
tool: Tool.ANNOSCALE,
machine: annotationScaleToolStateMachine,
},
];