Files
Aislo/B07_DesignDetail/openwebcad/src/commands/commands.modify.ts
T

341 lines
8.3 KiB
TypeScript

/** 홈 탭 — 수정 패널 명령 (조사표 2절 전 항목) */
import type { CadCommand } from './command.types';
import { Tool } from '../tools';
import { alignBottomToolStateMachine } from '../tools/align-bottom-tool';
import { alignCenterHorizontalToolStateMachine } from '../tools/align-center-horizontal-tool';
import { alignLeftToolStateMachine } from '../tools/align-left-tool';
import { alignCenterVerticalToolStateMachine } from '../tools/align-middle-vertical-tool';
import { alignRightToolStateMachine } from '../tools/align-right-tool';
import { alignTopToolStateMachine } from '../tools/align-top-tool';
import { arrayToolStateMachine } from '../tools/array-tool';
import { copyToolStateMachine } from '../tools/copy-tool';
import { eraserToolStateMachine } from '../tools/eraser-tool';
import {
blendToolStateMachine,
breakAtPointToolStateMachine,
breakToolStateMachine,
chamferToolStateMachine,
filletToolStateMachine,
} from '../tools/modify/corner-tools';
import { lengthenToolStateMachine } from '../tools/modify/lengthen-tool';
import {
drawOrderBackToolStateMachine,
drawOrderFrontToolStateMachine,
hatchEditToolStateMachine,
matchPropToolStateMachine,
overkillToolStateMachine,
reverseToolStateMachine,
setByLayerToolStateMachine,
} from '../tools/modify/property-tools';
import {
eraseToolStateMachine,
explodeToolStateMachine,
extendToolStateMachine,
joinToolStateMachine,
} from '../tools/modify/structure-tools';
import { offsetToolStateMachine } from '../tools/modify/offset-tool';
import {
alignToolStateMachine,
mirrorToolStateMachine,
stretchToolStateMachine,
} from '../tools/modify/transform-tools';
import { moveToolStateMachine } from '../tools/move-tool';
import { peditToolStateMachine } from '../tools/pedit-tool';
import { rotateToolStateMachine } from '../tools/rotate-tool';
import { scaleToolStateMachine } from '../tools/scale-tool';
export const MODIFY_COMMANDS: CadCommand[] = [
{
id: 'MOVE',
label: '이동',
aliases: ['M'],
glyph: '✥',
hint: '선택 객체를 기준점에서 새 위치로 이동한다',
tool: Tool.MOVE,
machine: moveToolStateMachine,
},
{
id: 'COPY',
label: '복사',
aliases: ['CO', 'CP'],
glyph: '⧉',
hint: '선택 객체를 하나 이상의 위치에 복제한다',
tool: Tool.COPY,
machine: copyToolStateMachine,
},
{
id: 'ROTATE',
label: '회전',
aliases: ['RO'],
glyph: '↻',
hint: '기준점을 중심으로 객체를 회전한다',
tool: Tool.ROTATE,
machine: rotateToolStateMachine,
},
{
id: 'SCALE',
label: '축척',
aliases: ['SC'],
glyph: '⤢',
hint: '기준점과 비율로 크기를 변경한다',
tool: Tool.SCALE,
machine: scaleToolStateMachine,
},
{
id: 'ALIGN',
label: '정렬',
aliases: ['AL'],
glyph: '⇲',
hint: '원본점·대상점 두 쌍으로 객체를 이동·회전한다',
tool: Tool.ALIGN,
machine: alignToolStateMachine,
},
{
id: 'MIRROR',
label: '대칭',
aliases: ['MI'],
glyph: '⇋',
hint: '대칭축을 기준으로 객체를 반사 복사한다',
tool: Tool.MIRROR,
machine: mirrorToolStateMachine,
},
{
id: 'OFFSET',
label: '간격띄우기',
aliases: ['O'],
glyph: '⇶',
hint: '평행선·동심원을 지정 거리만큼 띄워 만든다',
tool: Tool.OFFSET,
machine: offsetToolStateMachine,
},
{
id: 'ARRAY',
label: '배열',
aliases: ['AR'],
glyph: '⋮⋮',
hint: '직사각형 패턴으로 객체를 반복 배치한다',
tool: Tool.ARRAY,
machine: arrayToolStateMachine,
},
{
id: 'TRIM',
label: '자르기',
aliases: ['TR'],
glyph: '⌦',
hint: '교차점 사이의 필요 없는 부분을 잘라낸다',
tool: Tool.ERASER,
machine: eraserToolStateMachine,
},
{
id: 'EXTEND',
label: '연장',
aliases: ['EX'],
glyph: '⇥',
hint: '선의 끝을 지정한 경계까지 늘린다',
tool: Tool.EXTEND,
machine: extendToolStateMachine,
},
{
id: 'STRETCH',
label: '신축',
aliases: ['S'],
glyph: '↔',
hint: '기준점에 가까운 끝점을 끌어 늘린다',
tool: Tool.STRETCH,
machine: stretchToolStateMachine,
},
{
id: 'FILLET',
label: '모깎기',
aliases: ['F'],
glyph: '◟',
hint: '두 선을 지정 반지름의 호로 연결한다',
tool: Tool.FILLET,
machine: filletToolStateMachine,
},
{
id: 'CHAMFER',
label: '모따기',
aliases: ['CHA'],
glyph: '◺',
hint: '두 선을 직선 모따기로 연결한다',
tool: Tool.CHAMFER,
machine: chamferToolStateMachine,
},
{
id: 'BLEND',
label: '곡선 혼합',
glyph: '∿',
hint: '두 곡선의 끝을 부드러운 곡선으로 잇는다',
tool: Tool.BLEND,
machine: blendToolStateMachine,
},
{
id: 'BREAK',
label: '끊기',
aliases: ['BR'],
glyph: '⊣⊢',
hint: '두 점 사이를 제거해 객체를 끊는다',
tool: Tool.BREAK,
machine: breakToolStateMachine,
},
{
id: 'BREAKATPOINT',
label: '점에서 끊기',
glyph: '⊥',
hint: '지정한 점에서 객체를 둘로 나눈다',
tool: Tool.BREAK_AT_POINT,
machine: breakAtPointToolStateMachine,
},
{
id: 'JOIN',
label: '결합',
aliases: ['J'],
glyph: '⋈',
hint: '끝이 맞는 객체를 하나의 폴리선으로 결합한다',
tool: Tool.JOIN,
machine: joinToolStateMachine,
},
{
id: 'EXPLODE',
label: '분해',
aliases: ['X'],
glyph: '✳',
hint: '폴리선·사각형·해치를 구성요소로 분해한다',
tool: Tool.EXPLODE,
machine: explodeToolStateMachine,
},
{
id: 'ERASE',
label: '지우기',
aliases: ['E'],
glyph: '⌫',
hint: '선택한 객체를 삭제한다',
tool: Tool.ERASE,
machine: eraseToolStateMachine,
},
{
id: 'LENGTHEN',
label: '길이조정',
aliases: ['LEN'],
glyph: '↦',
hint: '선의 길이를 증분만큼 늘리거나 줄인다',
tool: Tool.LENGTHEN,
machine: lengthenToolStateMachine,
},
{
id: 'PEDIT',
label: '폴리선 편집',
aliases: ['PE'],
glyph: '⌁',
hint: '연결된 선을 폴리선으로 묶거나 편집한다',
tool: Tool.PEDIT,
machine: peditToolStateMachine,
},
{
id: 'HATCHEDIT',
label: '해치 편집',
aliases: ['HE'],
glyph: '▨',
hint: '기존 해치의 패턴을 바꾼다',
tool: Tool.HATCHEDIT,
machine: hatchEditToolStateMachine,
},
{
id: 'DRAWORDER',
label: '맨 앞으로',
aliases: ['DR'],
glyph: '⤒',
hint: '선택 객체를 가장 위에 그린다',
tool: Tool.DRAWORDER_FRONT,
machine: drawOrderFrontToolStateMachine,
},
{
id: 'DRAWORDERBACK',
label: '맨 뒤로',
glyph: '⤓',
hint: '선택 객체를 가장 아래에 그린다',
tool: Tool.DRAWORDER_BACK,
machine: drawOrderBackToolStateMachine,
},
{
id: 'MATCHPROP',
label: '특성 일치',
aliases: ['MA'],
glyph: '🖌',
hint: '원본 객체의 색·굵기·선종류를 대상에 복사한다',
tool: Tool.MATCHPROP,
machine: matchPropToolStateMachine,
},
{
id: 'OVERKILL',
label: '중복 객체 삭제',
glyph: '⧉',
hint: '같은 자리에 겹친 중복 객체를 지운다',
tool: Tool.OVERKILL,
machine: overkillToolStateMachine,
},
{
id: 'REVERSE',
label: '방향 반전',
glyph: '⇄',
hint: '선·폴리선의 시작점과 끝점을 뒤집는다',
tool: Tool.REVERSE,
machine: reverseToolStateMachine,
},
{
id: 'SETBYLAYER',
label: 'ByLayer로',
glyph: '▤',
hint: '선택 객체의 특성을 레이어 값으로 되돌린다',
tool: Tool.SETBYLAYER,
machine: setByLayerToolStateMachine,
},
];
/** 원본 openwebcad의 정렬 도구 — AutoCAD 리본에는 없지만 기존 기능이라 유지한다 */
export const ALIGN_COMMANDS: CadCommand[] = [
{
id: 'ALIGNLEFT',
label: '왼쪽',
glyph: '⇤',
tool: Tool.ALIGN_LEFT,
machine: alignLeftToolStateMachine,
},
{
id: 'ALIGNCENTERH',
label: '가로 중앙',
glyph: '↔',
tool: Tool.ALIGN_CENTER_HORIZONTAL,
machine: alignCenterHorizontalToolStateMachine,
},
{
id: 'ALIGNRIGHT',
label: '오른쪽',
glyph: '⇥',
tool: Tool.ALIGN_RIGHT,
machine: alignRightToolStateMachine,
},
{
id: 'ALIGNTOP',
label: '위',
glyph: '⤒',
tool: Tool.ALIGN_TOP,
machine: alignTopToolStateMachine,
},
{
id: 'ALIGNCENTERV',
label: '세로 중앙',
glyph: '↕',
tool: Tool.ALIGN_CENTER_VERTICAL,
machine: alignCenterVerticalToolStateMachine,
},
{
id: 'ALIGNBOTTOM',
label: '아래',
glyph: '⤓',
tool: Tool.ALIGN_BOTTOM,
machine: alignBottomToolStateMachine,
},
];