|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
import Flatbush from 'flatbush';
|
|
|
|
|
import { Box3, BufferGeometry, Float32BufferAttribute, MathUtils, Matrix4, Shape as TShape, ShapeUtils, Vector3 } from "three";
|
|
|
|
|
import { arrayPushArray, arrayRemoveDuplicateBySort, arraySortByNumber } from "../../Common/ArrayExt";
|
|
|
|
|
import { curveLinkGroup } from "../../Common/CurveUtils";
|
|
|
|
|
import { ComputerCurvesNormalOCS, curveLinkGroup } from "../../Common/CurveUtils";
|
|
|
|
|
import { Status } from '../../Common/Status';
|
|
|
|
|
import { FixIndex } from "../../Common/Utils";
|
|
|
|
|
import { FuzzyFactory } from '../../csg/core/FuzzyFactory';
|
|
|
|
|
import { Contour, fastCurveInCurve2 } from "../../DatabaseServices/Contour";
|
|
|
|
@ -355,14 +356,43 @@ class EdgeGeometryBuild
|
|
|
|
|
let lines = arr[index];
|
|
|
|
|
let parse = new RegionParse(lines, 2);
|
|
|
|
|
let contourNodes: ContourTreeNode[] = [];
|
|
|
|
|
|
|
|
|
|
//对于未被面域分析出来的线,我们进行join操作
|
|
|
|
|
let unusedLines: Line[] = [];
|
|
|
|
|
for (let l of lines)
|
|
|
|
|
if (!parse.GetCueveUsed(l))
|
|
|
|
|
unusedLines.push(l);
|
|
|
|
|
if (unusedLines.length)
|
|
|
|
|
{
|
|
|
|
|
let groups = curveLinkGroup(unusedLines, 1);
|
|
|
|
|
for (let g of groups)
|
|
|
|
|
{
|
|
|
|
|
let pl = new Polyline();
|
|
|
|
|
pl.ColorIndex = g[0].ColorIndex;
|
|
|
|
|
pl.OCS = ComputerCurvesNormalOCS(g);
|
|
|
|
|
for (let cu of g)
|
|
|
|
|
{
|
|
|
|
|
if (pl.Join(cu, false, 0.1) === Status.True)
|
|
|
|
|
cu.Erase();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pl.CloseMark = true;
|
|
|
|
|
let c = Contour.CreateContour(pl, false) ?? CreateContour2(pl.Explode(), 0.1);;
|
|
|
|
|
if (c)
|
|
|
|
|
contourNodes.push(new ContourTreeNode(c));
|
|
|
|
|
else
|
|
|
|
|
console.error("错误:构建板件的MeshGeometry的盖子生成轮廓失败了!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let routes of parse.RegionsOutline)
|
|
|
|
|
{
|
|
|
|
|
let cs: Curve[] = routes.map(r => r.curve);
|
|
|
|
|
let c = Contour.CreateContour(cs, false) ?? CreateContour2(cs);
|
|
|
|
|
let c = Contour.CreateContour(cs, false) ?? CreateContour2(cs) ?? CreateContour2(cs, 0.1);
|
|
|
|
|
if (c)
|
|
|
|
|
contourNodes.push(new ContourTreeNode(c));
|
|
|
|
|
else
|
|
|
|
|
console.error("未能构建盖子");
|
|
|
|
|
console.error("错误:构建板件的MeshGeometry的盖子生成轮廓失败了!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContourTreeNode.ParseContourTree(contourNodes);
|
|
|
|
|