优化:插入模块时异步和进度条

pull/1470/head
ChenX 4 years ago
parent 23d6daae0e
commit 86fcd6ccfe

@ -1,5 +1,6 @@
import { Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { Sleep } from "../Common/Sleep";
import { DuplicateRecordCloning } from "../Common/Status";
import { CADFiler } from "../DatabaseServices/CADFiler";
import { Database } from "../DatabaseServices/Database";
@ -12,6 +13,7 @@ import { PromptStatus } from "../Editor/PromptResult";
import { MoveMatrix } from "../Geometry/GeUtils";
import { InsertModal } from "../UI/Components/Modal/InsertModal";
import { ModalState } from "../UI/Components/Modal/ModalInterface";
import { DownPanelStore } from "../UI/Store/DownPanelStore";
export class Command_Insert implements Command
{
@ -45,7 +47,25 @@ export class Command_Insert implements Command
if (db.ModelSpace.Entitys.length > 0)
{
let ensClone = db.ModelSpace.Entitys.map(e => JigUtils.Draw(e));
const down = DownPanelStore.GetInstance() as DownPanelStore;
let ens = db.ModelSpace.Entitys as Entity[];
let ensClone: Entity[] = [];
for (let i = 0; i < ens.length; i++)
{
let e = ens[i];
let newE = JigUtils.Draw(e);
ensClone.push(newE);
if (i % 50 === 0)
{
down.progress = 0.1 + i / ens.length;
await Sleep(0);
}
}
down.progress = 1;
let ptLast = new Vector3();
let ptRes = await app.Editor.GetPoint(
{

Loading…
Cancel
Save