summaryrefslogtreecommitdiff
path: root/src/helpers_solid.py
diff options
context:
space:
mode:
authorRobert Reed <robert.mc.reed@gmail.com>2021-08-25 22:55:17 -0700
committerGitHub <noreply@github.com>2021-08-25 22:55:17 -0700
commit9741a5f4731dac2f4792a4b451d9a96dd1c2a381 (patch)
treecf9fba2dd539e6890899c9d1b33ebb81093cd4f2 /src/helpers_solid.py
parentd937d7beb2d7d898dd937cd9e024952b56607403 (diff)
parent27f491bda62c18e314380ddc6456962a2417b84b (diff)
Merge branch 'master' into feat/bash
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):