Returns a copy of this plane, rotated about the specified axes Since the z axis is always normal the plane, rotating around Z will always produce a plane that is parallel to this one. The origin of the workplane is unaffected by the rotation. Rotations are done in
(self, rotate=(0, 0, 0))
| 745 | return v.transform(self.rG) |
| 746 | |
| 747 | def rotated(self, rotate=(0, 0, 0)): |
| 748 | """Returns a copy of this plane, rotated about the specified axes |
| 749 | |
| 750 | Since the z axis is always normal the plane, rotating around Z will |
| 751 | always produce a plane that is parallel to this one. |
| 752 | |
| 753 | The origin of the workplane is unaffected by the rotation. |
| 754 | |
| 755 | Rotations are done in order x, y, z. If you need a different order, |
| 756 | manually chain together multiple rotate() commands. |
| 757 | |
| 758 | :param rotate: Vector [xDegrees, yDegrees, zDegrees] |
| 759 | :return: a copy of this plane rotated as requested. |
| 760 | """ |
| 761 | # NB: this is not a geometric Vector |
| 762 | rotate = Vector(rotate) |
| 763 | # Convert to radians. |
| 764 | rotate = rotate.multiply(pi / 180.0) |
| 765 | |
| 766 | # Compute rotation matrix. |
| 767 | T1 = gp_Trsf() |
| 768 | T1.SetRotation( |
| 769 | gp_Ax1(gp_Pnt(*(0, 0, 0)), gp_Dir(*self.xDir.toTuple())), rotate.x |
| 770 | ) |
| 771 | T2 = gp_Trsf() |
| 772 | T2.SetRotation( |
| 773 | gp_Ax1(gp_Pnt(*(0, 0, 0)), gp_Dir(*self.yDir.toTuple())), rotate.y |
| 774 | ) |
| 775 | T3 = gp_Trsf() |
| 776 | T3.SetRotation( |
| 777 | gp_Ax1(gp_Pnt(*(0, 0, 0)), gp_Dir(*self.zDir.toTuple())), rotate.z |
| 778 | ) |
| 779 | T = Matrix(gp_GTrsf(T1 * T2 * T3)) |
| 780 | |
| 781 | # Compute the new plane. |
| 782 | newXdir = self.xDir.transform(T) |
| 783 | newZdir = self.zDir.transform(T) |
| 784 | |
| 785 | return Plane(self.origin, newXdir, newZdir) |
| 786 | |
| 787 | def mirrorInPlane(self, listOfShapes, axis="X"): |
| 788 |