Beispiel #1
0
"""A set of clips to hold up the gym mirror."""

import cadquery as cq
import caddyshack as cs

dims = cs.Dims('scripts/gym/mirror-clips.yml')
clip = dims.clip

# Add an extra 1/2 standoff for the cap on top.
clip.height = clip.standoff * 1.5 + dims.mirror
clip.depth = dims.screw.head * 2 + clip.overhang

part = (cq.Workplane("XY").box(
    clip.width, clip.depth, clip.height).edges("|Z").fillet(3 * clip.fillet))

part = (part.faces(">Y").workplane(invert=True).move(
    0, -clip.height / 2 + dims.mirror / 2 + clip.standoff / 2).rect(
        clip.width, dims.mirror).cutBlind(clip.overhang))

part = (part.faces(">Z").workplane().move(
    0, -1 / 2 * clip.depth + dims.screw.head).cskHole(dims.screw.clearance,
                                                      dims.screw.head, 82))

# Should technically be able to do scew_head/2, but the cskHole oversinks
# by a good bit it seems.
part = part.edges(">Z").fillet(min(clip.fillet, dims.screw.head / 3))

# Fin.
cs.showsave(part, dims=dims)
Beispiel #2
0
# Some calculated dimensions.
dims.bucket.slope = (dims.bucket.topdia -
                     dims.bucket.botdia) / (2 * dims.bucket.height)

# Applying fudge factors.
dims.outlet.fitting.max += dims.outlet.fitting.fudge
dims.outlet.fitting.min += dims.outlet.fitting.fudge
dims.inlet.fitting.max += dims.inlet.fitting.fudge
dims.inlet.fitting.min += dims.inlet.fitting.fudge

if dims.get('debug', False):
    inlet, outlet = build_debug(dims)
    inlet.val().label = "test-inlet"
    outlet.val().label = "test-outlet"
    cs.showsave(inlet, dims)
    cs.showsave(outlet, dims)

outlet, washer = build_outlet(dims)
outlet.val().label = "outlet"
cs.showsave(outlet, dims)
washer.val().label = "outlet-washer"
cs.showsave(washer, dims)

obj = build_inlet(dims)
obj.val().label = "inlet"
cs.showsave(obj, dims)

obj = build_support(dims)
obj.val().label = "support"
cs.showsave(obj, dims)
Beispiel #3
0
dims = cs.Dims('scripts/electronics/standoff.yml')
ds = dims.standoff
dw = dims.wireclamp

# Calculate buffer for the holes.
if dims.countersunk:
    hbuffer = (dims.countersunk) * 1.1
else:
    hbuffer = (dims.pilot) * 1.75

for tname, toe in ds.toe.items():
    for hname, height in ds.heights.items():
        # First build the bottom part:
        standoff = build_standoff(toe, height, ds.thick, hbuffer,
                                  dims.clearance, None)
        standoff.val().label = "%s-%s" % (tname, hname)
        cs.showsave(standoff, dims)

        # Close it so we don't spam too many.
        FreeCAD.closeDocument(FreeCAD.ActiveDocument.ActiveObject.Label)

    # Just show the last one.
    FreeCAD.newDocument(standoff.val().label)
    cs.pretty(standoff)

    # Then build a cap that finishes the retaining. These don't vary with height of the standoff.
    cap = build_standoff(toe, dims.countersunk * 0.25, None, hbuffer,
                         dims.clearance, dims.countersunk)
    cap.val().label = "cap-%s" % (tname)
    cs.showsave(cap, dims)
Beispiel #4
0
        .faces(">Z[-2]").workplane(
            offset=-dims.thick /
            2).circle(dims.mount.dia / 2 +
                      dims.thick).extrude(dims.mount.length + dims.thick /
                                          2).faces(">Z").workplane().hole(
                                              dims.mount.dia)

        # Put the grub screw pilot at half height.
        .faces(">Z").workplane(offset=-dims.mount.length / 2).transformed(
            rotate=(90, 0, 0)).circle(dims.pilot / 2).cutBlind(dims.mount.dia +
                                                               dims.thick)

        # Now add holes for the zip ties.
        # Space them dims.thick apart (eh, because), and import the
        # entirety of numpy for one f*****g function since the range builtin only does ints.
        .faces("<Y[1]").workplane().pushPoints([
            (s * x, 0) for s in (1, -1)
            for x in np.arange(dims.mount.dia / 2 +
                               dims.thick * 1.5, dims.holder.length / 2 -
                               dims.thick / 2, dims.thick)
        ]).hole(dims.pilot))

    return result


cs.clear()

dims = cs.Dims('scripts/household/watchwind.yml')
obj = build(dims)
cs.showsave(obj, dims)
Beispiel #5
0
    d = dims.spacer
    spacer = (cq.Workplane("XY").rect(
        dims.tube.size,
        d.oncenter * 2).extrude(width).faces(">Z").workplane().pushPoints([
            (0, d.oncenter / 2), (0, -d.oncenter / 2)
        ]).hole(d.pilot).edges("|Z").fillet(d.pilot).edges("not(|Z)").fillet(
            d.fillet))
    return spacer


dims = cs.Dims('scripts/bikes/truing-stand/dimensions.yml')

names = ['bracket', 'indicator', 'slider']
for name in names:
    obj = globals()["build_" + name](dims)  # oh god
    obj.val().label = name
    cs.showsave(obj, dims)

# This is one example of where the list->dict conversion rears its head. Blarg.
for width in dims.spacer.widths.values():
    obj = build_spacer(dims, width)
    obj.val().label = "spacer-%d" % width
    doc = cs.showsave(obj, dims)

    # Hack. Because we don't need to see *all* the spacers.
    import FreeCAD
    FreeCAD.closeDocument(FreeCAD.ActiveDocument.ActiveObject.Label)
else:
    FreeCAD.newDocument(obj.val().label)
    cs.pretty(obj)  # But would be nice to see one.
Beispiel #6
0
slots = []
for i in range(dims.nipple.spline.N):
    slot = (
        nipple.faces(">Z").workplane().transformed(
            (0, 0, 360 / dims.nipple.spline.N * (i + 0.5)
             ))  # The 0.5 turns it out half a notch relative to the slit.
    )

    if dims.nipple.spline.kind == "vee":
        dist = dims.nipple.dia / 2 + dims.nipple.spline.size / 2 * (
            2**0.5) - dims.nipple.dia / 2 * dims.nipple.spline.depth
        slot = (slot.transformed((0, 0, 45),
                                 (dist, 0, 0)).rect(dims.nipple.spline.size,
                                                    dims.nipple.spline.size))
    else:
        raise Exception('only supporing type "vee" right now, not %s' %
                        dims.nipple.spline.kind)

    slot = slot.extrude(-dims.nipple.height, combine=False)
    slots.append(slot)

for slot in slots:
    nipple = nipple.cut(slot)

wrench = wrench.cut(nipple)

wrench.val().label = "wrench"
blade.val().label = "blade"

cs.showsave(wrench, dims)
cs.showsave(blade, dims)