Skip to content

Commit

Permalink
Fixed cadquery package requirement.
Browse files Browse the repository at this point in the history
Reverted the geometry generation that was compensating for the wrong
cadquery version.  Uncertain why the versions were dramatically
different, will have to watch carefully on new releases or considering
switching environment to a specific version of cadquery instead of
"master".
  • Loading branch information
joshreve committed Oct 24, 2021
1 parent 37cd60e commit 75da53f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 69 deletions.
2 changes: 1 addition & 1 deletion docker/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ dependencies:
- pip
- numpy=1
- scipy=1
- cadquery
- cadquery=master
- pip:
- solidpython
143 changes: 78 additions & 65 deletions src/dactyl_manuform.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ def connectors():
hulls.append(triangle_hulls(places))


# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)


############
Expand Down Expand Up @@ -938,10 +938,10 @@ def default_thumbcaps():
def default_thumb(side="right"):
print('thumb()')
shape = default_thumb_1x_layout(rotate(single_plate(side=side), (0, 0, -90)))
# shape = union([shape, default_thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))])
# shape = union([shape, default_thumb_15x_layout(double_plate(), plate=False)])
shape = add([shape, default_thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))])
shape = add([shape, default_thumb_15x_layout(double_plate(), plate=False)])
shape = union([shape, default_thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))])
shape = union([shape, default_thumb_15x_layout(double_plate(), plate=False)])
#shape = add([shape, default_thumb_15x_layout(rotate(single_plate(side=side), (0, 0, -90)))])
#shape = add([shape, default_thumb_15x_layout(double_plate(), plate=False)])
shape = difference(shape, [default_thumb_pcb_plate_cutouts()])
return shape

Expand Down Expand Up @@ -1130,8 +1130,8 @@ def default_thumb_connectors():
)
)

return add(hulls)
# return union(hulls)
#return add(hulls)
return union(hulls)

############################
# MINI THUMB CLUSTER
Expand Down Expand Up @@ -1174,8 +1174,8 @@ def mini_thumb_bl_place(shape):


def mini_thumb_1x_layout(shape):
# return union([
return add([
return union([
#return add([
mini_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])),
mini_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])),
mini_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])),
Expand All @@ -1184,8 +1184,8 @@ def mini_thumb_1x_layout(shape):


def mini_thumb_15x_layout(shape):
# return union([mini_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))])
return add([mini_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))])
return union([mini_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))])
#return add([mini_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation]))])


def mini_thumbcaps():
Expand All @@ -1196,15 +1196,15 @@ def mini_thumbcaps():

def mini_thumb(side="right"):
shape = mini_thumb_1x_layout(single_plate(side=side))
# shape = union([shape, mini_thumb_15x_layout(single_plate(side=side))])
shape = add([shape, mini_thumb_15x_layout(single_plate(side=side))])
shape = union([shape, mini_thumb_15x_layout(single_plate(side=side))])
#shape = add([shape, mini_thumb_15x_layout(single_plate(side=side))])

return shape

def mini_thumb_pcb_plate_cutouts(side="right"):
shape = mini_thumb_1x_layout(plate_pcb_cutout(side=side))
# shape = union([shape, mini_thumb_15x_layout(plate_pcb_cutout(side=side))])
shape = add([shape, mini_thumb_15x_layout(plate_pcb_cutout(side=side))])
shape = union([shape, mini_thumb_15x_layout(plate_pcb_cutout(side=side))])
#shape = add([shape, mini_thumb_15x_layout(plate_pcb_cutout(side=side))])
return shape


Expand Down Expand Up @@ -1326,8 +1326,8 @@ def mini_thumb_connectors():
)
)

# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)


############################
Expand Down Expand Up @@ -1374,17 +1374,17 @@ def minidox_thumb_br_place(shape):


def minidox_thumb_1x_layout(shape):
# return union([
return add([
return union([
#return add([
minidox_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])),
minidox_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])),
minidox_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])),
])


