修复:避免二维刀路建模异常导致图形丢失

pull/2557/head
ChenX 9 months ago
parent c24c18f74d
commit 318c4b4829

@ -11,6 +11,7 @@ import { retessellate } from "@jscad/modeling/src/operations/modifiers";
import { Matrix4, Object3D, Vector3 } from "three";
import { FaceDirection } from "../../Add-on/DrawDrilling/DrillType";
import { arrayLast } from "../../Common/ArrayExt";
import { Log, LogType } from "../../Common/Log";
import { MakeMirrorMtx, Vector2ApplyMatrix4, ZMirrorMatrix } from "../../Common/Matrix4Utils";
import { FixIndex } from "../../Common/Utils";
import { Arc } from "../../DatabaseServices/Entity/Arc";
@ -38,6 +39,7 @@ export function Board2DModelCSGBuilder(board: Board)
//端点geom3缓存
let pathGripsSet = new Set();
let hasError = false;
for (let vm of board.Modeling2D)
{
@ -66,9 +68,18 @@ export function Board2DModelCSGBuilder(board: Board)
let normalAngle = 2 * Math.PI;
if (rAngle && i === 1)
normalAngle = rAngle;
rotateGeom = extrudeRotate({ segments: 8, angle: normalAngle }, knifeGeom);
rotateGeom = retessellate(rotateGeom);
geom3Cache.set(id, rotateGeom);
try
{
rotateGeom = extrudeRotate({ segments: 8, angle: normalAngle }, knifeGeom);
rotateGeom = retessellate(rotateGeom);
geom3Cache.set(id, rotateGeom);
}
catch (error)
{
hasError = true;
return;
}
}
// TestDrawGeom3s([rotateGeom]);
let rMtx: Matrix4;
@ -366,6 +377,10 @@ export function Board2DModelCSGBuilder(board: Board)
}
}
}
if (hasError)
Log(`板:${board.Name} 二维刀路建模异常!`, LogType.Error, [board]);
return _2DPathCsgs;
}

Loading…
Cancel
Save