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:
@@ -51,6 +51,8 @@ export class MeasurementEntity implements Entity {
|
||||
private startPoint: Point;
|
||||
private endPoint: Point;
|
||||
private offsetPoint: Point;
|
||||
/** 치수 문자 바꿈(DIMLINEAR 문자(T)) — `<>` = 잰 값 · 없으면 잰 값 */
|
||||
public textOverride?: string;
|
||||
|
||||
constructor(layerId: string, startPoint: Point, endPoint: Point, offsetPoint: Point) {
|
||||
this.layerId = layerId;
|
||||
@@ -75,6 +77,17 @@ export class MeasurementEntity implements Entity {
|
||||
this.offsetPoint = point;
|
||||
}
|
||||
|
||||
/** 잰 값(치수 소수 자릿수) */
|
||||
public getMeasuredText(): string {
|
||||
return String(round(pointDistance(this.startPoint, this.endPoint), getDimDecimals()));
|
||||
}
|
||||
|
||||
/** 보이는 치수 문자 */
|
||||
public getLabel(): string {
|
||||
const measured = this.getMeasuredText();
|
||||
return this.textOverride ? this.textOverride.replaceAll('<>', measured) : measured;
|
||||
}
|
||||
|
||||
public getDrawPoints() {
|
||||
// Return if measurement is zero length
|
||||
if (isPointEqual(this.startPoint, this.endPoint)) {
|
||||
@@ -301,7 +314,7 @@ export class MeasurementEntity implements Entity {
|
||||
drawController.drawLine(offsetStartPointMargin, offsetStartPointExtend);
|
||||
drawController.drawLine(offsetEndPointMargin, offsetEndPointExtend);
|
||||
|
||||
const distance = String(round(pointDistance(this.startPoint, this.endPoint), getDimDecimals()));
|
||||
const distance = this.getLabel();
|
||||
const originalTextDirection = normalUnit.rotate90CW();
|
||||
let finalTextDirection = originalTextDirection;
|
||||
if (
|
||||
@@ -343,12 +356,14 @@ export class MeasurementEntity implements Entity {
|
||||
}
|
||||
|
||||
public clone(): MeasurementEntity {
|
||||
return new MeasurementEntity(
|
||||
const copy = new MeasurementEntity(
|
||||
getActiveLayerId(),
|
||||
this.startPoint.clone(),
|
||||
this.endPoint.clone(),
|
||||
this.offsetPoint.clone()
|
||||
);
|
||||
copy.textOverride = this.textOverride;
|
||||
return copy;
|
||||
}
|
||||
|
||||
public intersectsWithBox(box: Box): boolean {
|
||||
@@ -416,7 +431,7 @@ export class MeasurementEntity implements Entity {
|
||||
];
|
||||
|
||||
// Calculate text properties
|
||||
const distance = String(round(pointDistance(this.startPoint, this.endPoint), getDimDecimals()));
|
||||
const distance = this.getLabel();
|
||||
const worldFactor = annotationWorldFactor();
|
||||
const textHeight = getDimTextHeight() / worldFactor;
|
||||
// Estimate width: textString.length * fontSize * aspectRatioFactor
|
||||
@@ -582,6 +597,7 @@ export class MeasurementEntity implements Entity {
|
||||
startPoint: { x: this.startPoint.x, y: this.startPoint.y },
|
||||
endPoint: { x: this.endPoint.x, y: this.endPoint.y },
|
||||
offsetPoint: { x: this.offsetPoint.x, y: this.offsetPoint.y },
|
||||
...(this.textOverride ? { textOverride: this.textOverride } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -611,6 +627,7 @@ export class MeasurementEntity implements Entity {
|
||||
measurementEntity.lineColor = jsonEntity.lineColor;
|
||||
measurementEntity.lineWidth = jsonEntity.lineWidth;
|
||||
measurementEntity.lineDash = jsonEntity.lineDash;
|
||||
measurementEntity.textOverride = jsonEntity.shapeData.textOverride;
|
||||
return measurementEntity;
|
||||
}
|
||||
}
|
||||
@@ -619,4 +636,5 @@ export interface MeasurementJsonData {
|
||||
startPoint: { x: number; y: number };
|
||||
endPoint: { x: number; y: number };
|
||||
offsetPoint: { x: number; y: number };
|
||||
textOverride?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user