aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers_solid.py
diff options
context:
space:
mode:
authorJoshua Shreve <j.a.shreve@gmail.com>2021-09-02 20:51:42 -0400
committerJoshua Shreve <j.a.shreve@gmail.com>2021-09-02 20:51:42 -0400
commit3ebbe5dd2cbc406e93418ac9fb06fbbf175785ba (patch)
tree9ceed478a0334096f2d368e601adb341f20266a4 /src/helpers_solid.py
parent27f491bda62c18e314380ddc6456962a2417b84b (diff)
Added PCB controller mount feature options.
Also, working on modular trackball, though ball bearings make it difficult to decouple as they typically land in the middle of the walls and webs.
Diffstat (limited to 'src/helpers_solid.py')
-rw-r--r--src/helpers_solid.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/helpers_solid.py b/src/helpers_solid.py
index 174d65a..2557e01 100644
--- a/src/helpers_solid.py
+++ b/src/helpers_solid.py
@@ -23,10 +23,14 @@ def cone(r1, r2, height):
def rotate(shape, angle):
+ if shape is None:
+ return None
return sl.rotate(angle)(shape)
def translate(shape, vector):
+ if shape is None:
+ return None
return sl.translate(tuple(vector))(shape)
@@ -47,10 +51,11 @@ def union(shapes):
debugprint('union()')
shape = None
for item in shapes:
- if shape is None:
- shape = item
- else:
- shape += item
+ if item is not None:
+ if shape is None:
+ shape = item
+ else:
+ shape += item
return shape
@@ -58,23 +63,27 @@ def add(shapes):
debugprint('union()')
shape = None
for item in shapes:
- if shape is None:
- shape = item
- else:
- shape += item
+ if item is not None:
+ if shape is None:
+ shape = item
+ else:
+ shape += item
return shape
def difference(shape, shapes):
debugprint('difference()')
for item in shapes:
- shape -= item
+ if item is not None:
+ shape -= item
return shape
def intersect(shape1, shape2):
- return sl.intersection()(shape1, shape2)
-
+ if shape2 is not None:
+ return sl.intersection()(shape1, shape2)
+ else:
+ return shape1
def hull_from_points(points):
return sl.hull()(*points)