def minidox_thumb_fx_layout(shape):
# return union([
return add([
return union([
#return add([
minidox_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])),
minidox_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])),
minidox_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])),
Expand All @@ -1399,15 +1399,15 @@ def minidox_thumbcaps():
def minidox_thumb(side="right"):

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 = add([shape, minidox_thumb_fx_layout(adjustable_plate(minidox_Usize))])
shape = union([shape, minidox_thumb_fx_layout(adjustable_plate(minidox_Usize))])
#shape = add([shape, minidox_thumb_fx_layout(adjustable_plate(minidox_Usize))])
# shape = minidox_thumb_1x_layout(single_plate(side=side))
return shape

def minidox_thumb_pcb_plate_cutouts(side="right"):
shape = minidox_thumb_fx_layout(plate_pcb_cutout(side=side))
# shape = union([shape, minidox_thumb_fx_layout(plate_pcb_cutout())])
shape = add([shape, minidox_thumb_fx_layout(plate_pcb_cutout())])
shape = union([shape, minidox_thumb_fx_layout(plate_pcb_cutout())])
#shape = add([shape, minidox_thumb_fx_layout(plate_pcb_cutout())])
return shape

def minidox_thumb_post_tr():
Expand Down Expand Up @@ -1488,8 +1488,8 @@ def minidox_thumb_connectors():
)
)

# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)


############################
Expand Down Expand Up @@ -1535,8 +1535,8 @@ def carbonfet_thumb_bl_place(shape):


def carbonfet_thumb_1x_layout(shape):
# return union([
return add([
return union([
#return add([
carbonfet_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])),
carbonfet_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])),
carbonfet_thumb_br_place(rotate(shape, [0, 0, thumb_plate_br_rotation])),
Expand All @@ -1546,14 +1546,14 @@ def carbonfet_thumb_1x_layout(shape):

def carbonfet_thumb_15x_layout(shape, plate=True):
if plate:
# return union([
return add([
return union([
#return add([
carbonfet_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])),
carbonfet_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation]))
])
else:
# return union([
return add([
return union([
#return add([
carbonfet_thumb_bl_place(shape),
carbonfet_thumb_ml_place(shape)
])
Expand All @@ -1567,17 +1567,17 @@ def carbonfet_thumbcaps():

def carbonfet_thumb(side="right"):
shape = carbonfet_thumb_1x_layout(single_plate(side=side))
# shape = union([shape, carbonfet_thumb_15x_layout(double_plate_half(), plate=False)])
# shape = union([shape, carbonfet_thumb_15x_layout(single_plate(side=side))])
shape = add([shape, carbonfet_thumb_15x_layout(double_plate_half(), plate=False)])
shape = add([shape, carbonfet_thumb_15x_layout(single_plate(side=side))])
shape = union([shape, carbonfet_thumb_15x_layout(double_plate_half(), plate=False)])
shape = union([shape, carbonfet_thumb_15x_layout(single_plate(side=side))])
#shape = add([shape, carbonfet_thumb_15x_layout(double_plate_half(), plate=False)])
#shape = add([shape, carbonfet_thumb_15x_layout(single_plate(side=side))])

return shape

def carbonfet_thumb_pcb_plate_cutouts(side="right"):
shape = carbonfet_thumb_1x_layout(plate_pcb_cutout(side=side))
# shape = union([shape, carbonfet_thumb_15x_layout(plate_pcb_cutout())])
shape = add([shape, carbonfet_thumb_15x_layout(plate_pcb_cutout())])
shape = union([shape, carbonfet_thumb_15x_layout(plate_pcb_cutout())])
#shape = add([shape, carbonfet_thumb_15x_layout(plate_pcb_cutout())])
return shape

def carbonfet_thumb_post_tr():
Expand Down Expand Up @@ -1715,8 +1715,8 @@ def carbonfet_thumb_connectors():
)
)

# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)


