diff options
author | Joshua Shreve <j.a.shreve@gmail.com> | 2021-08-11 20:55:08 -0400 |
---|---|---|
committer | Joshua Shreve <j.a.shreve@gmail.com> | 2021-08-11 20:55:08 -0400 |
commit | ca9783df5dc645a027743902f7f3b2e0348fd716 (patch) | |
tree | 1bf74ec68015166c685d58be88a93bc02b9a7a30 /src/helpers_cadquery.py | |
parent | 49f0253b9f22790ce5d50ed83f901328e0acea89 (diff) |
Interim checkin. Initial version of trackball webs/walls in, still working on component cut/union order.
Fixed base plates and walls to be identical in caquery and solid. Fixed if/elif/else structure that misplaced the MINI cluster screw mount.
Added intial pass at add on PCB as option to add with caps for interference checks.
Moved bottom_hull to helper libraries as they are specific to engine.
Fixed bottom_hull functions to correct minor discrepency between the engines.
Fixed solid intersect function.
Diffstat (limited to 'src/helpers_cadquery.py')
-rw-r--r-- | src/helpers_cadquery.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/helpers_cadquery.py b/src/helpers_cadquery.py index 5fb3886..a57eb26 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) |