修改偏移的交互.

pull/68/head
ChenX 6 years ago
parent 9789a03ebb
commit 1504a9c9f1

@ -72,7 +72,7 @@ export class Command_TestOffset implements Command
{
if (lastpls) lastpls.forEach(cu => cu.Erase());
let dir = GetPointAtCurveDir(cu, p) ? 1 : -1
lastpls = cu.GetOffsetCurves(p.distanceTo(cu.GetClosestPointTo(p, !cu.IsClose)) * dir);
lastpls = cu.GetOffsetCurves(p.distanceTo(cu.GetClosestPointTo(p, false)) * dir);
lastpls.forEach((offCur) =>
{

@ -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[] = [];

Loading…
Cancel
Save