############################
Expand Down Expand Up @@ -1793,8 +1793,8 @@ def tbjs_thumb_bl_place(shape):


def tbjs_thumb_1x_layout(shape):
# return union([
return add([
return union([
#return add([
tbjs_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])),
tbjs_thumb_mr_place(rotate(shape, [0, 0, thumb_plate_mr_rotation])),
tbjs_thumb_bl_place(rotate(shape, [0, 0, thumb_plate_bl_rotation])),
Expand All @@ -1814,8 +1814,8 @@ def tbjs_thumb_fx_layout(shape):
]

def trackball_layout(shape):
# return union([
return add([
return union([
#return add([
tbjs_place(shape),
])

Expand All @@ -1831,8 +1831,8 @@ def tbjs_thumb(side="right"):
# shape = tbjs_thumb_fx_layout(rotate(single_plate(side=side), [0.0, 0.0, -90]))
shape = tbjs_thumb_1x_layout(single_plate(side=side))
# shape = tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))
# shape = union([shape, *tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))])
shape = add([shape, *tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))])
shape = union([shape, *tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))])
#shape = add([shape, *tbjs_thumb_fx_layout(adjustable_square_plate(Uwidth=tbjs_Uwidth, Uheight=tbjs_Uheight))])

# shape = union([shape, trackball_layout(trackball_socket())])
# shape = tbjs_thumb_1x_layout(single_plate(side=side))
Expand Down Expand Up @@ -1981,8 +1981,8 @@ def tbjs_thumb_connectors():
)
)

# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)



Expand Down Expand Up @@ -2019,8 +2019,8 @@ def tbcj_thumb_bl_place(shape):
return shape

