Rotate DrawViewPart around part centroid

This commit is contained in:
WandererFan
2017-10-19 20:17:11 -04:00
parent 03f439caf7
commit 44fd200166
10 changed files with 89 additions and 15 deletions

View File

@@ -561,6 +561,32 @@ TopoDS_Shape TechDrawGeometry::mirrorShape(const TopoDS_Shape &input,
return transShape;
}
//!rotates a shape about a viewAxis
TopoDS_Shape TechDrawGeometry::rotateShape(const TopoDS_Shape &input,
gp_Ax2& viewAxis,
double rotAngle)
{
TopoDS_Shape transShape;
if (input.IsNull()) {
return transShape;
}
gp_Ax1 rotAxis = viewAxis.Axis();
double rotation = rotAngle * M_PI/180.0;
try {
gp_Trsf tempTransform;
tempTransform.SetRotation(rotAxis,rotation);
BRepBuilderAPI_Transform mkTrf(input, tempTransform);
transShape = mkTrf.Shape();
}
catch (...) {
Base::Console().Log("GeometryObject::rotateShape - rotate failed.\n");
return transShape;
}
return transShape;
}
//!scales a shape about a origin
TopoDS_Shape TechDrawGeometry::scaleShape(const TopoDS_Shape &input,
double scale)