From 423e8a23d6f56a77d466a49183a38301d13ab00d Mon Sep 17 00:00:00 2001 From: ChenX Date: Mon, 13 Mar 2023 11:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=E6=9D=BF=E5=86=85=E7=9A=84?= =?UTF-8?q?=E5=B0=8F=E7=9A=84=E5=85=A8=E8=BA=AB=E6=B4=9E(30*30=E4=BB=A5?= =?UTF-8?q?=E4=B8=8B)=E4=B8=8D=E5=86=8D=E5=BD=B1=E5=93=8D=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=9A=84=E9=9D=9E=E5=85=A8=E6=B7=B1=E6=B4=9E=E7=9A=84?= =?UTF-8?q?=E8=B5=B0=E5=88=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/Geometry/EdgeGeometry.test.ts | 3 +++ src/DatabaseServices/Entity/Extrude.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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);