コード例 #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
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.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
コード例 #3
0
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)\
        .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)]
コード例 #4
0
import cadquery as cq
from cadquery import Workplane as WP

Dc, Ds, Kw, Kh = 40, 24.2, 8.2, 27.2
p = ((Ds / 2)**2 - (Kw / 2)**2)**0.5

keyway = WP().moveTo(-Kw/2,p).threePointArc((0,-Ds/2),(Kw/2,p))\
    .lineTo(Kw/2,Kh-Ds/2).lineTo(-Kw/2,Kh-Ds/2).close().extrude(40)\
    .translate((0,0,-30))

c = WP().circle(Dc / 2).extrude(5).cut(keyway)

r = -120
txt = WP()
for t in f"{Kw}x{Kh}x{Ds}":
    txt = txt.union(WP().text(t, 8, 5.5).translate(
        (0, -Dc / 2 + (Dc - Ds) / 4, 0)).rotate((0, 0, 0), (0, 0, 1), r))
    r += 20

c = c.union(txt)

show_object(c)

cq.exporters.export(c, "0point2.stl")
コード例 #5
0
import cadquery as cq

h = 34
D = 30
r = 3
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),
コード例 #6
0
from cadquery import Workplane as WP
import cadquery as cq

tag = WP().moveTo(0, 6).text("LIZZIE", 10, 1)
tag = WP().moveTo(0, 6).text("HARGREAVES", 10, 1)
tag = tag.union(WP().polygon(5, 50).extrude(-2))

#cq.exporters.export(a.rotate((0,0,0),(0,0,1),a),f"housing-{n}-way-{pitch}-pitch.stl")
コード例 #7
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)))
コード例 #8
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")