Skip to content

Commit ea66ded

Browse files
authored
add __repr__ to plane (#952)
* Update geom.py * Update geom.py * black run * added test added test because CI was complaining * black on test
1 parent fa4561b commit ea66ded

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cadquery/occ_impl/geom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ def __eq__(self, other):
582582
def __ne__(self, other):
583583
return not self.__eq__(other)
584584

585+
def __repr__(self):
586+
return f"Plane(origin={str(self.origin.toTuple())}, xDir={str(self.xDir.toTuple())}, normal={str(self.zDir.toTuple())})"
587+
585588
@property
586589
def origin(self) -> Vector:
587590
return self._origin

tests/test_cadquery.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5174,3 +5174,10 @@ def test_MergeTags(self):
51745174
a = a.union(b)
51755175
a = a.workplaneFromTagged("zface").circle(0.2)
51765176
assert a.edges("%CIRCLE").val().Center().toTuple() == approx((0, 0, 0.5))
5177+
5178+
def test_plane_repr(self):
5179+
wp = Workplane("XY")
5180+
assert (
5181+
repr(wp.plane)
5182+
== "Plane(origin=(0.0, 0.0, 0.0), xDir=(1.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0))"
5183+
)

0 commit comments

Comments
 (0)