Files
Aislo/B07_DesignDetail/openwebcad/src/commands/commands.layer.ts
T
eomsangdon ea9d9685be 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에 사유를 적었다.
2026-08-30 01:34:13 +09:00

167 lines
3.9 KiB
TypeScript

/** 홈 탭 — 도면층 패널 명령 (조사표 3절) */
import type { CadCommand } from './command.types';
import { Tool } from '../tools';
import {
layerCurrentToolStateMachine,
layerDeleteToolStateMachine,
layerFreezeToolStateMachine,
layerIsolateToolStateMachine,
layerLockToolStateMachine,
layerMatchToolStateMachine,
layerMergeToolStateMachine,
layerOffToolStateMachine,
layerStateRestoreToolStateMachine,
layerStateSaveToolStateMachine,
layerToCurrentToolStateMachine,
layerUnlockToolStateMachine,
openLayerManager,
restorePreviousLayers,
thawAllLayers,
turnAllLayersOn,
unisolateLayers,
walkLayers,
} from '../tools/utility/layer-tools';
export const LAYER_COMMANDS: CadCommand[] = [
{
id: 'LAYER',
label: '도면층 특성',
aliases: ['LA'],
glyph: '▤',
hint: '도면층을 만들고 이름·표시·잠금을 관리한다',
run: openLayerManager,
},
{
id: 'LAYCURSET',
label: '현재 도면층 설정',
glyph: '◉',
hint: '선택한 객체의 도면층을 현재 도면층으로 지정한다',
tool: Tool.LAYER_CURRENT,
machine: layerCurrentToolStateMachine,
},
{
id: 'LAYOFF',
label: '도면층 끄기',
glyph: '◐',
hint: '선택 객체가 속한 도면층을 숨긴다',
tool: Tool.LAYOFF,
machine: layerOffToolStateMachine,
},
{
id: 'LAYON',
label: '모두 켜기',
glyph: '◉',
hint: '모든 도면층을 표시한다',
run: turnAllLayersOn,
},
{
id: 'LAYFRZ',
label: '동결',
glyph: '❄',
hint: '도면층을 표시·재생성 대상에서 뺀다',
tool: Tool.LAYFRZ,
machine: layerFreezeToolStateMachine,
},
{
id: 'LAYTHW',
label: '동결 해제',
glyph: '☀',
hint: '모든 도면층의 동결을 푼다',
run: thawAllLayers,
},
{
id: 'LAYLCK',
label: '잠금',
glyph: '🔒',
hint: '도면층 객체를 편집할 수 없게 한다',
tool: Tool.LAYLCK,
machine: layerLockToolStateMachine,
},
{
id: 'LAYULK',
label: '잠금 해제',
glyph: '🔓',
hint: '도면층 잠금을 푼다',
tool: Tool.LAYULK,
machine: layerUnlockToolStateMachine,
},
{
id: 'LAYISO',
label: '분리',
glyph: '◫',
hint: '선택 객체의 도면층만 남기고 나머지를 숨긴다',
tool: Tool.LAYISO,
machine: layerIsolateToolStateMachine,
},
{
id: 'LAYUNISO',
label: '분리 해제',
glyph: '◻',
hint: '도면층 분리 이전 상태로 되돌린다',
run: unisolateLayers,
},
{
id: 'LAYERP',
label: '이전 상태',
glyph: '↺',
hint: '직전 도면층 설정으로 되돌린다',
run: restorePreviousLayers,
},
{
id: 'LAYERSTATE',
label: '도면층 상태 저장',
aliases: ['LAS'],
glyph: '💾',
hint: '현재 도면층 설정을 이름으로 저장한다',
tool: Tool.LAYERSTATE,
machine: layerStateSaveToolStateMachine,
},
{
id: 'LAYERSTATERESTORE',
label: '도면층 상태 복원',
glyph: '⭯',
hint: '저장한 도면층 설정을 되돌린다',
tool: Tool.LAYERSTATE_RESTORE,
machine: layerStateRestoreToolStateMachine,
},
{
id: 'LAYMCH',
label: '도면층 일치',
glyph: '⇄',
hint: '선택 객체를 대상 객체의 도면층으로 옮긴다',
tool: Tool.LAYMCH,
machine: layerMatchToolStateMachine,
},
{
id: 'LAYCUR',
label: '현재 도면층으로',
glyph: '⇥',
hint: '선택 객체를 현재 도면층으로 옮긴다',
tool: Tool.LAYCUR,
machine: layerToCurrentToolStateMachine,
},
{
id: 'LAYMRG',
label: '도면층 병합',
glyph: '⊎',
hint: '한 도면층의 객체를 다른 도면층으로 옮기고 원래 도면층을 지운다',
tool: Tool.LAYMRG,
machine: layerMergeToolStateMachine,
},
{
id: 'LAYDEL',
label: '도면층 삭제',
glyph: '🗑',
hint: '선택한 도면층과 그 객체를 삭제한다',
tool: Tool.LAYDEL,
machine: layerDeleteToolStateMachine,
},
{
id: 'LAYWALK',
label: '도면층 탐색',
glyph: '👣',
hint: '부를 때마다 다음 도면층만 표시한다',
run: walkLayers,
},
];