diff options
author | Robert Reed <robert.mc.reed@gmail.com> | 2021-08-25 22:55:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 22:55:17 -0700 |
commit | 9741a5f4731dac2f4792a4b451d9a96dd1c2a381 (patch) | |
tree | cf9fba2dd539e6890899c9d1b33ebb81093cd4f2 /src/helpers_cadquery.py | |
parent | d937d7beb2d7d898dd937cd9e024952b56607403 (diff) | |
parent | 27f491bda62c18e314380ddc6456962a2417b84b (diff) |
Merge branch 'master' into feat/bash
Diffstat (limited to 'src/helpers_cadquery.py')
-rw-r--r-- | src/helpers_cadquery.py | 35 |
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, |