开发:增加测试绘制EdgeGeometry

pull/706/MERGE
ChenX 5 years ago
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);
}
}
}
}
}
}
}

@ -1,4 +1,5 @@
import { Vector3 } from "three";
import { ActicityLayerBoard } from "../Add-on/ActivityLayerBoard";
import { AddPtOnBoard, DeletePtOnBoard } from "../Add-on/AddPtOnBoard";
import { Command_Array } from "../Add-on/Array";
import { AutoHoleFaceSetting } from "../Add-on/AutoHoleFaceSetting";
@ -78,10 +79,12 @@ import { Command_EndTempEditor } from "../Add-on/EndTempEditor";
import { Entsel } from "../Add-on/Entsel";
import { Command_Erase } from "../Add-on/Erase";
import { Command_EraseNoSelect } from "../Add-on/EraseNoSelect";
import { ChaiDan, ShoWYouHua, ChaiDanJB } from "../Add-on/Erp/ErpCommands";
import { ChaiDan, ChaiDanJB, ShoWYouHua } from "../Add-on/Erp/ErpCommands";
import { Command_Esc } from "../Add-on/Esc";
import { Command_Explode } from "../Add-on/Explode";
import { Command_ExplosionMap } from "../Add-on/ExplosionMap";
import { Command_ExportView } from "../Add-on/Export2View";
import { Command_ExportData } from "../Add-on/ExportData";
import { Command_Extend } from "../Add-on/Extends";
import { CommandFillet } from "../Add-on/Fillet";
import { Command_Group } from "../Add-on/Group";
@ -99,6 +102,7 @@ import { Fbx } from "../Add-on/loadfbx";
import { LookOverBoardInfos } from "../Add-on/LookOverBoardInfos";
import { MirrorCommand } from "../Add-on/Mirror";
import { Command_Move } from "../Add-on/Move";
import { Command_M0 } from "../Add-on/MoveToWCS0";
import { Command_DynOffset, Command_DynOffsetToolPath, Command_Offset } from "../Add-on/Offset";
import { OffsetX } from "../Add-on/OffsetX";
import { Open } from "../Add-on/Open";
@ -130,6 +134,7 @@ import { Test } from "../Add-on/testEntity/test";
import { Command_TestBox } from "../Add-on/testEntity/TestBox";
import { TestCollision } from "../Add-on/testEntity/testCollision";
import { TestTargeOnCurve } from "../Add-on/testEntity/TestCurve";
import { Command_TestDrawEdgeGeometry } from "../Add-on/testEntity/TestDrawEdgeGeometry";
import { TestFillet } from "../Add-on/testEntity/TestFilletCode";
import { Command_DeleteTemplate } from "../Add-on/testEntity/TestTemplateDelete";
import { TestFb } from "../Add-on/TestFb";
@ -143,13 +148,9 @@ import { CommandServer } from '../DatabaseServices/CommandServer';
import { Command_TestNFP } from "../Nest/Test/TestNFP";
import { Command_TestPlace } from "../Nest/Test/TestPlace";
import { Command_TestSimply } from "../Nest/Test/TestSimply";
import { Command_TestYHWorker } from "../Nest/Test/TestYH3";
import { ICommand } from '../UI/Components/CommandPanel/CommandList';
import { commandMachine } from './CommandMachine';
import { Command_ExportData } from "../Add-on/ExportData";
import { Command_TestYHWorker } from "../Nest/Test/TestYH3";
import { Command_ExportView } from "../Add-on/Export2View";
import { ActicityLayerBoard } from "../Add-on/ActivityLayerBoard";
import { Command_M0 } from "../Add-on/MoveToWCS0";
export function registerCommand()
{
@ -394,6 +395,7 @@ export function registerCommand()
commandMachine.RegisterCommand("templateDelete", new Command_DeleteTemplate());
commandMachine.RegisterCommand("templatecheck", new Command_TemplateSearch(true));
//优化算法
commandMachine.RegisterCommand("testNFP", new Command_TestNFP());
commandMachine.RegisterCommand("testSimply", new Command_TestSimply());
commandMachine.RegisterCommand("testPlace", new Command_TestPlace());
@ -405,10 +407,13 @@ export function registerCommand()
commandMachine.RegisterCommand("drilltemplate", new ShowDrillingTemplate());
commandMachine.RegisterCommand("checkmodeing", new CheckModeling());
//导出数据
commandMachine.RegisterCommand("exportdata", new Command_ExportData());
commandMachine.RegisterCommand("exportview", new Command_ExportView());
//测试csg
commandMachine.RegisterCommand("TestDrawEdgeGeometry", new Command_TestDrawEdgeGeometry());
RegistCustomCommand();
}

Loading…
Cancel
Save