From 03ae65653f538978ca93b1222a2fd02ed9244c4f Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 11 Sep 2018 12:22:10 +0300 Subject: [PATCH] Issue #2623: Ability to modify the radius of circles and arcs of circle with the mouse --- CMakeLists.txt | 2 +- src/SketchPlugin/Test/TestMoveArc.py | 8 ++++---- src/SketchPlugin/Test/TestMovementComplex.py | 13 +++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd2b1bdee..05dd7e3f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ ELSE(${HAVE_SALOME}) ENDIF(${HAVE_SALOME}) # Sketcher: Change radius of circular edges while dragging a point on the edge -SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE FALSE) +SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE) ADD_SUBDIRECTORY (src/Config) ADD_SUBDIRECTORY (src/Events) diff --git a/src/SketchPlugin/Test/TestMoveArc.py b/src/SketchPlugin/Test/TestMoveArc.py index 53c49dcab..e9f5f73b4 100644 --- a/src/SketchPlugin/Test/TestMoveArc.py +++ b/src/SketchPlugin/Test/TestMoveArc.py @@ -51,17 +51,17 @@ class TestMoveArc(unittest.TestCase): self.assertEqual(model.dof(self.mySketch), self.myDOF) def checkPointCoordinates(self, thePoint, theCoordinates): - self.assertAlmostEqual(thePoint.x(), theCoordinates[0]) - self.assertAlmostEqual(thePoint.y(), theCoordinates[1]) + self.assertAlmostEqual(thePoint.x(), theCoordinates[0], 6) + self.assertAlmostEqual(thePoint.y(), theCoordinates[1], 6) def checkPointOnArc(self, theCoordinates): distPC = model.distancePointPoint(self.myArc.center(), theCoordinates) radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) - self.assertAlmostEqual(distPC, radius) + self.assertAlmostEqual(distPC, radius, 6) def checkArcRadius(self): radius = model.distancePointPoint(self.myArc.center(), self.myArc.startPoint()) - self.assertAlmostEqual(radius, self.myRadius) + self.assertAlmostEqual(radius, self.myRadius, 6) def fixArcRadius(self): self.myRadius = 20. diff --git a/src/SketchPlugin/Test/TestMovementComplex.py b/src/SketchPlugin/Test/TestMovementComplex.py index 59133d7f3..228f50427 100644 --- a/src/SketchPlugin/Test/TestMovementComplex.py +++ b/src/SketchPlugin/Test/TestMovementComplex.py @@ -340,10 +340,11 @@ model.do() Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchCircle_2_2r-SketchArc_2_2r-SketchLine_13r-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchLine_16r")], model.selection(), -165, 155) Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Boolean_1_1/Modified_8")) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face_2")) SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0) -SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "Boolean_1_1/Modified_7&Boolean_1_1/Modified_6&Boolean_1_1/Modified_2")) -SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchPoint_2.result()) +SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "Fuse_1_1/Modified_Face_divided_6_1&Fuse_1_1/Modified_Face_3&Fuse_1_1/Modified_Face_divided_5_1")) +SketchPoint_2 = SketchProjection_2.createdFeature() +SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result()) SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20) SketchLine_19 = Sketch_3.addLine(165, -20, 145, -20) SketchLine_20 = Sketch_3.addLine(145, -20, 145, 0) @@ -364,12 +365,12 @@ SketchArc_5 = Sketch_3.addArc(145, -20, 155, -20, 145, -10, False) SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_5.center()) SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_20.result(), SketchArc_5.endPoint()) SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_5.startPoint(), SketchLine_19.result()) -SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "Boolean_1_1/Modified_12&Boolean_1_1/Modified_11")) +SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "Fuse_1_1/Modified_Face_4&Fuse_1_1/Modified_Face_divided_2_1")) SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result()) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_17r-SketchLine_18r-SketchArc_4_2r")], model.selection(), model.selection("FACE", "Boolean_1_1/Modified_5"), 0, model.selection(), 0, [model.selection("SOLID", "Boolean_1_1")]) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_20r-SketchArc_4_2f-SketchArc_5_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_17r-SketchLine_18r-SketchArc_4_2r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face_divided_1_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_20r-SketchArc_4_2f-SketchArc_5_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) model.do() model.end() -- 2.39.2