mirror of https://gitee.com/cf-fz/WebCAD.git
parent
bef21c2cbf
commit
848dc2fe60
@ -0,0 +1,46 @@
|
||||
import { TestDraw } from "../../Add-on/test/TestUtil";
|
||||
import { app } from "../../ApplicationServices/Application";
|
||||
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
|
||||
import { Command } from "../../Editor/CommandMachine";
|
||||
import { PromptStatus } from "../../Editor/PromptResult";
|
||||
import { AsVector2, AsVector3 } from "../../Geometry/GeUtils";
|
||||
import { HotCMD } from "../../Hot/HotCommand";
|
||||
import { InitClipperCpp } from "../Common/ClipperCpp";
|
||||
import { Path2Polyline } from "../Converter/Path2Polyline";
|
||||
import { Container } from "../Core/Container";
|
||||
import { ParseOddments } from "../Core/ParseOddments";
|
||||
import { Part } from "../Core/Part";
|
||||
import { Path } from "../Core/Path";
|
||||
|
||||
@HotCMD
|
||||
export class Command_TestParseOddments implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
InitClipperCpp();
|
||||
let ssRes = await app.Editor.GetSelection({ Filter: { filterTypes: [Polyline] } });
|
||||
if (ssRes.Status !== PromptStatus.OK) return;
|
||||
let ents = ssRes.SelectSet.SelectEntityList as Polyline[];
|
||||
|
||||
let binPath = new Path(ents[0].GetStretchPoints(), 0);
|
||||
let container = new Container();
|
||||
for (let i = 1; i < ents.length; i++)
|
||||
{
|
||||
let part = new Part();
|
||||
let path = new Path(ents[i].GetStretchPoints(), 0);
|
||||
part.Init2(path, binPath, [0]);
|
||||
part.PlacePosition = AsVector2(path.OrigionMinPoint).multiplyScalar(1e4);
|
||||
container.PlacedParts.push(part);
|
||||
}
|
||||
|
||||
let binP = AsVector3(binPath.OrigionMinPoint).multiplyScalar(1e4);
|
||||
|
||||
let odd = ParseOddments(container, binPath);
|
||||
for (let p of odd)
|
||||
{
|
||||
let pl = Path2Polyline(p.Points);
|
||||
pl.Position = AsVector3(p.OrigionMinPoint).add(binP);
|
||||
TestDraw(pl, 2);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue