优化:面域命令删除使用过的曲线,板造型显示修复

pull/2243/MERGE
ChenX 1 year ago
parent f7d07a8e75
commit 6de2245ccd

1
.gitignore vendored

@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.history
.idea
# Runtime data
pids

File diff suppressed because one or more lines are too long

@ -48,6 +48,10 @@ exports[`Geometry构建测试 19`] = `2088`;
exports[`Geometry构建测试 20`] = `876`;
exports[`无法构造盖子轮廓导致的丢面 1`] = `9423`;
exports[`无法构造盖子轮廓导致的丢面 2`] = `6336`;
exports[`有全深槽时,构建的Mesh错误 1`] = `1008`;
exports[`有全深槽时,构建的Mesh错误 2`] = `390`;

@ -59,11 +59,7 @@ export class DrawRegion implements Command
{
let reg = new RegionParse(lines, 3);
for (let routes of reg.RegionsOutline)
this.DrawRegion(routes);
for (let routes of reg.RegionsInternal)
this.DrawRegion(routes);
//提前标记删除,避免修改了TempData后删除不掉
for (let cu of cus)
{
if (reg.GetCueveUsed(cu))
@ -72,6 +68,11 @@ export class DrawRegion implements Command
cu.ApplyMatrix(this.ocs);
}
for (let routes of reg.RegionsOutline)
this.DrawRegion(routes);
for (let routes of reg.RegionsInternal)
this.DrawRegion(routes);
for (let [, cus] of reg.ExpLineMap)
{
for (let c of cus)

@ -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);

@ -69,6 +69,7 @@ export class RegionParse
//直接remove,不用计算引用个数
for (let w of minWalk)
{
w.curve.TempData = 2;
this.RemoveEdge(w);
this.RemoveFilamentAt(w.from, vertices);
this.RemoveFilamentAt(w.to, vertices);

Loading…
Cancel
Save