2 changed files with 138 additions and 6 deletions
@ -0,0 +1,132 @@ |
|||
from cadquery import exporters |
|||
from cq_warehouse.extensions import Workplane |
|||
from cq_warehouse.fastener import * |
|||
from cq_warehouse.thread import * |
|||
from cqmore.curve import archimedeanSpiral, circle |
|||
from cqmore.polygon import regularPolygon, star |
|||
from cqmore.polyhedron import polarZonohedra, Polyhedron, superellipsoid |
|||
from svg_path import addSvgPath |
|||
from svgpathtools import svg2paths |
|||
import cadquery as cq |
|||
import cqmore |
|||
from cq_gears import ( |
|||
SpurGear, |
|||
Worm, |
|||
HerringboneGear, |
|||
RackGear, |
|||
HerringboneRackGear, |
|||
BevelGear, |
|||
BevelGearPair, |
|||
) |
|||
|
|||
simple = False |
|||
|
|||
screw = ButtonHeadScrew( |
|||
size="M6-1", fastener_type="iso7380_1", length=15 * MM, simple=simple |
|||
) |
|||
|
|||
scaled_screw = screw.scale(0.9) |
|||
|
|||
outer_screw = ButtonHeadScrew( |
|||
size="M3-0.5", fastener_type="iso7380_1", length=12 * MM, simple=simple |
|||
) |
|||
|
|||
scaled_outer_screw = outer_screw.scale(0.95) |
|||
|
|||
outer_screw_plane = ( |
|||
Workplane() |
|||
.union(scaled_outer_screw) |
|||
.workplane(offset=4) |
|||
.cylinder(8, 8, combine="cut") |
|||
.workplane(offset=4) |
|||
.cylinder(3, 4) |
|||
) |
|||
|
|||
Workplane = cqmore.extend(Workplane) |
|||
Workplane.addSvgPath = addSvgPath |
|||
|
|||
outer_axle_diameter = 14.1 # how wide the part in the wheel you press it into is |
|||
outer_axle_radius = outer_axle_diameter / 2 |
|||
outer_axle_length = 30 # length of the first part that sticks in the wheel |
|||
second_outer_axle_length = 2.5 # length of the part after the part that sticks in the wheel that it spins against |
|||
|
|||
inner_axle_length = 4 |
|||
inner_axle_diameter = 1.8 |
|||
|
|||
wheel_axle_outer = Workplane().workplane(invert=True).union(scaled_screw) |
|||
|
|||
wheel_axle_outer = ( |
|||
wheel_axle_outer.workplane(offset=0, invert=True) |
|||
.makePolygon( |
|||
regularPolygon( |
|||
nSides=6, |
|||
radius=outer_axle_radius, |
|||
thetaStart=0, |
|||
thetaEnd=360, |
|||
) |
|||
) |
|||
.extrude(outer_axle_length) |
|||
) |
|||
|
|||
wheel_axle_outer = wheel_axle_outer.workplane( |
|||
offset=outer_axle_length / 2, invert=True |
|||
).cylinder(second_outer_axle_length, outer_axle_diameter) |
|||
|
|||
wheel_axle_outer = wheel_axle_outer.workplane(offset=12, invert=False).cylinder( |
|||
inner_axle_length, inner_axle_diameter * 2 |
|||
) |
|||
|
|||
wheel_axle_outer = wheel_axle_outer.workplane(offset=-13.8).threadedHole( |
|||
scaled_outer_screw, 6, simple=simple, fit="Loose" |
|||
) |
|||
|
|||
|
|||
inner_nut = ( |
|||
Workplane() |
|||
.cylinder(second_outer_axle_length + 1, outer_axle_diameter) |
|||
.workplane(offset=5) |
|||
.threadedHole(screw, 6, simple=simple, fit="Loose") |
|||
) |
|||
|
|||
main_axle_length = 100 # how wide the robot will be basically |
|||
main_axle_diameter = 12 |
|||
main_axle_radius = main_axle_diameter / 2 |
|||
|
|||
main_axle = ( |
|||
Workplane() |
|||
.makePolygon( |
|||
regularPolygon( |
|||
nSides=6, |
|||
radius=main_axle_radius, |
|||
thetaStart=0, |
|||
thetaEnd=360, |
|||
) |
|||
) |
|||
.extrude(main_axle_length) |
|||
) |
|||
|
|||
main_axle = ( |
|||
main_axle.workplane(offset=0) |
|||
.line(main_axle_length - 10, 0, forConstruction=True) |
|||
.rotateAboutCenter((0, main_axle_length - 10, 0), 90) |
|||
.vertices() |
|||
.translate((-((main_axle_length / 2) - 5), 25, 0)) |
|||
.box(6, 49, 1.1) # ends up being about 45 mm |
|||
) |
|||
|
|||
cq.exporters.export( |
|||
wheel_axle_outer, "/home/deck/model_files/robot_wheel_axle_outer.step" |
|||
) |
|||
cq.exporters.export(inner_nut, "/home/deck/model_files/robot_wheel_axle_nut.step") |
|||
cq.exporters.export( |
|||
outer_screw_plane, "/home/deck/model_files/robot_wheel_axle_outer_screw.step" |
|||
) |
|||
cq.exporters.export(main_axle, "/home/deck/model_files/robot_wheel_axle_main.step") |
|||
|
|||
try: |
|||
# show_object(inner_nut) |
|||
# show_object(wheel_axle_outer) |
|||
# show_object(outer_screw_plane) |
|||
show_object(main_axle) |
|||
except NameError: |
|||
pass |
Loading…
Reference in new issue