def test_add_cricle(self):
circle = self.sketch.addCircle(0, 10, 20)
model.do()
- self.assertEqual(circle.centerData().x(), 0.0)
- self.assertEqual(circle.centerData().y(), 10.0)
- self.assertEqual(circle.radiusData().value(), 20.0)
+ self.assertEqual(circle.center().x(), 0.0)
+ self.assertEqual(circle.center().y(), 10.0)
+ self.assertEqual(circle.radius(), 20.0)
def test_modify_circle(self):
circle = self.sketch.addCircle(0, 10, 20)
circle.setCenter(10, 10)
circle.setRadius(30)
model.do()
- self.assertEqual(circle.centerData().x(), 10.0)
- self.assertEqual(circle.centerData().y(), 10.0)
- self.assertEqual(circle.radiusData().value(), 30.0)
+ self.assertEqual(circle.center().x(), 10.0)
+ self.assertEqual(circle.center().y(), 10.0)
+ self.assertEqual(circle.radius(), 30.0)
if __name__ == "__main__":
circle = self.sketch.addCircle(0, 10, 20)
self.sketch.setRadius(circle.result(), 30)
model.do()
- self.assertEqual(circle.radiusData().value(), 30.0)
+ self.assertEqual(circle.radius(), 30.0)
def test_modify_radius(self):
circle = self.sketch.addCircle(0, 10, 20)
- radius = self.sketch.setRadius(circle.result(), 30)
+ radius_constraint = self.sketch.setRadius(circle.result(), 30)
model.do()
- self.sketch.setValue(radius, 20)
+ self.sketch.setValue(radius_constraint, 20)
model.do()
- self.assertEqual(circle.radiusData().value(), 20.0)
+ self.assertEqual(circle.radius(), 20.0)
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
"""Set the radius of the circle."""
self._radius.setValue(radius)
- def centerData(self):
- """Return center data."""
+ def center(self):
+ """Return the center attribute of the circle."""
return self._center
- def radiusData(self):
- """Return radius data."""
- return self._radius
+ def radius(self):
+ """Return the radius value.
+
+ :return: radius
+ :rtype: double
+ """
+ return self._radius.value()
def result(self):
"""Return the cicular line attribute."""
return Circle(circle_feature, *args)
def addArc(self, *args):
- """Add an arc to the sketch."""
+ """Add an arc to the sketch.
+
+ :param sequence args: A sequence of arguments that can be:
+
+ * The center, start and end points
+ * The center, start and end points coordinates
+ :return: arc object
+ :rtype: :class:`model.sketcher.Arc`
+ :raises TypeError: if no argument is provided
+ """
if not args:
raise TypeError("No arguments given")
arc_feature = self._feature.addFeature("SketchArc")
"""Add a mirror transformation of the given objects to the sketch.
This transformation is a constraint.
+
:return: interface to the constraint
:rtype: Mirror object
"""