import model
from TestSketcher import SketcherTestCase
-class SketcherSetFillet(SketcherTestCase):
+class SketcherSetFillet(SketcherTestCase):
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
- self.sketch.setFillet(l1.endPoint(), 10.0)
+ self.sketch.setFillet([l1.endPoint()], 10.0)
model.do()
if __name__ == "__main__":
import model
from TestSketcher import SketcherTestCase
-class SketcherSetHorizontal(SketcherTestCase):
+class SketcherSetHorizontal(SketcherTestCase):
def runTest(self):
line = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setHorizontal(line.result())
+ self.sketch.setHorizontal(line)
model.do()
self.assertEqual(line.startPoint().y(), line.endPoint().y())
import TestSketcher
from TestSketcher import SketcherTestCase
-class SketcherSetLength(SketcherTestCase):
+class SketcherSetLength(SketcherTestCase):
def runTest(self):
# Set the constraint
line = self.sketch.addLine(0, 0, 0, 1)
- self.sketch.setLength(line.result(), 25.0)
+ self.sketch.setLength(line, 25.0)
# Commit the transaction
model.do()
# Check the result
math.pow((line.endPoint().y() - line.startPoint().y()), 2)
)
self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA)
-
+
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
import model
from TestSketcher import SketcherTestCase
-class SketcherSetParallel(SketcherTestCase):
+class SketcherSetParallel(SketcherTestCase):
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
- self.sketch.setParallel(l1.result(), l2.result())
+ self.sketch.setParallel(l1, l2)
model.do()
if __name__ == "__main__":
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setPerpendicular(l1.result(), l2.result())
+ self.sketch.setPerpendicular(l1, l2)
model.do()
-
+
dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \
(l2.endPoint().x() - l2.startPoint().x()) + \
(l1.endPoint().y() - l1.startPoint().y()) * \
import model
from TestSketcher import SketcherTestCase
-class SketcherSetRadius(SketcherTestCase):
+class SketcherSetRadius(SketcherTestCase):
def test_set_radius(self):
circle = self.sketch.addCircle(0, 10, 20)
self.sketch.setRadius(circle.result(), 30)
model.do()
self.assertEqual(circle.radius(), 30.0)
-
+
def test_modify_radius(self):
circle = self.sketch.addCircle(0, 10, 20)
radius_constraint = self.sketch.setRadius(circle.result(), 30)
self.sketch.setValue(radius_constraint, 20)
model.do()
self.assertEqual(circle.radius(), 20.0)
-
+
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
class SketcherSetRigid(SketcherTestCase):
def runTest(self):
circle = self.sketch.addCircle(0, 10, 20)
- self.sketch.setRigid(circle.result())
+ self.sketch.setRigid(circle)
model.do()
circle.setCenter(0, 0)
model.do()
import model
from TestSketcher import SketcherTestCase
-class SketcherSetVertical(SketcherTestCase):
+class SketcherSetVertical(SketcherTestCase):
def runTest(self):
line = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setVertical(line.result())
+ self.sketch.setVertical(line)
model.do()
self.assertEqual(line.startPoint().x(), line.endPoint().x())