Konubinix' opinionated web of thoughts

Clip to Hold a Bracelet

Fleeting

tag: learning 3D printing

import cadquery as cq

depth = 1
backdepth = 0.1

width = 3

height = 0.2
topheight = 0.1
bottomheight = 0.01
assert(height > topheight > bottomheight)

bump = 0.7
toplowercurve = 0.6
bottombump = 0.5
bottomcurve = 0.2
assert(bump >  toplowercurve >  bottombump >  bottomcurve)

assert(height < bump)
assert(topheight < toplowercurve)
assert(bottomheight < bottombump)
assert(0 < bottomcurve)

back = (
    cq.Workplane("XY")
    .lineTo(0, height)
    .threePointArc(
        (width/2,     bump),
        (width,     height),
    )
    .lineTo(width,0)
    .threePointArc(
        (width/2,     bottomcurve),
        (0,     0),
    )
    .close()
    .extrude(backdepth)
    .faces("<Z")
)
bottom = (
    cq.Workplane("XY")
    .lineTo(0,bottomheight)
    .threePointArc(
        (width/2,     bottombump),
        (width,     bottomheight),
    )
    .lineTo(width,0)
    .threePointArc(
        (width/2,     bottomcurve),
        (0,     0),
    )
    .close()
    .extrude(depth)
)

top = (
    cq.Workplane("XY")
    .polyline([(0, topheight)])
    .lineTo(0, height)
    .threePointArc(
        (width/2,     bump),
        (width,     height),
    )
    .lineTo(width, topheight)
    .threePointArc(
        (width/2,     toplowercurve),
        (0,           topheight),
    )
    .close()
    .extrude(depth)
)

cq.exporters.export(
    (

        back.union(bottom).union(top)
    ),
    out,
)
return out

()