summaryrefslogtreecommitdiff
path: root/src/helpers_solid.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers_solid.py')
-rw-r--r--src/helpers_solid.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/helpers_solid.py b/src/helpers_solid.py
index 470d5e8..174d65a 100644
--- a/src/helpers_solid.py
+++ b/src/helpers_solid.py
@@ -73,7 +73,7 @@ def difference(shape, shapes):
def intersect(shape1, shape2):
- return sl.intersect()(shape1, shape2)
+ return sl.intersection()(shape1, shape2)
def hull_from_points(points):
@@ -102,6 +102,21 @@ def triangle_hulls(shapes):
return union(hulls)
+
+def bottom_hull(p, height=0.001):
+ debugprint("bottom_hull()")
+ shape = None
+ for item in p:
+ proj = sl.projection()(p)
+ t_shape = sl.linear_extrude(height=height, twist=0, convexity=0, center=True)(
+ proj
+ )
+ t_shape = sl.translate([0, 0, height / 2 - 10])(t_shape)
+ if shape is None:
+ shape = t_shape
+ shape = sl.hull()(p, shape, t_shape)
+ return shape
+
def polyline(point_list):
return sl.polygon(point_list)
@@ -118,9 +133,9 @@ def extrude_poly(outer_poly, inner_polys=None, height=1):
return sl.linear_extrude(height=height, twist=0, convexity=0, center=True)(outer_poly)
-def import_file(fname):
+def import_file(fname, convexity=2):
print("IMPORTING FROM {}".format(fname))
- return sl.import_(fname + ".stl")
+ return sl.import_stl(fname + ".stl", convexity=convexity)
def export_file(shape, fname):