Пример #1
0
        (linkLength**2 + lv**2 - (pcd / 2)**2) / (2 * linkLength * lv))

    if verbose:
        log(f"x1:{round(x1,3)} y1:{round(y1,3)} lenght:{abs(x1-pitch)/y1} gamma:{gamma}"
            )
    #log(gamma)

    #x2,y2 are relative to wheel 2 center
    x2, y2 = linkLength * cos(
        gamma) + x1 - pitch, linkLength * -sin(gamma) + y1
    wheel2 = WP().circle(d1 / 2).moveTo(x2, y2).circle(
        pin / 2).extrude(t).translate((pitch, 0, 0))

    f = WP().moveTo(x1, y1).polarLine(linkLength, -gamma / pi *
                                      180).close().offset2D(pin).extrude(-t)
    f = f.cut(WP().pushPoints([(x1, y1),
                               (x2 + pitch, y2)]).circle(pin / 2).extrude(-t))

    #double check maths with drawing line of link lenght between calculated points
    if False:
        c = WP().moveTo(x1, y1).circle(linkLength)
        d = WP().moveTo(pitch, 0).circle(pcd / 2)
        e = WP().moveTo(x1, y1).lineTo(pitch, 0)

#    log(f"{round(theta,3)} | {round(x1,3)},{round(y1,3)} | {round(x2,3)},{round(y2,3)} ")

    res = wheel1.union(wheel2).union(f)
    cq.exporters.export(res, f'{n}.svg')

log(linkLength)
Пример #2
0
h, w, l, wall = 40, 60, 100, 3
laserS = 33.3
railP, railD = 50, 6.5
motorBossD, motorBossL, motorMountP = 12.5, 16, 35
caridgeH, caridgeL = 30, 40
plateT = 8
plateW, plateH = 81, 100

motorD = WP().circle(26 / 2)
motor = WP().pushPoints([(motorMountP / 2, 0),
                         (-motorMountP / 2, 0)]).circle(4.3 / 2)
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
0
from gear import gear

GEARS = False

P = Pallet()

od, id, l, fw, v = 30, 3, 20, 4, 5
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)\
Пример #4
0
from cadquery import Workplane as WP
import cadquery as cq

pins, pitch, sq, h, w = 6, 2, 1, 6, 3.3
offset = (pitch * (pins - 1)) / 2
clearance = 0.2

a = WP().rect(pitch * pins + pitch / 2 - clerance, w).extrude(h - 1)
#a = WP().moveTo()

for p in range(pins):
    log(f"{offset + p*pitch} , {p}")
    a = a.cut(WP().moveTo(-offset + p * pitch, 0.6).rect(sq, sq).extrude(h))

cq.exporters.export(a, f"JST-PH_housing-{pins}_way.stl")
Пример #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")
Пример #6
0
N = 3
flange = 2
c = 0.5

#thread_profile = cq.Workplane("XZ",origin=(R,0,0)).circle(r)
#path = cq.Workplane("XY", obj=cq.Wire.makeHelix(R,N*R,R))
#res = thread_profile.sweep(path)

a = WP().circle(D / 2).extrude(h)
a = a.union(WP().circle(D / 2 +
                        2).extrude(flange).faces(">Z").edges().chamfer(flange -
                                                                       c))
a = a.union(WP().workplane(
    offset=h -
    flange).circle(D / 2 +
                   2).extrude(flange).faces("<Z").edges().chamfer(flange - c))

b = WP("YZ").center(D/2,h/2).polyline([(2,-4),(2,4),(-3,2.2),(-3,-2.2)]).close().extrude(20,both=True)\
    .edges("|X").fillet(2).rotate((0,0,0),(0,1,0),10)

for n in range(-12, 12):
    a = a.cut(
        b.rotate((0, 0, 0), (0, 0, 1), n * 30).translate((0, 0, n * 0.75)))

w = (2.5**2 - 1.9**2)**0.5
a = a.cut(WP().moveTo(1.9, -w).threePointArc((-2.5, 0),
                                             (1.9, w)).close().extrude(h))

show_object(a)

cq.exporters.export(a, "reel.stl")
Пример #7
0
from cadquery import Workplane as WP
import cadquery as cq

pitch,d,h,w,n  = 2.54, 2, 8, 4, 4

#pts = [(3.81,0),(1.27,0),(-1.27.0),(-3.81,0)]
pts = [(pitch*(p- n/2+ 0.5),0) for p in range(n)]
for p in pts: log(p)

a = WP().rect((pitch+0.5)*n,w).extrude(h)
a = a.cut(WP().pushPoints(pts).circle(2/2).extrude(h))

cq.exporters.export(a.rotate((0,0,0),(0,0,1),a),f"housing-{n}-way-{pitch}-pitch.stl")
Пример #8
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")
Пример #9
0
from math import sin, cos, pi
from cadquery import Workplane as WP
import cadquery as cq

AF = 12.2
r = 12.2 / cos(pi / 6) / 2
pts = [(r * cos(p * pi / 3), r * sin(p * pi / 3)) for p in range(6)]
part = WP().polyline(pts).close().extrude(-4)

pts = [(0, 0), (8, 0), (11.5, 11), (11.5, 22), (0, 22)]
part = part.union(
    WP("XZ").polyline(pts).close().revolve(360, (0, 0, 0), (0, 1, 0)))

r, af = 5.1 / 2, 4.5
y = af - r
x = (r**2 - y**2)**0.5
part = part.cut(WP().workplane(offset=22).moveTo(x, y).threePointArc(
    (0, -r), (-x, y)).close().extrude(-15))
part = part.cut(WP().workplane(offset=-4).circle(3.3 / 2).extrude(12))
part = part.cut(
    WP("YZ").polyline([(AF / 2, -4), (AF / 2 + 4, -4), (AF / 2 + 4, 0)
                       ]).close().revolve(360, (0, 0, 0), (0, 1, 0)))
Пример #10
0
from cadquery import Workplane as WP
import cadquery as cq
from math import sin, cos ,pi

x1,y1 = 0, 73/2
x2,y2 = 4.4, -73/2
T = 20
AF = 5.7
r = AF/cos(pi/6)/2
n = 62/2*cos(pi/4)

a = WP().circle(84/2).extrude(T)
a = a.union(WP().pushPoints([(x1,y1),(x2,y2)]).circle(4.7/2).extrude(T+3))
a = a.faces(">Z").edges().fillet(0.5)
a = a.union(WP().circle(51.7/2).extrude(-10).faces("<Z").edges().fillet(0.5))

clampHs = [(-1.8,10),(-1.8,-30)]
a = a.cut(WP().pushPoints(clampHs).circle(3.3/2).extrude(T))
pts = [(r*sin(pi/6*p),r*cos(pi/6*p)) for p in (1,3,5,7,9,11)]
for ch in clampHs: a = a.cut(WP().workplane(offset=-10).center(ch[0],ch[1]).polyline(pts).close().extrude(15))
a = a.cut(WP().pushPoints([(n,n),(n,-n),(-n,-n),(-n,n)]).circle(4.5/2).extrude(T))
a = a.cut(WP().workplane(offset=T).pushPoints([(n,n),(n,-n),(-n,-n),(-n,n)]).circle(8/2).extrude(-5))

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