|
|
|
@ -2,7 +2,9 @@ import { app } from "../ApplicationServices/Application";
|
|
|
|
|
import { Polyline } from "../DatabaseServices/Polyline";
|
|
|
|
|
import { Command } from "../Editor/CommandMachine";
|
|
|
|
|
import { PromptStatus } from "../Editor/PromptResult";
|
|
|
|
|
import { Vector3 } from "three";
|
|
|
|
|
|
|
|
|
|
const autoDis = true;
|
|
|
|
|
|
|
|
|
|
//无限内偏移
|
|
|
|
|
export class OffsetX implements Command
|
|
|
|
@ -15,25 +17,36 @@ export class OffsetX implements Command
|
|
|
|
|
let pl = ssRes.Entity as Polyline;
|
|
|
|
|
if (!pl) return;
|
|
|
|
|
|
|
|
|
|
let disRes = await app.m_Editor.GetDistance({
|
|
|
|
|
Msg: "指定偏移距离:",
|
|
|
|
|
KeyWordList: [{ msg: "通过", key: "T" }],
|
|
|
|
|
Default: this.offsetDis
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (disRes.Status != PromptStatus.OK) return;
|
|
|
|
|
this.offsetDis = disRes.Value;
|
|
|
|
|
let dis = -this.offsetDis;
|
|
|
|
|
if (pl.IsClockWise) dis = -dis;
|
|
|
|
|
|
|
|
|
|
let disRes1 = await app.m_Editor.GetDistance({
|
|
|
|
|
Msg: "步长:",
|
|
|
|
|
KeyWordList: [{ msg: "通过", key: "T" }],
|
|
|
|
|
Default: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (disRes1.Status != PromptStatus.OK) return;
|
|
|
|
|
let step = disRes1.Value;
|
|
|
|
|
let dis: number, step: number;
|
|
|
|
|
|
|
|
|
|
if (autoDis)
|
|
|
|
|
{
|
|
|
|
|
this.offsetDis = 1.2 * Math.max(...pl.BoundingBox.getSize(new Vector3()).toArray());
|
|
|
|
|
dis = -this.offsetDis;
|
|
|
|
|
step = this.offsetDis / 20;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let disRes = await app.m_Editor.GetDistance({
|
|
|
|
|
Msg: "指定偏移距离:",
|
|
|
|
|
KeyWordList: [{ msg: "通过", key: "T" }],
|
|
|
|
|
Default: this.offsetDis
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (disRes.Status != PromptStatus.OK) return;
|
|
|
|
|
this.offsetDis = disRes.Value;
|
|
|
|
|
dis = -this.offsetDis;
|
|
|
|
|
if (pl.IsClockWise) dis = -dis;
|
|
|
|
|
|
|
|
|
|
let disRes1 = await app.m_Editor.GetDistance({
|
|
|
|
|
Msg: "步长:",
|
|
|
|
|
KeyWordList: [{ msg: "通过", key: "T" }],
|
|
|
|
|
Default: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (disRes1.Status != PromptStatus.OK) return;
|
|
|
|
|
step = disRes1.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// let step = 0.5;
|
|
|
|
|
let offRes: Polyline[] = [];
|
|
|
|
|