!2514 修复:二维刀路板的模板在编辑更新后二维刀路消失问题

pull/2517/head
黄诗津 10 months ago committed by ChenX
parent 2126545fc0
commit 2f20471de0

@ -6,8 +6,10 @@ import { HostApplicationServices } from "../ApplicationServices/HostApplicationS
import { ExtrudeHole } from "../DatabaseServices/3DSolid/ExtrudeHole";
import { CADFiler } from "../DatabaseServices/CADFiler";
import { Database } from "../DatabaseServices/Database";
import { Board } from "../DatabaseServices/Entity/Board";
import { Entity } from "../DatabaseServices/Entity/Entity";
import { Polyline } from "../DatabaseServices/Entity/Polyline";
import { IdMaping } from "../DatabaseServices/IdMaping";
import { PhysicalMaterialRecord } from "../DatabaseServices/PhysicalMaterialRecord";
import { TemplateParam } from "../DatabaseServices/Template/Param/TemplateParam";
import { TemplateRecord } from "../DatabaseServices/Template/TemplateRecord";
@ -16,7 +18,7 @@ import { RenderType } from "../GraphicsSystem/RenderType";
import { userConfig } from './../Editor/UserConfig';
import { DisposeThreeObj } from "./Dispose";
import { uploadLogo } from "./Request";
import { DuplicateRecordCloning } from "./Status";
import { DuplicateRecordCloning, UpdateDraw } from "./Status";
import { AAType } from "./SystemEnum";
export function MaterialOut(material: PhysicalMaterialRecord): string
@ -39,13 +41,39 @@ export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord
return db.MaterialTable.Symbols.entries().next().value[1];
}
export function TemplateOut(template: TemplateRecord, tempDb = new Database(false, false, true)): string
export async function TemplateOut(template: TemplateRecord, tempDb = new Database(false, false, true)): Promise<string>
{
template = template.Root;
let idMap = new Map();
tempDb.WblockCloneObejcts([template], tempDb.TemplateTable, idMap, DuplicateRecordCloning.Ignore);
Purge(tempDb);
let idMapRev: IdMaping = new Map();
for (let [k, v] of idMap) idMapRev.set(v, k);
let async2DPathingPromis = [];
for (const ent of tempDb.ModelSpace.Entitys)
{
if (idMapRev.has(ent.Id))
{
let oldEnt = idMapRev.get(ent.Id).Object as Entity;
if (oldEnt instanceof Board && oldEnt.Async2DPathing)
{
async2DPathingPromis.push(
oldEnt.Load2DPathIng().then((res) =>
{
ent.CloneDrawObject(oldEnt);
})
);
}
else
ent.CloneDrawObject(oldEnt);
ent.NeedUpdateFlag = UpdateDraw.Matrix;
}
}
await Promise.all(async2DPathingPromis);
let scs = template.GetTemplateRealitySpaceCS();
let scsInv = new Matrix4().getInverse(scs);

@ -1606,11 +1606,21 @@ export class Board extends ExtrudeSolid
protected get Has2DPath() { return this._2DModelingList.length > 0; }
private _workerCalcedGeom: Geom3 = null;//worker计算后,暂时存入到这里
private _async2DPathIng = false;
get Async2DPathing() { return this._async2DPathIng; }
override GoodBye(): void
{
super.GoodBye();
TerminateCSGTask({ key: this });
}
private promise2DPath: (res: boolean) => void;
async Load2DPathIng()
{
return new Promise<boolean>((res) =>
{
this.promise2DPath = res;
});
}
//del_exp2_start
//二维刀路切割后返回几何体
override UpdateMeshGeom(geo: Geometry): BufferGeometry
@ -1648,6 +1658,12 @@ export class Board extends ExtrudeSolid
this.MeshGeometry;//保证刷新这个
this._workerCalcedGeom = null;
if (this.promise2DPath)
{
this.promise2DPath(true);
this.promise2DPath = null;
}
}
};

@ -966,7 +966,7 @@ function GetFilletDataByPath2D(br: Board, point: Vector3, brParamMap: Map<Extrud
async function GeneralTempateData(template: TemplateRecord, bUploadLogo = true)
{
let tempDb = new Database(false, false, true);
let json = TemplateOut(template, tempDb);
let json = await TemplateOut(template, tempDb);
let logo = bUploadLogo ? await GetEntitysLogo(tempDb.ModelSpace.Entitys, true) : "";

Loading…
Cancel
Save