def tbcj_thumb_layout(shape):
# return union([
return add([
return union([
#return add([
tbcj_thumb_tr_place(rotate(shape, [0, 0, thumb_plate_tr_rotation])),
tbcj_thumb_tl_place(rotate(shape, [0, 0, thumb_plate_tl_rotation])),
tbcj_thumb_ml_place(rotate(shape, [0, 0, thumb_plate_ml_rotation])),
Expand Down Expand Up @@ -2094,8 +2094,8 @@ def tbcj_place(shape):
def tbcj_thumb(side="right"):
t = tbcj_thumb_layout(single_plate(side=side))
tb = tbcj_place(tbcj_holder())
# return union([t, tb])
return add([t, tb])
return union([t, tb])
#return add([t, tb])

def tbcj_thumb_pcb_plate_cutouts(side="right"):
t = tbcj_thumb_layout(plate_pcb_cutout(side=side))
Expand Down Expand Up @@ -2241,8 +2241,8 @@ def tbcj_thumb_connectors():
)
)

# return union(hulls)
return add(hulls)
return union(hulls)
#return add(hulls)



Expand Down Expand Up @@ -2341,15 +2341,17 @@ def wall_brace(place1, dx1, dy1, post1, place2, dx2, dy2, post2, back=False, ske
hulls = []
if not skeleton:
hulls.append(place1(translate(post1, wall_locate2(dx1, dy1))))
hulls.append(place2(translate(post2, wall_locate2(dx2, dy2))))
if not skeleton or skel_bottom:
hulls.append(place1(translate(post1, wall_locate3(dx1, dy1, back))))
if not skeleton:
hulls.append(place2(translate(post2, wall_locate2(dx2, dy2))))
if not skeleton or skel_bottom:
hulls.append(place2(translate(post2, wall_locate3(dx2, dy2, back))))

if len(hulls)>0:
shape2 = bottom_hull(hulls)
# shape1 = union([shape1, shape2])
shape1 = add([shape1, shape2])
shape1 = union([shape1, shape2])
#shape1 = add([shape1, shape2])

return shape1

Expand Down Expand Up @@ -3925,8 +3927,8 @@ def wire_posts():

def model_side(side="right"):
print('model_right()')
shape = add([key_holes(side=side)])
# shape = union([key_holes(side=side)])
#shape = add([key_holes(side=side)])
shape = union([key_holes(side=side)])
if debug_exports:
export_file(shape=shape, fname=path.join(r"..", "things", r"debug_key_plates"))
connector_shape = connectors()
Expand Down Expand Up @@ -4087,16 +4089,25 @@ def model_side(side="right"):


# NEEDS TO BE SPECIAL FOR CADQUERY
#def baseplate(main_shape, base_shape, wedge_angle=None, side='right'):
def baseplate(wedge_angle=None, side='right'):
if ENGINE == 'cadquery':
# shape = mod_r


thumb_shape = thumb(side=side)
thumb_wall_shape = thumb_walls(side=side, skeleton=skeletal)
thumb_wall_shape = union([thumb_wall_shape, *thumb_screw_insert_outers(side=side)])
thumb_connector_shape = thumb_connectors(side=side)
thumb_connection_shape = thumb_connection(side=side, skeleton=skeletal)
thumb_section = union([thumb_shape, thumb_connector_shape, thumb_wall_shape, thumb_connection_shape])
thumb_section = difference(thumb_section, [union(thumb_screw_insert_holes(side=side))])

shape = union([
case_walls(side=side),
*screw_insert_outers(side=side),
thumb_walls(side=side),
*thumb_screw_insert_outers(side=side),
thumb_section
])
# tool = translate(screw_insert_screw_holes(side=side), [0, 0, -10])
tool = screw_insert_all_shapes(screw_hole_diameter/2., screw_hole_diameter/2., 350, side=side)
for item in tool:
item = translate(item, [0, 0, -10])
Expand All @@ -4107,7 +4118,7 @@ def baseplate(wedge_angle=None, side='right'):
item = translate(item, [0, 0, -10])
shape = difference(shape, [item])


#shape = union([main_shape, thumb_shape])

shape = translate(shape, (0, 0, -0.0001))

Expand Down Expand Up @@ -4191,6 +4202,7 @@ def run():
export_file(shape=mod_r, fname=path.join(save_path, config_name + r"_right"))
export_file(shape=tmb_r, fname=path.join(save_path, config_name + r"_thumb_right"))

#base = baseplate(mod_r, tmb_r, side='right')
base = baseplate(side='right')
export_file(shape=base, fname=path.join(save_path, config_name + r"_right_plate"))
export_dxf(shape=base, fname=path.join(save_path, config_name + r"_right_plate"))
Expand All @@ -4200,6 +4212,7 @@ def run():
export_file(shape=mod_l, fname=path.join(save_path, config_name + r"_left"))
export_file(shape=tmb_l, fname=path.join(save_path, config_name + r"_thumb_left"))

#base_l = mirror(baseplate(mod_l, tmb_l, side='left'), 'YZ')
base_l = mirror(baseplate(side='left'), 'YZ')
export_file(shape=base_l, fname=path.join(save_path, config_name + r"_left_plate"))
export_dxf(shape=base_l, fname=path.join(save_path, config_name + r"_left_plate"))
Expand Down
4 changes: 2 additions & 2 deletions src/generate_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
##############################

# 'DEFAULT' 6-key, 'MINI' 5-key, 'CARBONFET' 6-key, 'MINIDOX' 3-key, 'TRACKBALL_ORBYL', 'TRACKBALL_CJ'
'thumb_style': 'TRACKBALL_ORBYL',
'thumb_style': 'DEFAULT',
'default_1U_cluster': True, # only used with default, makes top right thumb cluster key 1U
# Thumb key size. May need slight oversizing, check w/ caps. Additional spacing will be automatically added for larger keys.
'minidox_Usize': 1.6,
Expand Down Expand Up @@ -501,4 +501,4 @@ def save_config():

## HERE FOR QUICK TESTING, SHOULD BE COMMENTED ON COMMIT
# from dactyl_manuform import *
# run()
# run()
Loading

0 comments on commit 75da53f

Please sign in to comment.