summaryrefslogtreecommitdiff
path: root/src/helpers_cadquery.py
diff options
context:
space:
mode:
authorJoshua Shreve <j.a.shreve@gmail.com>2021-08-20 17:08:34 -0400
committerGitHub <noreply@github.com>2021-08-20 17:08:34 -0400
commit8f7580bc5f6835a1b896f1112ed34c8d1e5d459a (patch)
treea35c190e362d01d5c72fb0f1e209e0763810207d /src/helpers_cadquery.py
parentcdcde68ed97b3b0712f264b3ed690015cddb98cf (diff)
parent338510f9857da2f1949550c28209af280c13965e (diff)
Merge branch 'master' into trackball
Diffstat (limited to 'src/helpers_cadquery.py')
-rw-r--r--src/helpers_cadquery.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/helpers_cadquery.py b/src/helpers_cadquery.py
index 5fb3886..5dc78d1 100644
--- a/src/helpers_cadquery.py
+++ b/src/helpers_cadquery.py
@@ -157,6 +157,39 @@ def triangle_hulls(shapes):
return union(hulls)
+
+
+
+def bottom_hull(p, height=0.001):
+ debugprint("bottom_hull()")
+ shape = None
+ for item in p:
+ vertices = []
+ # verts = item.faces('<Z').vertices()
+ verts = item.faces().vertices()
+ for vert in verts.objects:
+ v0 = vert.toTuple()
+ v1 = [v0[0], v0[1], -10]
+ vertices.append(np.array(v0))
+ vertices.append(np.array(v1))
+
+ t_shape = hull_from_points(vertices)
+
+ # t_shape = translate(t_shape, [0, 0, height / 2 - 10])
+
+ if shape is None:
+ shape = t_shape
+
+ for shp in (*p, shape, t_shape):
+ try:
+ shp.vertices()
+ except:
+ 0
+ shape = union([shape, hull_from_shapes((shape, t_shape))])
+
+ return shape
+
+
def polyline(point_list):
return cq.Workplane('XY').polyline(point_list)
@@ -178,7 +211,7 @@ def extrude_poly(outer_poly, inner_polys=None, height=1): # vector=(0,0,1)):
cq.Solid.extrudeLinear(outerWire=outer_wires, innerWires=inner_wires, vecNormal=cq.Vector(0, 0, height)))
-def import_file(fname):
+def import_file(fname, convexity=None):
print("IMPORTING FROM {}".format(fname))
return cq.Workplane('XY').add(cq.importers.importShape(
cq.exporters.ExportTypes.STEP,