Skip to content

Instantly share code, notes, and snippets.

@hyOzd
Created April 21, 2016 07:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyOzd/a36bd4e7fe1a5e924b39dc4b2ab7715d to your computer and use it in GitHub Desktop.
Save hyOzd/a36bd4e7fe1a5e924b39dc4b2ab7715d to your computer and use it in GitHub Desktop.
import cadquery as cq
from Helpers import show
BS = cq.selectors.BoxSelector
# PARAMETERS
mount_holes = True
# mold size
mw = 40
mh = 13
ml = 120
# wire and fix size
wd = 6 # wire diameter
rt = 7 # resin thickness
rl = 50 # resin length
rwpl = 10 # resin to wire pass length
# pocket fillet
pf = 18
# mount holes
mhd = 7 # hole diameter
mht = 3 # hole distance from edge
# filling hole
fhd = 6
# DRAWING
# draw base
base = cq.Workplane("XY").box(ml, mw, mh, (True, True, False))
# draw wire
pocket = cq.Workplane("XY", (0, 0, mh)).moveTo(-ml/2., 0).line(0, wd/2.)\
.line((ml-rl)/2.-rwpl, 0).line(rwpl, rt).line(rl, 0)\
.line(rwpl, -rt).line((ml-rl)/2.-rwpl, 0)\
.line(0, -(wd/2.)).close().revolve(axisEnd=(1, 0))\
.edges(BS((-rl/2.-rwpl-.1, -100, -100), (rl/2.+rwpl+.1, 100, 100)))\
.fillet(pf)
r = base.cut(pocket)
# mount holes
if mount_holes:
px = ml/2.-mht-mhd/2.
py = mw/2.-mht-mhd/2
r = r.faces("<Z").workplane().pushPoints([
(px, py),
(-px, py),
(-px, -py),
(px, -py)
]).hole(mhd)
# fill holes
r = r.faces("<Y").workplane().center(0, mh/2.).pushPoints([
(-rl/2., 0),
(0, 0),
(rl/2., 0)
]).hole(fhd, mw/2.)
show(r)
@dcowden
Copy link

dcowden commented Apr 21, 2016

This is so awesome! Thank you for sharing it with us

@fragmuffin
Copy link

fragmuffin commented Aug 18, 2017

Yes, thank you for sharing!
@hyOzd : on the cadquery page it's mentioned that this was fabricated with a CNC machine.
what did you use to generate the toolpath? was this done in FreeCad as well?

@hyOzd
Copy link
Author

hyOzd commented Oct 30, 2017

@fragmuffin no I used a commercial cadcam software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment