Project the provided coordinates onto this plane :param obj: an object or vector to convert :type vector: a vector or shape :return: an object of the same type, but converted to local coordinates Most of the time, the z-coordinate returned will be zero, because mos
(self, obj)
| 702 | self.origin = self.toWorldCoords((x, y)) |
| 703 | |
| 704 | def toLocalCoords(self, obj): |
| 705 | """Project the provided coordinates onto this plane |
| 706 | |
| 707 | :param obj: an object or vector to convert |
| 708 | :type vector: a vector or shape |
| 709 | :return: an object of the same type, but converted to local coordinates |
| 710 | |
| 711 | |
| 712 | Most of the time, the z-coordinate returned will be zero, because most |
| 713 | operations based on a plane are all 2D. Occasionally, though, 3D |
| 714 | points outside of the current plane are transformed. One such example is |
| 715 | :py:meth:`Workplane.box`, where 3D corners of a box are transformed to |
| 716 | orient the box in space correctly. |
| 717 | |
| 718 | """ |
| 719 | from .shapes import Shape |
| 720 | |
| 721 | if isinstance(obj, Vector): |
| 722 | return obj.transform(self.fG) |
| 723 | elif isinstance(obj, Shape): |
| 724 | return obj.transformShape(self.fG) |
| 725 | else: |
| 726 | raise ValueError( |
| 727 | "Don't know how to convert type {} to local coordinates".format( |
| 728 | type(obj) |
| 729 | ) |
| 730 | ) |
| 731 | |
| 732 | def toWorldCoords(self, tuplePoint) -> Vector: |
| 733 | """Convert a point in local coordinates to global coordinates |