- real(ANGLE_ID())->setValue(0);
- }
- }
- else if (integer(VERSION_ID())->value() > SketchPlugin_Circle::THE_VERSION_0 &&
- theID == ROTATE_ID())
- {
- // get cricle from results
- std::shared_ptr<GeomAPI_Shape> aSelection;
- ResultPtr aCircleRes = lastResult();
- if (aCircleRes)
- aSelection = aCircleRes->shape();
- if (aSelection && !aSelection->isNull() && aSelection->isEdge()) {
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aSelection));
- std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
-
- // Get point and project it on line
- std::shared_ptr<GeomDataAPI_Point2D> aNewPntRot =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(ROTATE_ID()));
- GeomPointPtr aPntRot3D = aCirc->project( sketch()->to3D(aNewPntRot->x(), aNewPntRot->y()));
-
- // Compute new angle
- GeomPointPtr aNorm = sketch()->to3D(real(RADIUS_ID())->value(), 0);
- double aStartParam, anEndParam;
- aCirc->parameter(aPntRot3D, 1.e-4, anEndParam);
- aCirc->parameter(aNorm, 1.e-4, aStartParam);
-
- bool aWasBlocked = data()->blockSendAttributeUpdated(true);
- real(ANGLE_ID())->setValue((anEndParam - aStartParam) / PI * 180.0);
- data()->blockSendAttributeUpdated(aWasBlocked, false);