!3059 优化:双击多段线功能栏增加简化多段线

pull/3060/MERGE
林三 4 weeks ago committed by ChenX
parent bed18c4c75
commit f83e45e12a

@ -28,20 +28,25 @@ export class Command_SimplifyPolyline implements Command
if (ssRes.Status !== PromptStatus.OK) return; if (ssRes.Status !== PromptStatus.OK) return;
let pls = ssRes.SelectSet.SelectEntityList as Polyline[]; let pls = ssRes.SelectSet.SelectEntityList as Polyline[];
let count = 0; SimplifyPolyline(pls);
for (let pl of pls) }
}
export function SimplifyPolyline(pls: Polyline[])
{
let count = 0;
for (let pl of pls)
{
let npl = SmartPolylineSimply2Polyline(pl);
if (npl && npl.EndParam < pl.EndParam)
{ {
let npl = SmartPolylineSimply2Polyline(pl); pl.Erase();
if (npl && npl.EndParam < pl.EndParam) app.Database.ModelSpace.Append(npl);
{
pl.Erase();
app.Database.ModelSpace.Append(npl);
Log(`简化成功!${pl.EndParam} -> ${npl.EndParam}`); Log(`简化成功!${pl.EndParam} -> ${npl.EndParam}`);
count++; count++;
}
} }
Log(`成功简化了${count}条多段线!`);
} }
Log(`成功简化了${count}条多段线!`);
} }

@ -1,3 +1,4 @@
import { SimplifyPolyline } from "../../Add-on/testEntity/TestPolyline2PointsPolyline";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { arraySortByNumber } from "../../Common/ArrayExt"; import { arraySortByNumber } from "../../Common/ArrayExt";
import { curveLinkGroup } from "../../Common/CurveUtils"; import { curveLinkGroup } from "../../Common/CurveUtils";
@ -30,7 +31,7 @@ export class DBClickPolyline extends Singleton
{ key: "J", msg: "合并" }, { key: "J", msg: "合并" },
{ key: "E", msg: "编辑顶点" }, { key: "E", msg: "编辑顶点" },
// { key: "F", msg: "拟合" }, // { key: "F", msg: "拟合" },
// { key: "S", msg: "样条曲线" }, { key: "S", msg: "简化多段线" },
{ key: "D", msg: "非曲线化" }, { key: "D", msg: "非曲线化" },
{ key: "R", msg: "反转" }, { key: "R", msg: "反转" },
{ key: "U", msg: "放弃" } { key: "U", msg: "放弃" }
@ -76,6 +77,9 @@ export class DBClickPolyline extends Singleton
execStatus = await this.EditorVertex(); execStatus = await this.EditorVertex();
JigUtils.Destroy(); JigUtils.Destroy();
break; break;
case "S": //简化多段线
SimplifyPolyline([pl]);
return;
case "D": //非曲线化 case "D": //非曲线化
this.TransfromNonCurve(); this.TransfromNonCurve();
break; break;

Loading…
Cancel
Save