Prevent Loop in BRepBuilderAPI_Transform

- if a scale transform with scale = 0 is passed to
  BRepBuilderAPI_Transform, it will loop forever.
  If Page.keepUpdated is false, and Views have not yet
  been executed (ex at load time), Views will have a
  0.0 x 0.0 bbox and if Autoscale is true, a scale of
  0.0 will be used in fit-to-page.
This commit is contained in:
WandererFan
2018-02-01 15:46:01 -05:00
parent 1402e39ba0
commit 356f879659
5 changed files with 24 additions and 2 deletions

View File

@@ -626,12 +626,16 @@ TopoDS_Shape TechDrawGeometry::mirrorShape(const TopoDS_Shape &input,
if (input.IsNull()) {
return transShape;
}
try {
// Make tempTransform scale the object around it's centre point and
// mirror about the Y axis
gp_Trsf tempTransform;
tempTransform.SetScale(inputCenter, scale);
//BRepBuilderAPI_Transform will loop forever if asked to use 0.0 as scale
if (!(scale > 0.0)) {
tempTransform.SetScale(inputCenter, 1.0);
} else {
tempTransform.SetScale(inputCenter, scale);
}
gp_Trsf mirrorTransform;
mirrorTransform.SetMirror( gp_Ax2(inputCenter, gp_Dir(0, -1, 0)) );
tempTransform.Multiply(mirrorTransform);