def test_from_plane(self): plane = Plane(origin=(1,2,3), xDir=(0,1,0), normal=(1,0,0)) cs = CoordSystem.from_plane(plane) self.assertEqual(cs.origin, Vector(1,2,3)) self.assertEqual(cs.xDir, Vector(0,1,0)) self.assertEqual(cs.yDir, Vector(0,0,1)) self.assertEqual(cs.zDir, Vector(1,0,0))
def get_mate_center(self, angle=0): """ Mate at ring's center rotated ``angle`` degrees. :param angle: rotation around z-axis (unit: deg) :type angle: :class:`float` :return: mate in ring's center rotated about z-axis :rtype: :class:`Mate <cqparts.constraint.Mate>` """ return Mate(self, CoordSystem.from_plane( cadquery.Plane( origin=(0, 0, self.width / 2), xDir=(1, 0, 0), normal=(0, 0, 1), ).rotated((0, 0, angle)) # rotate about z-axis ))