Skip to content

Commit

Permalink
Fixed keyswitch nubs. Error came from code consolidation between cadq…
Browse files Browse the repository at this point in the history
…uery and solid python. One centered the cylinder, the other generated it in the positive Z direction. Both now fully center the cylinder and the two models generate consistently.
  • Loading branch information
joshreve committed Jul 30, 2021
1 parent 7bebd90 commit 8409bdb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/dactyl_manuform.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def single_plate(cylinder_segments=100, side="right"):
left_wall = translate(left_wall, ((lr_border / 2) + (keyswitch_width / 2), 0, plate_thickness / 2))

side_nub = cylinder(radius=1, height=2.75)
side_nub = translate(side_nub, (0, 0, -2.75 / 2.0))
side_nub = rotate(side_nub, (90, 0, 0))
side_nub = translate(side_nub, (keyswitch_width / 2, 0, 1))

nub_cube = box(1.5, 2.75, plate_thickness)
nub_cube = translate(nub_cube, ((1.5 / 2) + (keyswitch_width / 2), 0, plate_thickness / 2))
nub_cube = translate(nub_cube, ((1.5 / 2) + (keyswitch_width / 2), 0, plate_thickness / 2))

side_nub2 = tess_hull(shapes=(side_nub, nub_cube))
side_nub2 = union([side_nub2, side_nub, nub_cube])
Expand Down Expand Up @@ -1027,9 +1027,6 @@ def mini_thumbcaps():


def mini_thumb(side="right"):

# shape = thumb_1x_layout(sl.rotate([0.0, 0.0, -90])(single_plate(side=side)))
# shape += thumb_15x_layout(sl.rotate([0.0, 0.0, -90])(single_plate(side=side)))
shape = mini_thumb_1x_layout(single_plate(side=side))
shape = union([shape, mini_thumb_15x_layout(single_plate(side=side))])

Expand Down Expand Up @@ -1259,12 +1256,12 @@ def minidox_thumbcaps():

def minidox_thumb(side="right"):

shape = minidox_thumb_fx_layout(sl.rotate([0.0, 0.0, -90])(single_plate(side=side)))
shape = minidox_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90]))
shape = union([shape, minidox_thumb_fx_layout(adjustable_plate(minidox_Usize))])
# shape += thumb_15x_layout(sl.rotate([0.0, 0.0, -90])(single_plate(side=side)))
# shape = minidox_thumb_1x_layout(single_plate(side=side))



return shape

def minidox_thumb_post_tr():
Expand Down Expand Up @@ -1667,10 +1664,6 @@ def bottom_hull(p, height=0.001):
if ENGINE == 'cadquery':
shape = None
for item in p:
# proj = sl.projection()(p)
# t_shape = sl.linear_extrude(height=height, twist=0, convexity=0, center=True)(
# proj
# )
vertices = []
verts = item.faces('<Z').vertices()
for vert in verts.objects:
Expand Down Expand Up @@ -2439,7 +2432,6 @@ def oled_sliding_mount_frame():
)
top_chamfer_1 = translate(top_chamfer_1, (0, 0, -oled_edge_chamfer - .05))

# top_chamfer_1 = sl.hull()(top_chamfer_1, top_chamfer_2)
top_chamfer_1 = hull_from_shapes([top_chamfer_1, top_chamfer_2])

top_chamfer_1 = translate(top_chamfer_1, (
Expand Down
4 changes: 3 additions & 1 deletion src/helpers_cadquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def box(width, height, depth):


def cylinder(radius, height, segments=100):
return cq.Workplane("XY").union(cq.Solid.makeCylinder(radius=radius, height=height))
shape = cq.Workplane("XY").union(cq.Solid.makeCylinder(radius=radius, height=height))
shape = translate(shape, (0, 0, -height/2))
return shape


def sphere(radius):
Expand Down

0 comments on commit 8409bdb

Please sign in to comment.