Exemplo n.º 1
0
def enclosure(height):
    # Bottom enclosure part
    part = Workplane('XY').box(WIDTH, LENGTH, height)\
        .faces('+Z').shell(THICK)
    part = enclosure_passthrough_vertices(part.faces('>Z'))\
        .rect(PASS_OUTTER, PASS_OUTTER).extrude(-height)\
        .edges('|Z').fillet(2)
    part = enclosure_passthrough_vertices(part.faces('<Z'))\
        .cboreHole(PASS_INNER, PASS_CBORE, PASS_CBORE_DEPTH)
    return part
Exemplo n.º 2
0
    def addReceiver(
            self,
            shape: cq.Workplane,
            face: str,
            location: Tuple[float, float, float] = (0, 0, 0),
    ) -> cq.Workplane:
        """
        Add a receiver to the face of the shape passed.
        """

        show(shape, name="shape")
        f = shape.faces(face)
        dbg(f"f={f}")
        show(f, name="f")
        r = self.receiver
        show(r, name="r")
        # f.cut(self.receiver.rotate((0, 0, 0), (1, 0, 0), 180).translate((0, 0, bodyLen))
        # cq.SelectbodyLen = 30
        # body = cq.Workplane("XY").circle(bodyDiameter / :2).extrude(bodyLen)
        # body1 = body.cut(
        #    c.receiver.rotate((0, 0, 0), (1, 0, 0), 180).translate((0, 0, bodyLen))
        # ).cut(c.receiver)
        # show(body1, name="body1")
        return shape
Exemplo n.º 3
0
d1, d2 = 5, 5
mod, teeth, bore, width, helixAngle = 2, 15, 2, l, 0
n = 31 / 2

outline = [(-21, -21), (-21, 21), (42, 21), (42, -21)]

box = WP("YZ").polyline(outline).close().extrude(6)

box = box.cut(WP("YZ").circle(22.3/2).pushPoints([(n,n),(-n,n),(n,-n),(-n,-n)])\
              .circle(3.5/2).extrude(6)).faces(">X").edges("%circle").chamfer(2.5)

box = box.union(
    WP("YZ").moveTo(od, 0).circle(
        9.8 / 2).extrude(16).faces(">X").edges().chamfer(1))

box = box.faces(">Y").edges("|X").fillet(5)
box = box.faces("<Y").edges("|X").fillet(5)

cq.exporters.export(box.rotate((0, 0, 0), (0, 1, 0), -90), "box.stl")
cq.exporters.export(box.rotate((0, 0, 0), (0, 1, 0), -90), "box.step")

show_object(box)

if GEARS:
    g = gear.spur(mod,teeth,bore,width,helixAngle)\
        .rotate((0,0,0),(0,1,0),90).translate((-l/2,0,0))

    vpts = [(-l / 2, od / 2 + d2), (0, od / 2 - d2), (l / 2, od / 2 + d2)]
    apts = [(-l / 2, od / 2 - d2), (0, od / 2 + d2), (l / 2, od / 2 - d2)]

    a = WP().polyline(vpts).close()
Exemplo n.º 4
0
laser = WP()

caridge = WP().rect(w, caridgeH).extrude(caridgeL)
caridge = caridge.cut(WP().pushPoints([(railP / 2, 0), (-railP / 2, 0)
                                       ]).circle(railD / 2).extrude(h))
caridge = caridge.cut(WP().rect(
    railP - wall * 2 - railD, caridgeH - wall * 2).extrude(
        (caridgeL - 5.6) / 2).edges("|Z").fillet(wall))
caridge = caridge.cut(WP().workplane(offset=caridgeL).rect(
    railP - wall * 2 - railD, caridgeH - wall * 2).extrude(
        -(caridgeL - 5.6) / 2).edges("|Z").fillet(wall))
caridge = caridge.cut(WP().circle(2.5 / 2).extrude(caridgeL))
caridge = caridge.union(WP().moveTo(0, laserS / 2 + caridgeH / 2).rect(
    laserS, laserS).rect(laserS + wall * 2,
                         laserS + wall * 2).extrude(caridgeL))
caridge = caridge.faces("<X or >X").edges("|Z").chamfer(8)
caridge = caridge.faces("<X[-2] or >X[-2] or >X or <X").edges("|Z").fillet(
    wall / 2)
caridge = caridge.cut(
    WP("XZ").workplane(offset=-caridgeH / 2).moveTo(0, caridgeL / 2).circle(
        3.5 / 2).extrude(-wall - laserS))
caridge = caridge.cut(
    WP("XZ").workplane(offset=-caridgeH / 2).moveTo(0, caridgeL / 2).polygon(
        6, 5.6 / cos(pi / 6)).extrude(-wall - laserS + 0.5))
caridge = caridge.union(WP().workplane(offset=caridgeL).moveTo(
    w / 2 + 3, 0).rect(6, 10).extrude(-3).faces(">X").edges("|Z").fillet(2.5))
caridge = caridge.faces(">Z[-2]").edges("<X").fillet(3)

offset = caridgeH / 2 + plateT / 2 + 1
plate = WP("XZ").workplane(offset=offset).rect(81, 100).extrude(
    plateT / 2, both=True).edges("|Y").fillet(4)
Exemplo n.º 5
0
#compartmentalized tray
from cadquery import Workplane as WP
import cadquery as cq

h, w, d, wall = 30, 170, 170, 2
rows, cols = 3, 3
fillet = wall

cw = (w - wall * (cols + 1)) / cols
rw = (w - wall * (rows + 1)) / rows

cp = w / cols
rp = d / rows

a = WP().rect(w, d).extrude(h)

for y in range(rows):
    Y = -float(rp * rows - rp) / 2 + y * rp
    for x in range(cols):
        X = -float(cp * cols - cp) / 2 + x * cp
        a = a.cut(WP().workplane(offset=wall).moveTo(X, Y).rect(
            cw, rw).extrude(h * 2))

a = a.edges("|Z").fillet(fillet)
a = a.faces("<Z").edges().chamfer(wall)
a = a.cut(WP().workplane(offset=h - wall / 2).rect(
    w, d).extrude(h).faces("<Z").edges().chamfer(wall))

cq.exporters.export(
    a, f"tray-({h}x{w}x{d})-rows({rows})-cols({cols})-wall({wall}).stl")
Exemplo n.º 6
0
#clares watch thingy
from cadquery import Workplane as WP

wD, oD, h, ledD = 40, 55, 25, 12
knobD = 7
strapW = 30

a = WP().circle(ledD / 2).circle(oD / 2).extrude(h)
a = a.cut(WP().workplane(offset=h).rect(oD, strapW).extrude(-10))
a = a.cut(WP().workplane(offset=h).moveTo(0, oD / 2).rect(knobD,
                                                          oD).extrude(-10))
a = a.cut(WP().workplane(offset=h).moveTo(12.5, -5.2).lineTo(
    12.5, 5.2).close().offset2D(7.6 / 2).extrude(-18))
a = a.cut(WP().workplane(offset=h).moveTo(12.5, 0).lineTo(
    12.5, -oD).close().offset2D(6.5 / 2).extrude(-17))
a = a.cut(WP().workplane(offset=h).lineTo(-oD, 12).lineTo(
    -oD, -12).close().offset2D(ledD / 2).extrude(-h))
a = a.cut(WP().workplane(offset=h).circle(40.5 / 2).extrude(-10))
a = a.edges("|Z").fillet(2)
a = a.faces(">Z").edges().fillet(1)

cq.exporters.export(a, "claresWatchStand.stl")