From 583a46b78e7737801bd120b0936aa8f8526f0909 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 16 Jan 2021 10:58:51 +0100 Subject: [PATCH] Use __or__ & __and__ --- cadquery/cq.py | 12 ++++++------ tests/test_cadquery.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cadquery/cq.py b/cadquery/cq.py index a0f2b46b..277ff890 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -2969,15 +2969,15 @@ class Workplane(object): return self.newObject([r]) - def __add__(self, toUnion: Union["Workplane", Solid, Compound]) -> "Workplane": + def __or__(self, toUnion: Union["Workplane", Solid, Compound]) -> "Workplane": """ Syntactic sugar for union. - Notice that `r = a + b` is equivalent to `r = a.union(b)`. + Notice that `r = a | b` is equivalent to `r = a.union(b)`. Example:: Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False)) Sphere = Workplane("XY").sphere(1) - result = Box + Sphere + result = Box | Sphere """ return self.union(toUnion) @@ -3064,16 +3064,16 @@ class Workplane(object): return self.newObject([newS]) - def __mul__(self, toUnion: Union["Workplane", Solid, Compound]) -> "Workplane": + def __and__(self, toUnion: Union["Workplane", Solid, Compound]) -> "Workplane": """ Syntactic sugar for intersect. - Notice that `r = a * b` is equivalent to `r = a.intersect(b)`. + Notice that `r = a & b` is equivalent to `r = a.intersect(b)`. Example:: Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False)) Sphere = Workplane("XY").sphere(1) - result = Box * Sphere + result = Box & Sphere """ return self.intersect(toUnion) diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index 8a302f64..023743db 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -1338,7 +1338,7 @@ class TestCadQuery(BaseTest): b1.intersect(b2.faces().val()) # Test syntactic sugar [__mul__ method] - sugar = b1 * b2 + sugar = b1 & b2 self.assertEqual(resS.val().Volume(), sugar.val().Volume()) def testBoundingBox(self): @@ -2184,7 +2184,7 @@ class TestCadQuery(BaseTest): resS.union(toUnion.faces().val()) # Test syntactic sugar [__add__ method] - sugar = currentS + toUnion + sugar = currentS | toUnion self.assertEqual(resS.faces().size(), sugar.faces().size()) def testCombine(self):