Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include 3d rim design #11

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions 3d/mount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""
This script defines the mount for the wheels and motor.
"""
from math import asin
from math import cos
from math import sin
from math import radians

import cadquery
from Helpers import show


def circle_points(number, circle, shift=0):
radius = circle / 2.
step = 360 / number
points = [(radius * sin(radians(i * step + shift)),
radius * cos(radians(i * step + shift)))
for i in range(number)]
return points


# Gears
MODULE = 0.3
Z_PINION = 18
Z_GEAR = 60
GEARS_MARGIN = 0.1

# Motor
MOTOR_SHIFT = 1.25
MOTOR_DIAMETER = 17
MOTOR_HOLE_DIAMETER = 6.3
MOTOR_MOUNT_THICK = 2
MOUNT_MINIHOLES_CIRCLE = 10
MOUNT_MINIHOLES_DIAMETER = 1.7

# Mount
MOUNT_THICK = 5
MOUNT_HEIGHT = MOTOR_DIAMETER
MOUNT_WIDTH = 40
MOUNT_FILLET = 1

# Holes
SCREW_SPACE = 34
SCREW_DIAMETER = 2
AXIS_DIAMETER = 2


# Basic mount structure
mount = cadquery.Workplane('XY').box(MOUNT_WIDTH, MOUNT_HEIGHT, MOUNT_THICK)

# Base screws
mount = mount.faces('<Y').workplane()\
.pushPoints([(-SCREW_SPACE / 2., 0), (SCREW_SPACE / 2., 0)])\
.hole(SCREW_DIAMETER)

# Motor holes
miniholes = circle_points(number=6, circle=MOUNT_MINIHOLES_CIRCLE)
mount = mount.faces('<Z').workplane()\
.pushPoints(miniholes)\
.hole(diameter=MOUNT_MINIHOLES_DIAMETER)
mount = mount.faces('>Z').workplane().cboreHole(
MOTOR_HOLE_DIAMETER,
MOTOR_DIAMETER + 1,
MOUNT_THICK - MOTOR_MOUNT_THICK)

# Axis
axis_shift = (MODULE * (Z_PINION + Z_GEAR)) / 2. + GEARS_MARGIN
axis_shift *= cos(asin(MOTOR_SHIFT / axis_shift))
mount = mount.faces('<Z').workplane()\
.pushPoints([(axis_shift, -MOTOR_SHIFT), (-axis_shift, -MOTOR_SHIFT)])\
.hole(AXIS_DIAMETER)

# Fillet
mount = mount.edges('|Z').fillet(MOUNT_FILLET)

show(mount)
Peque marked this conversation as resolved.
Show resolved Hide resolved
30 changes: 30 additions & 0 deletions 3d/rim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
This script defines the rim body.
"""
from math import cos
from math import sin
from math import radians

import cadquery
from Helpers import show

FDM_MARGIN = 0.1

TIRE_W = 2.5 * 2
WHEEL_D = 20.5
WHEEL_D_FDM = WHEEL_D - FDM_MARGIN

REEL_D0 = WHEEL_D_FDM - TIRE_W
REEL_H0 = 8

PINION_D = 6.70
PINION_D_FDM = PINION_D + FDM_MARGIN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would declare all configurable variables on the top like:

FDM_MARGIN = 0.1
REEL_H0 = 8
TIRE_W = 2.5
WHEEL_D = 20.5
PINION_D = 6.70

OUTER = WHEEL_D - TIRE_W * 2 - FDM_MARGIN
INNER = PINION_D + FDM_MARGIN

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solve on 70f4e9b

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even... just define inner/outer variables? 😇

We could start using lower case for variables (more Pythonic...)



# Rim body
rim = cadquery.Workplane('XY')\
.circle(radius=REEL_D0/2.).extrude(distance=REEL_H0)\
.faces('>Z').workplane()\
.hole(diameter=PINION_D_FDM)

show(rim)
Peque marked this conversation as resolved.
Show resolved Hide resolved