Improve performance of bounding box calculation while dumping.
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95])
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190])
model.testResultsVolumes(Fillet_6, [1565.568094166])
-refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005)
+refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5)
midPoint = Fillet_6.defaultResult().shape().middlePoint()
assert(midPoint.distance(refPoint) < TOLERANCE)
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95])
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190])
model.testResultsVolumes(Fillet_6, [1565.568094166])
-refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005)
+refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5)
midPoint = Fillet_6.defaultResult().shape().middlePoint()
assert(midPoint.distance(refPoint) < TOLERANCE)
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95])
model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190])
model.testResultsVolumes(Fillet_6, [1565.568094166])
-refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005)
+refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5)
midPoint = Fillet_6.defaultResult().shape().middlePoint()
assert(midPoint.distance(refPoint) < TOLERANCE)
model.testNbSubShapes(Fillet_7, GeomAPI_Shape.EDGE, [98])
model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [196])
model.testResultsVolumes(Fillet_7, [2976.0685684791988])
-refPoint = GeomAPI_Pnt(-20.9807621135, 42.5, 5)
+refPoint = GeomAPI_Pnt(-20.9807621135, 42.806, 5)
midPoint = Fillet_7.defaultResult().shape().middlePoint()
assert(midPoint.distance(refPoint) < TOLERANCE)
model.end()
assertResult(Fillet_5)
Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True)
-REFERENCE[6] = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005)
+REFERENCE[6] = GeomAPI_Pnt(2.7448, 2.7448, 5)
NB_FACES += 6
NB_EDGES += 29
NB_VERTICES += 58
assertResult(Fillet_6)
Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS_1, RADIUS_2, keepSubResults = True)
-REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5, 5)
+REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.806, 5)
NB_FACES += 5
NB_EDGES += 26
NB_VERTICES += 52
NB_VERTICES += 24
VOLUME = 5507.602043482
REFERENCE[5] = GeomAPI_Pnt(55.041662114, 5.021870383, 5.009557179275)
-REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5, 5)
+REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5409962, 5)
assertResult(Fillet_8)
model.end()
model.begin()
Scale_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")])
REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() * SCALE_X, REFERENCE[0].y() * SCALE_Y, REFERENCE[0].z() * SCALE_Z)
-##REFERENCE[0].setX(0) # <= B-spline poles are used to calculate the bounding box and thus the middle point
+REFERENCE[0].setX(0) # <= B-spline poles are used to calculate the bounding box and thus the middle point
assertResult(Scale_1, 74139.07479)
Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z, keepSubResults = True)
subs = subsRefPoints(Compound_2.result().subResult(1))
subs[0] = GeomAPI_Pnt(subs[0].xyz().added(GeomAPI_XYZ(5, -5, 5)))
subs[0] = GeomAPI_Pnt(subs[0].x() * SCALE_X, subs[0].y() * SCALE_Y, subs[0].z() * SCALE_Z)
-##subs[0].setY(-117.3204876) # <= B-spline poles are used to calculate the bounding box and thus the middle point
+subs[0].setY(-117.3204876) # <= B-spline poles are used to calculate the bounding box and thus the middle point
subs[1] = GeomAPI_Pnt(subs[1].xyz().added(GeomAPI_XYZ(-5, 5, -5)))
REFERENCE[1] = average(subs)
assertResult(Scale_2, 78066.07487341)
REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() / SCALE_X, REFERENCE[0].y() / SCALE_Y, REFERENCE[0].z() / SCALE_Z)
subs[1] = GeomAPI_Pnt(subs[1].x() / SCALE_X, subs[1].y() / SCALE_Y, subs[1].z() / SCALE_Z)
# B-spline poles are used to calculate the bounding box and thus the middle point
-##subs[1].setX(-30.59017)
-##subs[1].setY(-2.83826244)
+subs[1].setX(-30.59017)
+subs[1].setY(-2.83826244)
REFERENCE[1] = average(subs)
REFERENCE[2] = GeomAPI_Pnt(REFERENCE[2].x() / SCALE_X, REFERENCE[2].y() / SCALE_Y, REFERENCE[2].z() / SCALE_Z)
assertResult(Scale_4, 17592.5112883)
if (aShape.IsNull())
return false;
Bnd_Box aBndBox;
- BRepBndLib::AddOptimal(aShape, aBndBox, false, true);
+ // Workaround: compute optimal bounding box for the compounds of edges/vertices, because sometimes
+ // the bounding box of sketch is calculated if the transformation is applied twice (issue #20167).
+ bool isShape1D = false;
+ if (aShape.ShapeType() == TopAbs_COMPOUND) {
+ isShape1D = true;
+ for (TopoDS_Iterator anIt(aShape); anIt.More() && isShape1D; anIt.Next())
+ if (anIt.Value().ShapeType() < TopAbs_WIRE)
+ isShape1D = false;
+ }
+ if (isShape1D)
+ BRepBndLib::AddOptimal(aShape, aBndBox, false, true);
+ else
+ BRepBndLib::Add(aShape, aBndBox, false);
if (aBndBox.IsVoid())
return false;
aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);