Tudo: Primeiro commit
This commit is contained in:
commit
06a90928dc
4633 files changed
+6327263
No files matched your search
@@ -0,0 +1,263 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Roda Mecanum 60 mm (tipo Moebius/DFRobot FIT0766), cubo de 5 mm.
|
||||
|
||||
Especificação (DFRobot FIT0766 / anúncio Moebius):
|
||||
Ø60 mm, largura 30,6 mm, 9 roletes a 45°, rolete ~30 mm,
|
||||
núcleo plástico preto + roletes de silicone, bucha de alumínio p/ eixo Ø5.
|
||||
Detalhes copiados da foto: face em anel com rebaixo central profundo, cubo
|
||||
central escuro com bucha prateada, parafuso radial Phillips, gomos em gota
|
||||
envolvendo as pontas dos roletes, gravação "60MM" e símbolo circular.
|
||||
|
||||
Sistema local: eixo da roda = Z, plano médio z=0, face com "60MM" em +Z
|
||||
(lado externo), lado do motor em -Z.
|
||||
"""
|
||||
import math, sys, os
|
||||
sys.path.insert(0, os.path.expanduser("~/robo_movel/cad"))
|
||||
import importlib, lib_rm; importlib.reload(lib_rm)
|
||||
from lib_rm import *
|
||||
|
||||
R_EXT = 30.0 # raio externo (envelope dos roletes)
|
||||
W = 30.6 # largura total
|
||||
N = 9 # roletes
|
||||
ALPHA = 45.0 # ângulo dos roletes
|
||||
L = 26.0 # comprimento do rolete (medido na foto: ~0,44 x Ø)
|
||||
D_AX = 22.7 # raio do eixo do rolete (no ponto médio)
|
||||
R_AXLE = 1.0 # pino Ø2
|
||||
ZO = 13.8 # face externa do anel
|
||||
ZI = 10.5 # face interna do anel
|
||||
R_RING = 20.5 # raio externo do anel da face
|
||||
R_CORE = 15.2 # núcleo entre as flanges (recortado pelos roletes)
|
||||
R_POCK = 12.8 # rebaixo central
|
||||
WEB = 3.0 # meia espessura da alma
|
||||
R_BOSS = 6.5 # cubo central
|
||||
R_BUSH = 4.75 # bucha Ø9,5
|
||||
R_BORE = 2.5 # furo Ø5 (eixo do motor)
|
||||
L_BUSH = 27.3
|
||||
S_E = L / 2 + 3.2 # centro do gomo ao longo do eixo do rolete
|
||||
R_HUB_MAX = 29.0 # gomos ficam 1 mm por dentro do envelope dos roletes (não tocam o chão)
|
||||
|
||||
|
||||
def roller_frame(i, hand):
|
||||
phi = 2 * math.pi * i / N
|
||||
c, s = math.cos(phi), math.sin(phi)
|
||||
mid = V(D_AX * c, D_AX * s, 0)
|
||||
rad = V(c, s, 0)
|
||||
tan = V(-s, c, 0)
|
||||
al = math.radians(ALPHA) * hand
|
||||
a = tan * math.cos(al) + V(0, 0, 1) * math.sin(al)
|
||||
return mid, a, rad
|
||||
|
||||
|
||||
def roller_profile():
|
||||
"""r(s) tal que o ponto mais externo do rolete toque o cilindro R_EXT."""
|
||||
al = math.radians(ALPHA)
|
||||
a = V(0, math.cos(al), math.sin(al))
|
||||
u = V(1, 0, 0)
|
||||
v = a.cross(u)
|
||||
pts = []
|
||||
for k in range(41):
|
||||
s = -L / 2 + L * k / 40
|
||||
p = V(D_AX, 0, 0) + a * s
|
||||
|
||||
def rmax(r):
|
||||
m = 0
|
||||
for j in range(180):
|
||||
th = 2 * math.pi * j / 180
|
||||
q = p + u * (r * math.cos(th)) + v * (r * math.sin(th))
|
||||
m = max(m, math.hypot(q.x, q.y))
|
||||
return m
|
||||
lo, hi = 0.5, 12.0
|
||||
for _ in range(40):
|
||||
mid = (lo + hi) / 2
|
||||
if rmax(mid) > R_EXT:
|
||||
hi = mid
|
||||
else:
|
||||
lo = mid
|
||||
pts.append((s, lo))
|
||||
return pts
|
||||
|
||||
|
||||
PROFILE = roller_profile()
|
||||
|
||||
|
||||
def roller_solid(offset=0.0, extra=0.0, fillet=2.4):
|
||||
"""Rolete com eixo em Z (centro na origem). offset/extra geram o envelope
|
||||
de folga usado para recortar o cubo."""
|
||||
pp = [(s * (1 + 2 * extra / L), r + offset) for s, r in PROFILE]
|
||||
spl = Part.BSplineCurve()
|
||||
spl.interpolate([V(r, 0, s) for s, r in pp])
|
||||
e = spl.toShape()
|
||||
p0, p1 = e.Vertexes[0].Point, e.Vertexes[-1].Point
|
||||
w = Part.Wire([Part.makeLine(V(0, 0, p0.z), p0), e, Part.makeLine(p1, V(0, 0, p1.z)),
|
||||
Part.makeLine(V(0, 0, p1.z), V(0, 0, p0.z))])
|
||||
sol = Part.Face(w).revolve(V(0, 0, 0), V(0, 0, 1), 360)
|
||||
sol = Part.Solid(Part.Shell(sol.Faces)) if sol.ShapeType != "Solid" else sol
|
||||
if fillet > 0:
|
||||
circ = [ed for ed in sol.Edges if ed.Curve.__class__.__name__ == "Circle"]
|
||||
try:
|
||||
sol = sol.makeFillet(fillet, circ)
|
||||
except Exception:
|
||||
pass
|
||||
return sol
|
||||
|
||||
|
||||
def place_axis(shape, mid, a):
|
||||
return placed(shape, mid, Rotation(V(0, 0, 1), a))
|
||||
|
||||
|
||||
def cone_between(A, B, rA, rB):
|
||||
d = B - A
|
||||
return Part.makeCone(rA, rB, d.Length, A, d)
|
||||
|
||||
|
||||
def ellipsoid(c, rx, rz):
|
||||
"""Elipsoide de revolução (eixo Z achatado)."""
|
||||
s = Part.makeSphere(rx)
|
||||
m = App.Matrix()
|
||||
m.scale(1, 1, rz / rx)
|
||||
s = s.transformGeometry(m)
|
||||
s.translate(c)
|
||||
return s
|
||||
|
||||
|
||||
def lobe(E, a, sgn):
|
||||
"""Gomo em gota: nasce no anel, envolve a ponta do rolete e termina numa
|
||||
ponta tangencial (efeito 'redemoinho' da foto)."""
|
||||
u = V(E.x, E.y, 0)
|
||||
u.normalize()
|
||||
t = V(a.x, a.y, 0)
|
||||
t.normalize()
|
||||
zc = math.copysign(ZO - 1.5, E.z) # face em que está a ponta do rolete (vale p/ roda D e E)
|
||||
P = u * (R_RING - 0.3) + V(0, 0, zc)
|
||||
Ec = E
|
||||
T = Ec + t * (sgn * 3.0) + u * 1.0
|
||||
q = 0.70 # achatamento em Z
|
||||
parts = [ellipsoid(P, 4.2, 4.2 * q), ellipsoid(Ec, 5.0, 5.0 * q), ellipsoid(T, 3.6, 3.6 * q)]
|
||||
def bridge(A, B, ra, rb):
|
||||
# tronco de cone achatado em Z, igual às elipsoides
|
||||
c = cone_between(V(0, 0, 0), B - A, ra * 0.9, rb * 0.9)
|
||||
m = App.Matrix()
|
||||
m.scale(1, 1, q)
|
||||
c = c.transformGeometry(m)
|
||||
c.translate(A)
|
||||
return c
|
||||
parts += [bridge(P, Ec, 4.2, 5.0), bridge(Ec, T, 5.0, 3.6)]
|
||||
return fuse(parts)
|
||||
|
||||
|
||||
def build_hub(hand):
|
||||
core = cyl(R_CORE, 2 * ZO, V(0, 0, -ZO))
|
||||
rings = [cyl(R_RING, ZO - ZI, V(0, 0, ZI)), cyl(R_RING, ZO - ZI, V(0, 0, -ZO))]
|
||||
lobes = []
|
||||
for i in range(N):
|
||||
mid, a, rad = roller_frame(i, hand)
|
||||
for sgn in (1, -1):
|
||||
lobes.append(lobe(mid + a * (sgn * S_E), a, sgn))
|
||||
hub = core.multiFuse(rings + lobes).removeSplitter()
|
||||
hub = hub.common(cyl(R_HUB_MAX, W, V(0, 0, -W / 2)))
|
||||
# folga dos roletes (envelope +0,5 mm e 0,4 mm nas pontas)
|
||||
env = roller_solid(offset=0.5, extra=0.4, fillet=0)
|
||||
tools = [place_axis(env, *roller_frame(i, hand)[:2]) for i in range(N)]
|
||||
hub = hub.cut(Part.makeCompound(tools))
|
||||
# rebaixos central frontal (+Z) e traseiro (-Z)
|
||||
hub = hub.cut([cyl(R_POCK, ZO + 3 - WEB, V(0, 0, WEB)), cyl(R_POCK, ZO + 3 - WEB, V(0, 0, -ZO - 3))])
|
||||
# cubo central com leve cone de saída de molde
|
||||
boss = Part.makeCone(R_BOSS + 0.4, R_BOSS, ZO - 2.8 - WEB, V(0, 0, WEB - 0.01))
|
||||
boss_b = Part.makeCone(R_BOSS + 0.4, R_BOSS, ZO - 5.0 - WEB, V(0, 0, -WEB + 0.01), V(0, 0, -1))
|
||||
hub = hub.fuse([boss, boss_b]).removeSplitter()
|
||||
# arredonda a boca do rebaixo
|
||||
tools = [cyl(R_BUSH, 2 * ZO + 2, V(0, 0, -ZO - 1))]
|
||||
# 3 furos de alívio na alma + furo do parafuso radial
|
||||
for k in range(3):
|
||||
th = math.radians(90 + 120 * k + 60)
|
||||
tools.append(cyl(1.4, 2 * WEB + 2, V(9.3 * math.cos(th), 9.3 * math.sin(th), -WEB - 1)))
|
||||
tools.append(cyl(1.25, 10, V(0, 0, 8.0), V(0, 1, 0))) # M3 radial (frente)
|
||||
tools.append(cyl(1.25, 10, V(0, 0, -7.0), V(0, -1, 0))) # M3 radial (trás)
|
||||
for i in range(N):
|
||||
mid, a, _ = roller_frame(i, hand)
|
||||
tools.append(place_axis(cyl(R_AXLE + 0.05, 2 * S_E, V(0, 0, -S_E)), mid, a)) # furo cego
|
||||
hub = hub.cut(Part.makeCompound(tools))
|
||||
try:
|
||||
edges = [e for e in hub.Edges if e.Curve.__class__.__name__ == "Circle"
|
||||
and abs(e.Curve.Radius - R_POCK) < 1e-3 and abs(abs(e.Vertexes[0].Point.z) - ZO) < 1e-3]
|
||||
hub = hub.makeFillet(0.8, edges)
|
||||
except Exception as ex:
|
||||
print("fillet rebaixo:", ex)
|
||||
return hub
|
||||
|
||||
|
||||
def engraving():
|
||||
"""'60MM' em alto-relevo 0,35 mm no anel + símbolo circular."""
|
||||
items = []
|
||||
txt = "60MM"
|
||||
size, r_txt = 2.9, 15.3
|
||||
ang0 = math.radians(118) # posição como na foto (≈ 11 h)
|
||||
shapes = []
|
||||
for ch in txt:
|
||||
sh = text_shape(ch, size, height=0.35)
|
||||
c = text_center(sh)
|
||||
sh.translate(V(-c.x, -c.y, 0))
|
||||
shapes.append(sh)
|
||||
widths = [s.BoundBox.XLength for s in shapes]
|
||||
gap = 0.45
|
||||
total = sum(widths) + gap * (len(widths) - 1)
|
||||
pos = -total / 2
|
||||
for sh, w in zip(shapes, widths):
|
||||
arc = pos + w / 2
|
||||
th = ang0 - arc / r_txt
|
||||
sh.rotate(V(0, 0, 0), V(0, 0, 1), math.degrees(th) - 90)
|
||||
sh.translate(V(r_txt * math.cos(th), r_txt * math.sin(th), ZO))
|
||||
items.append(sh)
|
||||
pos += w + gap
|
||||
# símbolo (seta circular) ≈ 7 h
|
||||
th = math.radians(235)
|
||||
cpos = V(15.4 * math.cos(th), 15.4 * math.sin(th), ZO)
|
||||
ring = cyl(1.9, 0.3, cpos).cut(cyl(1.35, 1, cpos - V(0, 0, 0.5)))
|
||||
ring = ring.cut(cbox(1.6, 1.2, 1, cpos.x + 1.2, cpos.y + 0.5, ZO - 0.2))
|
||||
tri = Part.Face(Part.makePolygon([cpos + V(0.4, 1.9, 0), cpos + V(1.8, 1.0, 0), cpos + V(1.8, 2.6, 0), cpos + V(0.4, 1.9, 0)])).extrude(V(0, 0, 0.3))
|
||||
items += [ring, tri]
|
||||
return Part.makeCompound(items)
|
||||
|
||||
|
||||
def build(hand=1, show=True):
|
||||
name = "RodaMecanum60_" + ("D" if hand > 0 else "E")
|
||||
doc = new_doc(name)
|
||||
part = part_container(doc, name, "Roda Mecanum 60mm " + ("Direita" if hand > 0 else "Esquerda"))
|
||||
hub = build_hub(hand)
|
||||
if not hub.isValid() or len(hub.Solids) != 1 or hub.Volume < 15000:
|
||||
raise RuntimeError("cubo da roda inválido: válido=%s sólidos=%d volume=%.0f" % (hub.isValid(), len(hub.Solids), hub.Volume))
|
||||
add(doc, "Cubo", hub, "preto", "Cubo (nylon PA66 preto)", group=part)
|
||||
add(doc, "Gravacao", engraving(), "preto", "Gravação 60MM", group=part)
|
||||
rol = roller_solid()
|
||||
rol = rol.cut(cyl(R_AXLE + 0.1, L + 2, V(0, 0, -L / 2 - 1)))
|
||||
rollers, axles = [], []
|
||||
for i in range(N):
|
||||
mid, a, _ = roller_frame(i, hand)
|
||||
rollers.append(place_axis(rol, mid, a))
|
||||
axles.append(place_axis(cyl(R_AXLE, 2 * S_E - 0.4, V(0, 0, -S_E + 0.2)), mid, a)) # pino oculto nos gomos
|
||||
add(doc, "Roletes", Part.makeCompound(rollers), "borracha", "Roletes (silicone) x9", group=part)
|
||||
add(doc, "Eixos", Part.makeCompound(axles), "aco", "Pinos dos roletes Ø2", group=part)
|
||||
# bucha de alumínio (cubo de 5 mm) — sai 1 mm à frente do cubo
|
||||
z_front = ZO - 2.8 + 1.0
|
||||
bush = cyl(R_BUSH, L_BUSH, V(0, 0, z_front - L_BUSH)).cut(cyl(R_BORE, 40, V(0, 0, -20)))
|
||||
bush = bush.cut([cyl(1.25, 6, V(0, 0, 8.0), V(0, 1, 0)), cyl(1.25, 6, V(0, 0, -7.0), V(0, -1, 0))])
|
||||
ch = [e for e in bush.Edges if e.Curve.__class__.__name__ == "Circle" and abs(e.Curve.Radius - R_BUSH) < 1e-3]
|
||||
try:
|
||||
bush = bush.makeChamfer(0.4, ch)
|
||||
except Exception:
|
||||
pass
|
||||
add(doc, "Bucha", bush, "aluminio", "Bucha alumínio Ø9,5 x 27,3 (furo Ø5)", group=part)
|
||||
# parafuso radial Phillips M3x4 (frente) e sem-cabeça M3x4 (trás)
|
||||
s1 = placed(screw_pan_phillips(3, 4), V(0, R_BOSS - 0.1, 8.0), Rotation(V(0, 0, 1), V(0, 1, 0)))
|
||||
s2 = placed(set_screw(3, 4), V(0, -R_BOSS + 0.3, -7.0), Rotation(V(0, 0, 1), V(0, -1, 0)))
|
||||
add(doc, "Parafuso_M3x4", s1, "zincado", "Parafuso Phillips M3x4 (ISO 7045)", group=part)
|
||||
add(doc, "SemCabeca_M3x4", s2, "aco_preto", "Parafuso s/ cabeça M3x4 (DIN 913)", group=part)
|
||||
doc.recompute()
|
||||
save(doc)
|
||||
if show:
|
||||
fit()
|
||||
return doc
|
||||
|
||||
|
||||
if __name__ == "__main__" or True:
|
||||
pass
|
||||
Reference in new issue
Block a user