# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
circle = base_sketch.addCircle(0, 0, 10)
- # axis
- axis_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
- line = axis_sketch.addLine(20, -10, 20, 10)
model.do()
base = base_sketch.selectFace()
- axis_object = Selection(axis_sketch.result()[0],
- line.result()[0])
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
- self.revolution = model.addRevolution(self.part, base, axis_object,
+ self.revolution = model.addRevolution(self.part, base, axis_object[0],
0, 180)
model.do()
class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture):
- def test_add_revolution_no_base(self):
- try:
- revolution = model.addRevolution(self.part)
- fail("addRevolution should assert if base is not None")
- except AssertionError:
- pass
-
def test_add_revolution_by_face_and_angles(self):
# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
model.do()
base = base_sketch.selectFace()
- axis_point1 = model.addPoint(self.part, 20, -10, 0)
- axis_point2 = model.addPoint(self.part, 20, 10, 0)
- axis_object = model.addAxis(self.part, axis_point1.result()[0], axis_point2.result()[0]).result()[0]
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
- revolution = model.addRevolution(self.part, base, axis_object,
+ revolution = model.addRevolution(self.part, base, axis_object[0],
0, 180)
self.assertEqual(revolution.creationMethod().value(), "ByAngles")
model.do()
base = base_sketch.selectFace()
- axis_point1 = model.addPoint(self.part, 20, -10, 0)
- axis_point2 = model.addPoint(self.part, 20, 10, 0)
- axis_object = model.addAxis(self.part, axis_point1.result()[0], axis_point2.result()[0]).result()[0]
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
to_obejct = to_sketch.selectFace()[0]
from_object = from_sketch.selectFace()[0]
- revolution = model.addRevolution(self.part, base, axis_object,
+ revolution = model.addRevolution(self.part, base, axis_object[0],
to_obejct, 15,
from_object, 20)
def test_revolution_get_attribute(self):
# call method of the feature
- self.assertTrue(isinstance(self.revolution.base(),
+ self.assertTrue(isinstance(self.revolution.baseObjects(),
ModelAPI.ModelAPI_AttributeSelectionList))
- self.assertTrue(isinstance(self.revolution.axisObject(),
+ self.assertTrue(isinstance(self.revolution.axis(),
ModelAPI.ModelAPI_AttributeSelection))
self.assertTrue(isinstance(self.revolution.creationMethod(),
ModelAPI.ModelAPI_AttributeString))
model.do()
base = base_sketch.selectFace()
- axis_point1 = model.addPoint(self.part, 20, -10, 0)
- axis_point2 = model.addPoint(self.part, 20, 10, 0)
- axis_object = model.addAxis(self.part, axis_point1.result()[0], axis_point2.result()[0]).result()[0]
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
to_obejct = to_sketch.selectFace()[0]
from_object = from_sketch.selectFace()[0]
self.revolution.setPlanesAndOffsets(to_obejct, 15, from_object, 20)
self.assertEqual(self.revolution.creationMethod().value(), "ByPlanesAndOffsets")
- self.assertEqual(self.revolution.toAngle().value(), 0)
- self.assertEqual(self.revolution.fromAngle().value(), 0)
+ # self.assertEqual(self.revolution.toAngle().value(), 0)
+ # self.assertEqual(self.revolution.fromAngle().value(), 0)
# self.assertEqual(self.revolution.getToObject().context(), None)
self.assertEqual(self.revolution.toOffset().value(), 15)
# self.assertEqual(self.revolution.getFromObject().context(), None)