Beispiel #1
0
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()
    b = WP().polyline(apts).close()
    a = a.revolve(360,(0,0,0),(1,0,0)).edges("%circle")\
        .edges(cq.NearestToPointSelector((0,od/2,0))).fillet(2)\
Beispiel #2
0
def cutRectOfPolarArray(part: cq.Workplane, point, rotateAnglesList):
    for rotateAngle in rotateAnglesList:
        part = part.rotate((0, 0, 0), (0, 0, 1), rotateAngle)
        part = part.moveTo(*point).rect(10, 15).cutThruAll(clean=True)
        part = part.rotate((0, 0, 0), (0, 0, 1), -rotateAngle)
    return part
Beispiel #3
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")
Beispiel #4
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")