Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support & tests for diameter arguments to circle, sphere, and c…

…ylinder primitives, as in OpenSCAD 2014.03. Closes #26
  • Loading branch information...
commit 4519aca9e481c904657e5b0a35289c9c7b1e5c36 1 parent 23eacb7
Evan Jones authored
Showing with 6 additions and 3 deletions.
  1. +3 −3 solid/solidpython.py
  2. +3 −0  solid/test/test_solidpython.py
View
6 solid/solidpython.py
@@ -15,13 +15,13 @@
openscad_builtins = [
# 2D primitives
{'name': 'polygon', 'args': ['points', 'paths'], 'kwargs': []} ,
- {'name': 'circle', 'args': [], 'kwargs': ['r', 'segments']} ,
+ {'name': 'circle', 'args': [], 'kwargs': ['r', 'd', 'segments']} ,
{'name': 'square', 'args': [], 'kwargs': ['size', 'center']} ,
# 3D primitives
- {'name': 'sphere', 'args': [], 'kwargs': ['r', 'segments']} ,
+ {'name': 'sphere', 'args': [], 'kwargs': ['r', 'd', 'segments']} ,
{'name': 'cube', 'args': [], 'kwargs': ['size', 'center']} ,
- {'name': 'cylinder', 'args': [], 'kwargs': ['r','h','r1', 'r2', 'center', 'segments']} ,
+ {'name': 'cylinder', 'args': [], 'kwargs': ['r','h','r1', 'r2', 'd', 'd1', 'd2', 'center', 'segments']} ,
{'name': 'polyhedron', 'args': ['points', 'triangles' ], 'kwargs': ['convexity']} ,
# Boolean operations
View
3  solid/test/test_solidpython.py
@@ -10,10 +10,13 @@
scad_test_case_templates = [
{'name': 'polygon', 'kwargs': {'paths': [[0, 1, 2]]}, 'expected': '\n\npolygon(paths = [[0, 1, 2]], points = [[0, 0, 0], [1, 0, 0], [0, 1, 0]]);', 'args': {'points': [[0, 0, 0], [1, 0, 0], [0, 1, 0]]}, },
{'name': 'circle', 'kwargs': {'segments': 12, 'r': 1}, 'expected': '\n\ncircle($fn = 12, r = 1);', 'args': {}, },
+{'name': 'circle', 'kwargs': {'segments': 12, 'd': 1}, 'expected': '\n\ncircle($fn = 12, d = 1);', 'args': {}, },
{'name': 'square', 'kwargs': {'center': False, 'size': 1}, 'expected': '\n\nsquare(center = false, size = 1);', 'args': {}, },
{'name': 'sphere', 'kwargs': {'segments': 12, 'r': 1}, 'expected': '\n\nsphere($fn = 12, r = 1);', 'args': {}, },
+{'name': 'sphere', 'kwargs': {'segments': 12, 'd': 1}, 'expected': '\n\nsphere($fn = 12, d = 1);', 'args': {}, },
{'name': 'cube', 'kwargs': {'center': False, 'size': 1}, 'expected': '\n\ncube(center = false, size = 1);', 'args': {}, },
{'name': 'cylinder', 'kwargs': {'r1': None, 'r2': None, 'h': 1, 'segments': 12, 'r': 1, 'center': False}, 'expected': '\n\ncylinder($fn = 12, center = false, h = 1, r = 1);', 'args': {}, },
+{'name': 'cylinder', 'kwargs': {'d1': 4, 'd2': 2, 'h': 1, 'segments': 12, 'center': False}, 'expected': '\n\ncylinder($fn = 12, center = false, d1 = 4, d2 = 2, h = 1);', 'args': {}, },
{'name': 'polyhedron', 'kwargs': {'convexity': None}, 'expected': '\n\npolyhedron(points = [[0, 0, 0], [1, 0, 0], [0, 1, 0]], triangles = [[0, 1, 2]]);', 'args': {'points': [[0, 0, 0], [1, 0, 0], [0, 1, 0]], 'triangles': [[0, 1, 2]]}, },
{'name': 'union', 'kwargs': {}, 'expected': '\n\nunion();', 'args': {}, },
{'name': 'intersection','kwargs': {}, 'expected': '\n\nintersection();', 'args': {}, },
Please sign in to comment.
Something went wrong with that request. Please try again.