MCPcopy
hub / github.com/CadQuery/cadquery / testRotate

Method testRotate

tests/test_cadquery.py:309–321  ·  view source on GitHub ↗

Test solid rotation at the CQ object level.

(self)

Source from the content-addressed store, hash-verified

307 self.assertEqual(type(r.first().val()), Compound)
308
309 def testRotate(self):
310 """Test solid rotation at the CQ object level."""
311 box = Workplane("XY").box(1, 1, 5)
312 box.rotate((0, 0, 0), (1, 0, 0), 90)
313 startPoint = box.faces("<Y").edges("<X").first().val().startPoint().toTuple()
314 endPoint = box.faces("<Y").edges("<X").first().val().endPoint().toTuple()
315
316 self.assertEqual(-0.5, endPoint[0])
317 self.assertEqual(-0.5, endPoint[1])
318 self.assertEqual(-2.5, endPoint[2])
319 self.assertEqual(-0.5, startPoint[0])
320 self.assertEqual(-0.5, startPoint[1])
321 self.assertEqual(2.5, startPoint[2])
322
323 def testRotateAboutCenter(self):
324 r = Workplane().box(1, 1, 1).rotateAboutCenter((1, 0, 0), 20)

Callers

nothing calls this directly

Calls 10

WorkplaneClass · 0.85
boxMethod · 0.80
startPointMethod · 0.80
endPointMethod · 0.80
rotateMethod · 0.45
toTupleMethod · 0.45
valMethod · 0.45
firstMethod · 0.45
edgesMethod · 0.45
facesMethod · 0.45

Tested by

no test coverage detected