mirror of https://gitee.com/cf-fz/WebCAD.git
parent
b0a4fae195
commit
3635227ce7
@ -0,0 +1,50 @@
|
||||
import { Vector3 } from "three";
|
||||
import { app } from "../../ApplicationServices/Application";
|
||||
import { Board } from "../../DatabaseServices/Entity/Board";
|
||||
import { Line } from "../../DatabaseServices/Entity/Line";
|
||||
import { Command } from "../../Editor/CommandMachine";
|
||||
import { PromptStatus } from "../../Editor/PromptResult";
|
||||
import { HotCMD } from "../../Hot/HotCommand";
|
||||
import { TestDraw } from "../test/TestUtil";
|
||||
|
||||
@HotCMD
|
||||
export class Command_TestDrawEdgeGeometry implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
let enRes = await app.Editor.GetSelection({});
|
||||
|
||||
if (enRes.Status === PromptStatus.OK)
|
||||
{
|
||||
let en = enRes.SelectSet.SelectEntityList;
|
||||
|
||||
for (let e of en)
|
||||
{
|
||||
if (e instanceof Board)
|
||||
{
|
||||
{
|
||||
//@ts-ignore
|
||||
let mesh = e.EdgeGeometry;
|
||||
|
||||
let pts = mesh.attributes.position.array as number[];
|
||||
let count = mesh.attributes.position.count;
|
||||
|
||||
let ps: Vector3[] = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
let p = new Vector3(pts[i * 3], pts[i * 3 + 1], pts[i * 3 + 2]);
|
||||
ps.push(p);
|
||||
}
|
||||
|
||||
count = ps.length / 2;
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
let l = new Line(ps[i * 2], ps[i * 2 + 1]);
|
||||
TestDraw(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue