From f5139e15bc7ae36e1c04075e9930ca1f13536dc0 Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Fri, 28 Jun 2019 09:33:21 +0100 Subject: [PATCH] fix #216. Thanks, sergey! --- Examples/example19.escad | 6 ++++++ Graphics/Implicit/ExtOpenScad/Primitives.hs | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 Examples/example19.escad diff --git a/Examples/example19.escad b/Examples/example19.escad new file mode 100644 index 0000000..16349d0 --- /dev/null +++ b/Examples/example19.escad @@ -0,0 +1,6 @@ +// Example 19 -- The union of a cube and a sphere. +union() +{ + cube(20); + translate(20,20,20) sphere (15); +} \ No newline at end of file diff --git a/Graphics/Implicit/ExtOpenScad/Primitives.hs b/Graphics/Implicit/ExtOpenScad/Primitives.hs index 553ac43..9ac37b1 100644 --- a/Graphics/Implicit/ExtOpenScad/Primitives.hs +++ b/Graphics/Implicit/ExtOpenScad/Primitives.hs @@ -80,10 +80,6 @@ cube = moduleWithoutSuite "cube" $ do -- examples example "cube(size = [2,3,4], center = true, r = 0.5);" example "cube(4);" - -- arguments shared between forms - r :: ℝ <- argument "r" - `doc` "radius of rounding" - `defaultTo` 0 -- arguments (two forms) ((x1,x2), (y1,y2), (z1,z2)) <- do @@ -110,6 +106,10 @@ cube = moduleWithoutSuite "cube" $ do `defaultTo` False let (x,y, z) = either (\w -> (w,w,w)) id size return (toInterval center x, toInterval center y, toInterval center z) + -- arguments shared between forms + r :: ℝ <- argument "r" + `doc` "radius of rounding" + `defaultTo` 0 -- Tests test "cube(4);" `eulerCharacteristic` 2 @@ -123,10 +123,6 @@ square = moduleWithoutSuite "square" $ do example "square(x=[-2,2], y=[-1,5]);" example "square(size = [3,4], center = true, r = 0.5);" example "square(4);" - -- arguments shared between forms - r :: ℝ <- argument "r" - `doc` "radius of rounding" - `defaultTo` 0 -- arguments (two forms) ((x1,x2), (y1,y2)) <- do @@ -150,6 +146,10 @@ square = moduleWithoutSuite "square" $ do `defaultTo` False let (x,y) = either (\w -> (w,w)) id size return (toInterval center x, toInterval center y) + -- arguments shared between forms + r :: ℝ <- argument "r" + `doc` "radius of rounding" + `defaultTo` 0 -- Tests test "square(2);" `eulerCharacteristic` 0