Browse Source

add holes, fix loop, rename diameter to radius

master
wes 10 months ago
parent
commit
44bd3087ed
  1. 5
      .gitignore
  2. 64
      belt_rivets.py
  3. BIN
      svgs/WK.png

5
.gitignore

@ -1,4 +1,7 @@
*swp
*step
*3mf
*otf
*ttf
*TTF
__pycache__

64
belt_rivets.py

@ -17,69 +17,79 @@ Workplane.addSvgPath = addSvgPath
#"/home/deck/cad_files/svgs/wk_edited.svg"
#)
inner_diameter = 5
outer_diameter = 7
inner_radius = 5
outer_radius = 7
thickness = 3.5
rivet_inner_diameter = 2
rivet_outer_diameter = 3.5
rivet_inner_radius = 2
rivet_outer_radius = 3.5
rivet_thickness = 3
belt_width = 39
loop_thickness = 1.83
loop_side_thickness = 5
loop_height = 4.5 + loop_thickness
loop_height = 10.5 + loop_thickness
loop_width = 25
loop_length = belt_width + loop_side_thickness
slide_width_bottom = loop_side_thickness - 3
slide_width_top = loop_side_thickness - 4
logo = Workplane().circle(outer_diameter).extrude(thickness)
logo = logo.faces(">Z[0]").circle(inner_diameter+0.9).extrude(thickness, combine="cut")
logo = logo.faces(">Z[0]").circle(inner_diameter).extrude(thickness)
logo = logo.faces(">Z[1]").center(0,0).cylinder(thickness+2, inner_diameter-1, combine="cut")
logo = logo.workplane(offset=1.0).circle(outer_diameter+4).extrude(1).workplane(offset=0.5).text("WK", 10, 0.8, combine="cut")
logo = Workplane().circle(outer_radius).extrude(thickness)
logo = logo.faces(">Z[0]").circle(inner_radius+0.9).extrude(thickness, combine="cut")
logo = logo.faces(">Z[0]").circle(inner_radius).extrude(thickness)
logo = logo.faces(">Z[1]").center(0,0).cylinder(thickness+2, inner_radius-1, combine="cut")
logo = logo.workplane(offset=1.0).circle(outer_radius+4).extrude(1).workplane(offset=0.5).text("WK", 10, 0.8, combine="cut")
#wk = Workplane("XY").center(0, 0).addSvgPath(wk_paths[0]).extrude(-2.0)
#logo = logo.union(wk, clean=False)
logo_outer = Workplane().circle(inner_diameter+1).extrude(thickness)
logo_outer = logo_outer.faces(">Z[0]").circle(inner_diameter).extrude(thickness, combine="cut")
logo_outer = logo_outer.workplane(offset=1.0).circle(outer_diameter+4).extrude(1)
logo_outer = Workplane().circle(inner_radius+1).extrude(thickness)
logo_outer = logo_outer.faces(">Z[0]").circle(inner_radius).extrude(thickness, combine="cut")
logo_outer = logo_outer.workplane(offset=1.0).circle(outer_radius+4).extrude(1)
cq.exporters.export(logo, "/home/deck/model_files/belt_hole_inner.step")
cq.exporters.export(logo_outer, "/home/deck/model_files/belt_hole_outer.step")
rivet = Workplane().circle(rivet_outer_diameter).extrude(rivet_thickness)
rivet = rivet.faces(">Z[0]").circle(rivet_inner_diameter+1.05).extrude(rivet_thickness, combine="cut")
rivet = rivet.faces(">Z[0]").circle(rivet_inner_diameter-0.15).extrude(rivet_thickness)
rivet = rivet.faces(">Z[1]").center(0,0).cylinder(rivet_thickness+2, rivet_inner_diameter-1, combine="cut")
rivet = rivet.workplane(offset=1.0).circle(rivet_outer_diameter+1).extrude(1)
rivet = Workplane().circle(rivet_outer_radius).extrude(rivet_thickness)
rivet = rivet.faces(">Z[0]").circle(rivet_inner_radius+1.10).extrude(rivet_thickness, combine="cut")
rivet = rivet.faces(">Z[0]").circle(rivet_inner_radius-0.15).extrude(rivet_thickness)
rivet = rivet.faces(">Z[1]").center(0,0).cylinder(rivet_thickness+2, rivet_inner_radius-1, combine="cut")
rivet = rivet.workplane(offset=1.0).circle(rivet_outer_radius+1).extrude(1)
rivet_outer = Workplane().circle(rivet_inner_diameter+1).extrude(rivet_thickness)
rivet_outer = rivet_outer.faces(">Z[0]").circle(rivet_inner_diameter).extrude(rivet_thickness, combine="cut")
rivet_outer = rivet_outer.workplane(offset=1.0).circle(rivet_outer_diameter+1).extrude(1)
rivet_outer = Workplane().circle(rivet_inner_radius+1).extrude(rivet_thickness)
rivet_outer = rivet_outer.faces(">Z[0]").circle(rivet_inner_radius).extrude(rivet_thickness, combine="cut")
rivet_outer = rivet_outer.workplane(offset=1.0).circle(rivet_outer_radius+1).extrude(1)
loop = Workplane().box(loop_length, loop_width, loop_height)
loop_cut = Workplane().box(loop_length-loop_thickness-loop_side_thickness, loop_width, loop_height-loop_thickness)
loop = loop.cut(loop_cut)
loop_top = loop.faces(">Z[0]").workplane(offset=-1).split(keepTop=True)
loop_top = loop.faces(">Z[0]").workplane(offset=-1.8).split(keepTop=True)
loop_bottom = loop.faces(">Z[0]").workplane(offset=-1).split(keepBottom=True)
slide_bottom_cut_left = Workplane().move(-((loop_length/2)-loop_thickness), 0).box(slide_width_bottom, loop_width, 2)
slide_bottom_cut_right = Workplane().move(((loop_length/2)-loop_thickness), 0).box(slide_width_bottom, loop_width, 2)
slide_top_cut_left = Workplane().workplane(offset=-2.8).move(-((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
slide_top_cut_right = Workplane().workplane(offset=-2.8).move(((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
slide_top_cut_left = Workplane().workplane(offset=-2).move(-((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
slide_top_cut_right = Workplane().workplane(offset=-2).move(((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
slide_bottom_union_left = Workplane().workplane(offset=1).move(-((loop_length/2)-loop_thickness), 0).box(slide_width_bottom-0.3, loop_width, 1.8)
slide_bottom_union_right = Workplane().workplane(offset=1).move(((loop_length/2)-loop_thickness), 0).box(slide_width_bottom-0.3, loop_width, 1.8)
slide_top_union_left = Workplane().workplane(offset=-1.8).move(-((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
slide_top_union_right = Workplane().workplane(offset=-1.8).move(((loop_length/2)-loop_thickness), 0).box(slide_width_top, loop_width, loop_height/2)
loop_bottom = loop_bottom.cut(slide_bottom_cut_left)
loop_bottom = loop_bottom.cut(slide_bottom_cut_right)
loop_bottom = loop_bottom.cut(slide_top_cut_left)
loop_bottom = loop_bottom.cut(slide_top_cut_right)
loop_top = loop_top.union(slide_bottom_union_left)
loop_top = loop_top.union(slide_bottom_union_right)
loop_top = loop_top.union(slide_top_union_left)
loop_top = loop_top.union(slide_top_union_right)
loop_top = loop_top.faces(">Z[0]").rect(loop_width, loop_height, forConstruction=True).vertices().hole((rivet_outer_radius*2)+1)
cq.exporters.export(rivet, "/home/deck/model_files/rivet_inner.step")
cq.exporters.export(rivet_outer, "/home/deck/model_files/rivet_outer.step")
cq.exporters.export(loop_bottom, "/home/deck/model_files/loop_bottom.step")
@ -88,7 +98,7 @@ cq.exporters.export(loop_top, "/home/deck/model_files/loop_top.step")
try:
#show_object(rivet_outer)
#show_object(rivet)
show_object(loop_bottom)
#show_object(loop_top)
#show_object(loop_bottom)
show_object(loop_top)
except NameError:
pass

BIN
svgs/WK.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Loading…
Cancel
Save