From 60d861f897177b751852fc8ab5447dcbed459866 Mon Sep 17 00:00:00 2001 From: Sillyfrog Date: Wed, 31 Mar 2021 13:53:13 +1000 Subject: [PATCH] Provide ~ debug helper --- README.rst | 18 ++++++++++++++++++ solid/solidpython.py | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/README.rst b/README.rst index e9a4ba07..142851da 100644 --- a/README.rst +++ b/README.rst @@ -286,6 +286,24 @@ is the same as: cylinder(r=2, h=30) ) +To assist with debugging: + +.. code:: python + + c = ~cylinder(r=10, h=5) + +is the same as: + +.. code:: python + + c = cylinder(r=10, h=5).set_modifier("#") + +which in OpenSCAD would be: + +.. code:: openscad + + #cylinder(r=10, h=5) + First-class Negative Space (Holes) ---------------------------------- diff --git a/solid/solidpython.py b/solid/solidpython.py index c8b85a33..cccf893b 100755 --- a/solid/solidpython.py +++ b/solid/solidpython.py @@ -304,6 +304,12 @@ def __call__(self, *args: "OpenSCADObject") -> "OpenSCADObject": """ return self.add(args) + def __invert__(self): + """ + Same as .set_modifier("#") + """ + return self.set_modifier("#") + def __add__(self, x: "OpenSCADObject") -> "OpenSCADObject": """ This makes u = a+b identical to: