summaryrefslogtreecommitdiff
path: root/src/helpers_cadquery.py
diff options
context:
space:
mode:
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,