diff --git a/__test__/Geometry/EdgeGeometry.test.ts b/__test__/Geometry/EdgeGeometry.test.ts index e6148bdb8..6915e4b9d 100644 --- a/__test__/Geometry/EdgeGeometry.test.ts +++ b/__test__/Geometry/EdgeGeometry.test.ts @@ -112,3 +112,6 @@ test('有全深槽时,构建的Mesh错误', () => expect(builder.edgeAndLidBuilder.lineVerticesArray.length).toMatchSnapshot(); } }); + +// +//{"file":[1,"Board",10,2,186,0,1,3,71,[1,0,0,0,0,0,1,0,0,-1,0,0,483.14082719043313,13.689025306123199,0,1],0,0,1,[1,0,0,0,0,1,0,0,0,0,1,0,-298.8591728095664,-284.3109746938768,0,1],0,0,1,3,121.24601483164042,97.9004594467101,18,true,"Polyline",10,2,0,0,0,7,71,[1,0,2.030561952816011e-30,0,4.5087532658883125e-46,1,-2.220446049250313e-16,0,-2.030561952816011e-30,2.220446049250313e-16,1,0,0,0,2.6645352591003757e-14,1],0,0,1,[1,0,0,0,0,0,-1,0,0,1,0,0,-616.8365854462929,4.729723383396163,2.6645352591003757e-14,1],0,0,1,2,4,[97.9004594467101,121.24601483164042],0,[7.958078640513122e-13,121.24601483163951],0,[0,0],0,[97.90045944670942,0],0,true,2,3,17.53791742793169,17.53791742793169,5,false,"Circle",10,2,0,0,0,1,71,[1,0,0,0,0,1,0,0,0,0,1,0,8.768958713965844,8.768958713965844,0,1],0,0,1,[1,0,0,0,0,1,0,0,0,0,1,0,-2258.0325228168194,-816.6695956959304,1.9667822925839573e-11,1],0,0,1,1,8.768958713965844,0,3,0,0,0,0,0,[1,0,0,0,0,0,1,0,0,-1,0,0,518.2608331537249,0.6890253061231988,48.76970415382985,1],3,11.527154383958326,21.24289879329467,18,true,"Polyline",10,2,0,0,0,7,71,[1,0,0,0,0,1,0,0,0,0,1,0,0,11.527154383958326,0,1],0,0,1,[1,0,0,0,0,0,-1,0,0,1,0,0,-650.2917132537983,-47.319343025706445,0,1],0,0,1,2,4,[21.24289879329467,-11.527154383958326],0,[21.24289879329467,0],0,[0,0],0,[0,-11.527154383958326],0,true,0,3,0,0,0,0,0,[1,0,0,0,0,0,1,0,0,-1,0,0,516.5959549979385,13.689025306123172,52.04906640910261,1],3,0,0,0,0,0,11,2,"背板","","","","多层板","盛橡木多层板",0,1,"无效配置",2,0,"1","0","1","1","","","",4,"无效配置","无效配置","无效配置","无效配置",true,true,0,0,0,0,0,0,0,0,true,0,0,null],"basePt":{"x":483.14082719043313,"y":-4.310974693876801,"z":0},"ucs":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]} diff --git a/src/DatabaseServices/Entity/Extrude.ts b/src/DatabaseServices/Entity/Extrude.ts index 88d786dc3..22fa7c4ce 100644 --- a/src/DatabaseServices/Entity/Extrude.ts +++ b/src/DatabaseServices/Entity/Extrude.ts @@ -525,7 +525,9 @@ export class ExtrudeSolid extends Entity /** * 这个拉伸实体的面域形状 */ - get Shape() + get Shape() { return this.GetShape(false); } + + private GetShape(filterSmallGroove = false) { let contour = Contour.CreateContour(this.ContourCurve.Clone(), false); @@ -533,7 +535,7 @@ export class ExtrudeSolid extends Entity for (let g of this.grooves) { - if (equaln(g.thickness, this.thickness, 1e-3)) + if (equaln(g.thickness, this.thickness, 1e-3) && (!filterSmallGroove || g.ContourCurve.Area > 900)) holes.push(Contour.CreateContour(g.ContourCurve.Clone().ApplyMatrix(this.OCSInv.multiply(g.OCSNoClone)), false)); } return new Shape(contour, holes); @@ -1349,7 +1351,8 @@ export class ExtrudeSolid extends Entity let matrixToTarget = groove.OCSInv.multiply(this.OCS); matrixToTarget.elements[14] = 0;//z->0 - let thisShape = this.Shape.ApplyMatrix(matrixToTarget); + //理论上只有大洞才需要优化,小洞无所谓了 + let thisShape = this.GetShape(true).ApplyMatrix(matrixToTarget); let targetShape = new Shape(Contour.CreateContour([groove.ContourCurve.Clone()], false)); let inters = thisShape.IntersectionBoolOperation(targetShape);