Files
Yimu 39469c5b50 新增:机械原理第4章「机械的平衡」笔记;笔记目录改为「分包」结构
一、新增 笔记/05-机械的平衡/知识点-机械的平衡.md(考纲 ⑩)
- 来源 补充资源/机械原理PPT/04 机械的平衡.ppt(olefile 抽 33 页)
- 八节:目的与内容(F=mrω²、危害三条、刚性转子判据、两大分支)/
  刚性转子平衡计算(静平衡 d/b≥5 质径积矢量式 + 双面分解;动平衡
  d/b<5 ∑F=0 且 ∑M=0、双基面两次静平衡;静↔动对比表)/ 平衡实验
  (三架对比 + 强迫振动 Z=μmr、标准转子标定 μ、相位差 α)/
  许用不平衡量与平衡精度([e]、[mr]、A=[e]ω/1000、等级 G4000~G0.4)/
  平面机构平衡(F=-ma_s=0→质心静止;完全平衡 vs 部分平衡)/ 要点回顾
  + 9 条易错 / 考纲对齐
- 按约定不配图

二、笔记目录重构为「包」结构
- 01 齿轮机构及其设计 / 02 轮系及其设计 / 03 其他常用机构 /
  04 机器的运转和调速 / 05 机械的平衡 / 06 机械零件设计基础
- 每包自带:知识点 + 背诵版 + 练习(题目卷/答案卷)+ images/
- 顶层 背诵版/ 目录取消,背诵版并入各包;images/ 按包拆分
- 绘图脚本移到 笔记/_配图脚本/,OUT 改为自动指向各包 images/
- 新增 笔记/00-总索引.md(包清单 + 考纲全景对照 + 待办)
- 文件名全部保持原样,Obsidian 双链与图片相对路径零改动

三、修复全库渲染 bug:加粗以公式结尾时失效
- `**$x$ **` 中 `**` 前是空白,CommonMark 不认其为闭合符 → 加粗失效
- 新增 .workbuddy/fix_bold_math.py(按 ** 成对解析)修掉 107 处
2026-10-18 18:48:03 +08:00

828 lines
38 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""
《知识点-齿轮系(轮系)》配图生成脚本
- 全部为**几何/数学作图**(啮合圆几何、转化轮系、差速器运动分解、配齿几何…),非生成式 AI。
- 复用 gen_figures.py 的绘图工具(配色 / 留白 / 注释框 / 300 dpi)。
运行:python gen_figures_geartrain.py → 输出到 ../02-轮系及其设计/images/ 的 figGXX_*.png
"""
import os
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Arc, Rectangle, FancyBboxPatch
from gen_figures import (OUT, DPI, C_MAIN, C_BLUE, C_RED, C_GREEN,
C_ORANGE, C_PURPLE, C_GRAY, arc, save, note)
# 输出目录:本脚本在 笔记/_配图脚本/ 下,图归到 02 包的 images/
OUT = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
"02-轮系及其设计", "images")
os.makedirs(OUT, exist_ok=True)
# =====================================================================
# 基础工具
# =====================================================================
def new_ax(w=7.4, h=5.6):
fig, ax = plt.subplots(figsize=(w, h))
ax.set_aspect("equal")
ax.axis("off")
return fig, ax
def free_ax(w=9.6, h=5.4, xlim=(0, 10), ylim=(0, 5.6)):
fig, ax = plt.subplots(figsize=(w, h))
ax.set_xlim(*xlim)
ax.set_ylim(*ylim)
ax.axis("off")
return fig, ax
def grid(nr, nc, w, h):
fig, axes = plt.subplots(nr, nc, figsize=(w, h))
axes = np.atleast_1d(axes).ravel()
for ax in axes:
ax.set_aspect("equal")
ax.axis("off")
return fig, axes
def box(ax, x, y, w, h, s, fc="#eef4fb", ec=C_BLUE, fs=10.5, tc=None, lw=1.2,
va="center"):
ax.add_patch(FancyBboxPatch((x - w / 2, y - h / 2), w, h,
boxstyle="round,pad=0.02,rounding_size=0.06",
fc=fc, ec=ec, lw=lw, zorder=3))
ax.text(x, y, s, ha="center", va=va, fontsize=fs, zorder=4,
color=tc or C_MAIN, linespacing=1.55)
def line(ax, p, q, color=C_GRAY, lw=1.1, ls="-", zorder=1):
ax.plot([p[0], q[0]], [p[1], q[1]], color=color, lw=lw, ls=ls, zorder=zorder)
def gear(ax, cx, cy, r, color=C_MAIN, lw=1.7, teeth=0, tin=False, ls="-",
fc="none", zorder=3, alpha=1.0, tlen=0.13):
"""齿轮简图:节圆 + 可选轮齿短线。tin=True 表示内齿轮(齿朝内)。"""
if fc != "none":
ax.add_patch(Circle((cx, cy), r, fc=fc, ec="none", alpha=alpha,
zorder=zorder - 1))
ax.add_patch(Circle((cx, cy), r, fc="none", ec=color, lw=lw, ls=ls,
alpha=alpha, zorder=zorder))
if teeth:
for a in np.linspace(0, 2 * np.pi, teeth, endpoint=False):
r0 = r - tlen if tin else r
r1 = r if tin else r + tlen
ax.plot([cx + r0 * np.cos(a), cx + r1 * np.cos(a)],
[cy + r0 * np.sin(a), cy + r1 * np.sin(a)],
color=color, lw=0.85, alpha=alpha, zorder=zorder)
def rot_arrow(ax, cx, cy, r, a0, a1, color=C_RED, lw=1.7, zorder=6):
"""绕 (cx,cy) 的转向箭头;a1>a0 为逆时针。"""
lo, hi = min(a0, a1), max(a0, a1)
ax.add_patch(Arc((cx, cy), 2 * r, 2 * r, theta1=lo, theta2=hi,
color=color, lw=lw, zorder=zorder))
t = np.radians(a1)
px, py = cx + r * np.cos(t), cy + r * np.sin(t)
d = 1.0 if a1 > a0 else -1.0
tx, ty = -np.sin(t) * d, np.cos(t) * d
ax.annotate("", xy=(px, py), xytext=(px - 0.40 * tx, py - 0.40 * ty),
arrowprops=dict(arrowstyle="-|>", color=color, lw=lw,
mutation_scale=15), zorder=zorder + 1)
def shaft(ax, x, y0, y1, color=C_MAIN, lw=2.2, zorder=2):
ax.plot([x, x], [y0, y1], color=color, lw=lw, solid_capstyle="round",
zorder=zorder)
def dot(ax, x, y, color=C_RED, ms=5.5, zorder=8):
ax.plot(x, y, "o", color=color, ms=ms, zorder=zorder)
def lead(ax, p, q, color=C_GRAY, lw=0.9, ls=":"):
line(ax, p, q, color=color, lw=lw, ls=ls, zorder=5)
def ground(ax, x, y, w=0.8, color=C_MAIN, lw=1.3, up=True):
s = 1 if up else -1
edge = y + s * 0.30
ax.plot([x - w / 2, x + w / 2], [edge, edge], color=color, lw=lw, zorder=6)
for i in range(5):
xx = x - w / 2 + w * i / 4.0
ax.plot([xx, xx - 0.16], [edge, edge + s * 0.20], color=color, lw=0.95,
zorder=6)
# =====================================================================
# figG01 轮系分类
# =====================================================================
def figG01():
fig, ax = free_ax(9.8, 5.6, (-1.0, 11.0), (0, 5.6))
box(ax, 5.0, 5.05, 4.9, 0.70, "轮 系\n(由一系列齿轮组成的传动系统)",
fs=11.5, fc="#eaf1f8", ec=C_BLUE)
box(ax, 1.65, 3.90, 2.85, 0.66, "定轴轮系\n(各轮轴线固定)",
fs=10.5, fc="#eaf7ea", ec=C_GREEN)
box(ax, 5.00, 3.90, 2.85, 0.66, "周转轮系\n(轴线有公转)",
fs=10.5, fc="#fdf2e5", ec=C_ORANGE)
box(ax, 8.35, 3.90, 2.85, 0.66, "复合轮系\n(两者混合)",
fs=10.5, fc="#f4ecfa", ec=C_PURPLE)
box(ax, 0.90, 2.52, 1.90, 0.58, "平面定轴轮系", fs=9.8, fc="white", ec=C_GRAY)
box(ax, 2.95, 2.52, 1.90, 0.58, "空间定轴轮系", fs=9.8, fc="white", ec=C_GRAY)
box(ax, 4.50, 2.52, 1.75, 0.58, "差动轮系\nF = 2", fs=9.6, fc="white", ec=C_GRAY)
box(ax, 6.45, 2.52, 1.85, 0.58, "行星轮系\nF = 1", fs=9.6, fc="white", ec=C_GRAY)
line(ax, (5, 4.70), (5, 4.58), C_GRAY, 1.2)
line(ax, (1.65, 4.58), (8.35, 4.58), C_GRAY, 1.2)
for x in (1.65, 5.0, 8.35):
line(ax, (x, 4.58), (x, 4.23), C_GRAY, 1.2)
line(ax, (1.65, 3.57), (1.65, 3.42), C_GRAY, 1.2)
line(ax, (5.00, 3.57), (5.00, 3.42), C_GRAY, 1.2)
line(ax, (0.90, 3.42), (2.95, 3.42), C_GRAY, 1.2)
line(ax, (4.50, 3.42), (6.45, 3.42), C_GRAY, 1.2)
for x in (0.90, 2.95, 4.50, 6.45):
line(ax, (x, 3.42), (x, 2.81), C_GRAY, 1.2)
box(ax, 5.0, 1.28, 9.6, 1.30,
"本章两大问题:① 轮系传动比 $i$ 的计算  ② 从动轮转向的判断\n"
"重点:定轴轮系、周转轮系、复合轮系传动比的计算方法\n"
"行星轮系配齿公式、少齿差行星轮系 —— 一般了解",
fs=10.5, fc="#fbfbf6", ec="#d9d2c2")
save(fig, "figG01_geartrain_class.png")
# =====================================================================
# figG02 定轴轮系传动比(惰轮)
# =====================================================================
def figG02():
fig, ax = new_ax(9.6, 8.0)
G = { # r = z/10,几何精确相切
"1": (0.0, 10.0, 2.0),
"2": (6.0, 10.0, 4.0),
"2'": (6.0, 3.5, 2.0),
"3": (13.0, 3.5, 5.0),
"3'": (13.0, -3.5, 2.0),
"4": (19.0, -3.5, 4.0),
}
for (x, y, r) in G.values():
gear(ax, x, y, r, lw=1.8)
shaft(ax, 0.0, 5.6, 14.0) # 轴Ⅰ
shaft(ax, 6.0, -0.2, 14.6) # 轴Ⅱ
shaft(ax, 13.0, -7.2, 9.0) # 轴Ⅲ
shaft(ax, 19.0, -8.6, 0.6) # 轴Ⅳ
for p in [(3.0, 10.0), (9.5, 3.5), (16.0, -3.5)]:
ax.plot(p[0], p[1], "o", mfc="white", mec=C_RED, ms=10, mew=1.5, zorder=9)
# 转向:1顺 → 2逆 → 2′逆 → 3顺 → 3′顺 → 4逆
rot_arrow(ax, 0.0, 10.0, 2.55, 110, -40, C_RED)
rot_arrow(ax, 6.0, 10.0, 4.55, -40, 110, C_BLUE)
rot_arrow(ax, 6.0, 3.5, 2.55, -40, 110, C_BLUE)
rot_arrow(ax, 13.0, 3.5, 5.55, 110, -40, C_RED)
rot_arrow(ax, 13.0, -3.5, 2.55, 110, -40, C_RED)
rot_arrow(ax, 19.0, -3.5, 4.55, -40, 110, C_BLUE)
ax.text(-3.1, 10.0, "1\n$z_1$=20", ha="right", va="center", fontsize=10.5)
ax.text(6.0, 15.35, "2\n$z_2$=40", ha="center", va="bottom", fontsize=10.5)
ax.text(3.65, 2.45, "2′\n$z_{2'}$=20", ha="right", va="center", fontsize=10.5)
ax.text(13.0, 9.35, "3\n$z_3$=50", ha="center", va="bottom", fontsize=10.5)
ax.text(11.55, -5.0, "3′\n$z_{3'}$=20", ha="right", va="center", fontsize=10.5)
ax.text(19.0, 1.35, "4\n$z_4$=40", ha="center", va="bottom", fontsize=10.5)
ax.text(-5.2, 21.0, "定轴轮系传动比", fontsize=14, ha="left", va="center")
note(ax, -5.2, 19.7,
"$i_{14}=\\dfrac{\\omega_1}{\\omega_4}"
"=\\dfrac{z_2\\,z_3\\,z_4}{z_1\\,z_{2'}\\,z_{3'}}"
"=(-1)^3\\dfrac{40\\times50\\times40}{20\\times20\\times20}=-10$",
fs=12.5)
note(ax, -5.2, -10.2,
"大小:所有从动轮齿数连乘积 ÷ 所有主动轮齿数连乘积\n"
"转向:平面定轴轮系用 $(-1)^m$($m$=外啮合次数,本例 3 次 → 负号)\n"
"惰轮(过轮):齿数在分子、分母同时出现,只改变转向、不影响 $i$ 的大小",
fs=10.5)
ax.set_xlim(-5.6, 26.5)
ax.set_ylim(-14.0, 22.2)
save(fig, "figG02_fixed_train.png")
# =====================================================================
# figG03 定轴轮系转向判定
# =====================================================================
def figG03():
fig, axes = grid(2, 2, 9.8, 8.0)
a, b, c, d = axes
# (a) 平面:外啮合
a.set_title("(a) 平面定轴轮系 · 外啮合 → 转向相反($i_{12}$ 取负)",
fontsize=10.5)
gear(a, -1.0, 0, 1.0)
gear(a, 1.0, 0, 1.0)
dot(a, 0, 0, C_RED, ms=6)
rot_arrow(a, -1.0, 0, 1.55, 110, -40, C_RED)
rot_arrow(a, 1.0, 0, 1.55, -40, 110, C_BLUE)
a.text(-1.0, 2.05, "1", ha="center", fontsize=11)
a.text(1.0, 2.05, "2", ha="center", fontsize=11)
a.text(0, -2.25, "两箭头反向:$i_{12}=-z_2/z_1$", ha="center", fontsize=10)
a.set_xlim(-3.0, 3.0)
a.set_ylim(-2.9, 2.9)
# (b) 平面:内啮合
b.set_title("(b) 平面定轴轮系 · 内啮合 → 转向相同($i_{12}$ 取正)",
fontsize=10.5)
gear(b, 0, 0, 1.85, lw=2.0, teeth=44, tin=True)
gear(b, 0.85, 0, 1.00)
dot(b, 1.85, 0, C_RED, ms=6)
rot_arrow(b, 0, 0, 2.35, -40, 110, C_RED, lw=1.5)
rot_arrow(b, 0.85, 0, 1.45, -40, 110, C_RED, lw=1.5)
b.text(-1.85, 1.95, "内齿轮 1", ha="center", fontsize=10)
b.text(0.85, -0.06, "2", ha="center", fontsize=11)
b.text(0, -2.70, "两箭头同向:$i_{12}=+z_2/z_1$", ha="center", fontsize=10)
b.set_xlim(-3.0, 3.0)
b.set_ylim(-2.9, 2.9)
# (c) 空间:锥齿轮
c.set_title("(c) 锥齿轮:两箭头同时指向\n(或同时背离)啮合点", fontsize=10.2)
c.plot([-2.6, 0], [0, 0], color=C_MAIN, lw=1.4)
c.plot([0, 0], [0, -2.6], color=C_MAIN, lw=1.4)
c.add_patch(plt.Polygon([(0, 0), (-1.5, 0.62), (-1.5, -0.62)], closed=True,
fc="#dbe8f5", ec=C_BLUE, lw=1.5, zorder=3))
c.add_patch(plt.Polygon([(0, 0), (-0.62, -1.5), (0.62, -1.5)], closed=True,
fc="#fdeada", ec=C_ORANGE, lw=1.5, zorder=3))
dot(c, 0, 0, C_RED, ms=6)
c.annotate("", xy=(-0.18, 0.12), xytext=(-1.35, 0.12),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8))
c.annotate("", xy=(0.12, -0.18), xytext=(0.12, -1.35),
arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=1.8))
c.text(-1.95, 1.00, "齿轮1", color=C_BLUE, fontsize=10, ha="center")
c.text(1.35, -1.55, "齿轮2", color=C_ORANGE, fontsize=10, ha="center")
c.text(0.15, 0.32, "啮合点", fontsize=9.5, color=C_RED)
c.set_xlim(-3.0, 3.2)
c.set_ylim(-3.0, 2.9)
# (d) 空间:蜗杆蜗轮
d.set_title("(d) 蜗杆蜗轮:左旋左手、右旋右手", fontsize=10.2)
d.add_patch(Rectangle((-2.2, -0.42), 3.6, 0.84, fc="#dbe8f5",
ec=C_BLUE, lw=1.5, zorder=3))
for x in np.linspace(-2.05, 1.25, 9):
d.plot([x, x + 0.32], [-0.42, 0.42], color=C_BLUE, lw=1.0, zorder=4)
d.plot([-2.6, 1.9], [0, 0], color=C_MAIN, lw=1.2, ls="-.", zorder=2)
gear(d, 0.0, -1.75, 1.35, lw=1.8, teeth=30)
d.plot([0.0, 0.0], [-1.75, -0.40], color=C_MAIN, lw=1.2, ls="-.", zorder=2)
dot(d, 0.0, -0.42, C_RED, ms=6)
d.annotate("", xy=(0.9, 0.95), xytext=(-2.1, 0.95),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8))
rot_arrow(d, 0.0, -1.75, 1.80, 110, -40, C_ORANGE)
d.text(-2.3, 1.30, "蜗杆(右旋)", color=C_BLUE, fontsize=10, ha="left")
d.text(1.95, -2.55, "蜗轮", color=C_ORANGE, fontsize=10, ha="left")
d.text(0.0, -3.55,
"四指弯曲方向=蜗杆转向,拇指反向=蜗轮节点线速度方向",
fontsize=9.5, ha="center")
d.set_xlim(-3.0, 3.6)
d.set_ylim(-4.0, 2.9)
fig.tight_layout()
save(fig, "figG03_direction.png")
# =====================================================================
# figG04 2K-H 周转轮系的组成
# =====================================================================
def figG04():
fig, ax = new_ax(8.6, 7.2)
r1, r2, r3 = 1.2, 0.9, 3.0
dO = r1 + r2
assert abs((r3 - r2) - dO) < 1e-9
gear(ax, 0, 0, r3, lw=1.9, teeth=54, tin=True)
gear(ax, 0, 0, r1, lw=1.9, teeth=28)
for a in (90, 210, 330):
t = np.radians(a)
px, py = dO * np.cos(t), dO * np.sin(t)
gear(ax, px, py, r2, lw=1.7, teeth=22)
line(ax, (0, 0), (px, py), color=C_ORANGE, lw=2.0, zorder=2)
gear(ax, 0, 0, 0.34, fc=C_ORANGE, lw=1.4, zorder=5)
ax.plot(0, 0, "k+", ms=8)
lead(ax, (0.80, 0.80), (4.05, 2.55))
ax.text(4.20, 2.55, "1 太阳轮(中心轮)", fontsize=10.5, va="center")
lead(ax, (-dO * 0.866, -dO * 0.5), (-5.10, -3.60))
ax.text(-5.25, -3.60, "2 行星轮", fontsize=10.5, ha="left", va="center")
lead(ax, (-2.12, 2.12), (-6.20, 3.55))
ax.text(-6.35, 3.55, "3 内齿圈(中心轮,固定)", fontsize=10.5,
ha="left", va="center")
lead(ax, (dO * 0.55, -dO * 0.05), (2.75, -2.15))
ax.text(2.90, -2.15, "H 系杆(行星架)", fontsize=10.5, ha="left",
va="center", color=C_ORANGE)
rot_arrow(ax, 0, 0, r1 + 0.45, 110, -40, C_RED)
rot_arrow(ax, 0, 0, r3 + 0.45, -40, 110, C_BLUE, lw=1.4)
note(ax, -7.6, -4.60,
"基本构件:太阳轮(中心轮)、系杆(行星架);行星轮既自转又绕中心轮公转\n"
"一个基本周转轮系中:至少 1 个行星轮,最多 2 个中心轮,"
"且两中心轮与系杆的轴线必须重合\n"
"差动轮系 $F=2$(两中心轮都不固定);行星轮系 $F=1$(一个中心轮固定)",
fs=10.5)
ax.set_xlim(-7.9, 7.9)
ax.set_ylim(-7.4, 5.2)
save(fig, "figG04_epicyclic.png")
# =====================================================================
# figG05 反转原理(转化轮系)
# =====================================================================
def figG05():
fig, axes = grid(1, 2, 10.6, 5.4)
r1, r2, r3 = 2.0, 1.5, 5.0
dO = r1 + r2
titles = (r"原周转轮系:$\omega_1,\ \omega_3,\ \omega_H$ 均不为 0",
r"施加 $-\omega_H$ 后:系杆成机架 → 转化轮系(定轴轮系)")
for ax, ttl, inv in zip(axes, titles, (False, True)):
ax.set_title(ttl, fontsize=11)
gear(ax, 0, 0, r3, lw=1.8, teeth=48, tin=True)
gear(ax, 0, 0, r1, lw=1.8, teeth=26)
gear(ax, dO, 0, r2, lw=1.6, teeth=18)
line(ax, (0, 0), (dO, 0), color=C_ORANGE, lw=2.0, zorder=2)
gear(ax, 0, 0, 0.4, fc=C_MAIN if inv else C_ORANGE, lw=1.4, zorder=5)
ax.plot(0, 0, "k+", ms=7)
rot_arrow(ax, 0, 0, r1 + 0.45, 110, -40, C_RED)
rot_arrow(ax, 0, 0, r3 + 0.40, -40, 110, C_BLUE, lw=1.3)
rot_arrow(ax, 0, 0, dO - 0.32, -40, 110, C_ORANGE, lw=1.5)
ax.text(-r3 - 0.05, r3 + 0.55, "3", fontsize=11, ha="center")
ax.text(-0.16, r1 - 0.30, "1", fontsize=11, ha="right")
ax.text(dO + 0.25, r2 + 0.55, "2", fontsize=11, ha="left")
ax.text(0.55, 0.95, "H", fontsize=12, color=C_ORANGE)
ax.set_xlim(-r3 - 1.9, r3 + 2.1)
ax.set_ylim(-r3 - 2.5, r3 + 2.1)
if inv:
ax.text(0.65, -0.85, "H 为机架", fontsize=10.6, color=C_MAIN,
zorder=9,
bbox=dict(boxstyle="round,pad=0.30", fc="white",
ec=C_MAIN, lw=1.0, alpha=0.97))
ax.text(0, -r3 - 1.55,
r"$\omega_H^{H}=\omega_H-\omega_H=0$", ha="center",
fontsize=10.5, color=C_ORANGE)
ax.text(0, -r3 - 2.15,
"各构件角速度:$\\omega_i^{H}=\\omega_i-\\omega_H$",
ha="center", fontsize=10)
else:
ax.text(0, -r3 - 1.55,
r"$\omega_1,\ \omega_3,\ \omega_2$(2 既有自转又有公转)",
ha="center", fontsize=10)
ax.text(0, -r3 - 2.15, "不能直接求传动比", ha="center",
fontsize=10, color="#555555")
fig.tight_layout(rect=(0, 0.20, 1, 1))
fig.text(0.5, 0.03,
"反转原理:给整个周转轮系施加公共角速度 $-\\omega_H$,"
"各构件之间的相对运动不变,但系杆变为“静止”,\n"
"原周转轮系 → 转化轮系(定轴轮系),可直接套用定轴轮系的公式。",
ha="center", va="bottom", fontsize=10.8, linespacing=1.7,
bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2"))
save(fig, "figG05_inversion.png")
# =====================================================================
# figG06 周转轮系传动比通用公式 + 注意事项
# =====================================================================
def figG06():
fig, ax = free_ax(9.8, 5.4, (0, 10), (0, 5.4))
box(ax, 5.0, 4.82, 9.3, 0.80,
"$i_{GK}^{H}=\\dfrac{\\omega_G-\\omega_H}{\\omega_K-\\omega_H}"
"=\\pm\\dfrac{z_{\\mathrm{driven}}}{z_{\\mathrm{driver}}}$",
fs=15, fc="#eaf1f8", ec=C_BLUE)
box(ax, 5.0, 3.92, 9.3, 0.76,
"分子 = 转化轮系中 G→K 间所有从动轮齿数的连乘积;分母 = 所有主动轮齿数的连乘积\n"
"G=主动轮(通常为中心轮),K=从动轮,H=系杆;"
"$\\omega_G,\\omega_K,\\omega_H$ 为各构件的绝对角速度",
fs=10.3, fc="white", ec=C_GRAY)
items = [
"① 符号必须带正负号:转向相同取同号,转向相反取异号 —— "
"$\\omega$ 与 $n$ 可互换,但 $n$ 同样要带符号。",
"② 齿数比前的 $\\pm$ 由转化轮系中 $G\\to K$ 的外啮合次数 $m$ 决定,"
"取 $(-1)^m$;它只表示转化轮系中的转向,不代表两轮的实际转向。",
"③ 公式要求 $G$、$K$ 与系杆 $H$ 的轴线互相平行;空间(锥齿轮)周转轮系"
"也可用它求两中心轮与系杆之间的转速关系。",
"④ 若为行星轮系,$\\omega_G$、$\\omega_K$ 中必有一个为 0"
"(设 $\\omega_K=0$,则 $i_{GK}^{H}=\\dfrac{\\omega_G-\\omega_H}{-\\omega_H}$)。",
"⑤ 两齿轮轴线不平行时 $\\omega_2^{H}\\neq\\omega_2-\\omega_H$,"
"不能直接对行星轮本身套用此式,否则会得出错误结论。",
]
y = 3.03
for txt in items:
ax.text(0.20, y, txt, fontsize=10.3, ha="left", va="top", linespacing=1.6)
y -= 0.60
save(fig, "figG06_formula.png")
# =====================================================================
# figG07 复合轮系:划分基本轮系
# =====================================================================
def figG07():
fig, axes = grid(1, 2, 10.6, 5.6)
a, b = axes
# (a) 周转轮系 1-2-3-H
r1, r2, r3 = 1.2, 1.8, 4.8
dO = r1 + r2
assert abs((r3 - r2) - dO) < 1e-9
a.set_title("(a) 周转轮系 1–2–3–H(内齿圈 3 固定)", fontsize=10.8)
gear(a, 0, 0, r3, lw=1.8, teeth=60, tin=True)
gear(a, 0, 0, r1, lw=1.8, teeth=24)
gear(a, 0, dO, r2, lw=1.6, teeth=28)
line(a, (0, 0), (0, dO), color=C_ORANGE, lw=2.0, zorder=2)
gear(a, 0, 0, 0.32, fc=C_ORANGE, lw=1.3, zorder=5)
ground(a, 0, -r3 - 0.05, w=1.2, up=False)
rot_arrow(a, 0, 0, r1 + 0.42, 110, -40, C_RED)
rot_arrow(a, 0, 0, dO - 0.30, -40, 110, C_ORANGE, lw=1.6)
a.text(0.18, r1 - 0.35, "1", fontsize=11)
a.text(0.30, dO - 0.35, "2", fontsize=11)
a.text(-r3 - 0.15, r3 - 0.55, "3", fontsize=11, ha="right")
a.text(0.42, 1.30, "H", fontsize=12, color=C_ORANGE)
a.text(0, -r3 - 1.15, "输出 $\\omega_H$", ha="center", fontsize=10.5,
color=C_ORANGE)
a.text(0, -r3 - 1.95, "$z_1$=20,$z_2$=40,$z_3$=100", ha="center",
fontsize=10.2)
a.set_xlim(-r3 - 1.8, r3 + 1.8)
a.set_ylim(-r3 - 2.9, r3 + 1.5)
# (b) 定轴轮系 0-1
b.set_title("(b) 定轴轮系 0–1(与左图共用齿轮 1)", fontsize=10.8)
g0r, g1r = 1.5, 1.0
gear(b, -g1r, 0, g0r, lw=1.8, teeth=30)
gear(b, g0r, 0, g1r, lw=1.8, teeth=20)
shaft(b, -g1r, -g0r - 1.0, g0r + 1.0, lw=2.0)
shaft(b, g0r, -g1r - 1.0, g1r + 1.0, lw=2.0)
dot(b, 0.0, 0.0, C_RED, ms=6)
rot_arrow(b, -g1r, 0, g0r + 0.5, 110, -40, C_BLUE)
rot_arrow(b, g0r, 0, g1r + 0.5, -40, 110, C_RED, lw=1.5)
b.text(-g1r, g0r + 1.35, "0\n$z_0$=30", ha="center", va="bottom", fontsize=10.5)
b.text(g0r, g1r + 1.35, "1\n$z_1$=20", ha="center", va="bottom", fontsize=10.5)
b.annotate("", xy=(-3.55, 0.0), xytext=(-2.30, 0.0),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8))
b.text(-3.70, 0.0, "输入\n$\\omega_0$", ha="right", va="center",
fontsize=10.5, color=C_BLUE)
b.text(0, -g0r - 1.75,
"$i_{01}=\\dfrac{\\omega_0}{\\omega_1}=-\\dfrac{z_1}{z_0}"
"=-\\dfrac{20}{30}=-\\dfrac{2}{3}$",
ha="center", fontsize=11)
b.set_xlim(-5.6, 4.4)
b.set_ylim(-g0r - 2.7, g0r + 2.2)
fig.tight_layout(rect=(0, 0.24, 1, 1))
fig.text(0.5, 0.185,
"① 划分基本轮系:先找轴线不固定的行星轮 → 再找支承它的系杆 → "
"再找与行星轮啮合的太阳轮,剩下的就是定轴轮系",
ha="center", va="top", fontsize=10.5)
fig.text(0.5, 0.03,
"② 分别列式 ③ 用公共构件的转速联立:\n"
"$i_{1H}=1+\\dfrac{z_3}{z_1}=1+\\dfrac{100}{20}=6$"
" → $i_{0H}=i_{01}\\cdot i_{1H}"
"=\\left(-\\dfrac{2}{3}\\right)\\times6=-4$",
ha="center", va="bottom", fontsize=11, linespacing=1.9,
bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2"))
save(fig, "figG07_composite.png")
# =====================================================================
# figG08 轮系的功用
# =====================================================================
def _ic_gears(ax, x, y, s=0.34):
ax.add_patch(Circle((x - s * 0.9, y), s * 0.80, fc="#eaf1f8", ec=C_BLUE,
lw=1.5, zorder=3))
ax.add_patch(Circle((x + s * 1.0, y), s * 1.35, fc="#fdf2e5", ec=C_ORANGE,
lw=1.5, zorder=3))
def _ic_split(ax, x, y, s=0.46, n=3):
ax.annotate("", xy=(x + s * 0.4, y), xytext=(x - s * 1.1, y),
arrowprops=dict(arrowstyle="-|>", color=C_MAIN, lw=1.3))
for dy in np.linspace(s * 0.9, -s * 0.9, n):
ax.annotate("", xy=(x + s * 1.5, y + dy), xytext=(x + s * 0.45, y),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.1))
def _ic_reverse(ax, x, y, s=0.46):
ax.annotate("", xy=(x + s * 1.3, y + s * 0.45),
xytext=(x - s * 0.2, y + s * 0.45),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.5))
ax.annotate("", xy=(x - s * 0.2, y - s * 0.45),
xytext=(x + s * 1.3, y - s * 0.45),
arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=1.5))
def _ic_shift(ax, x, y, s=0.42):
ax.add_patch(Circle((x - s * 0.9, y - 0.10), s * 0.62, fc="#eaf1f8",
ec=C_BLUE, lw=1.5, zorder=3))
ax.add_patch(Circle((x + s * 0.85, y + 0.18), s * 0.95, fc="#fdf2e5",
ec=C_ORANGE, lw=1.5, zorder=3))
ax.annotate("", xy=(x + s * 0.85, y - s * 1.30),
xytext=(x - s * 0.9, y - s * 1.30),
arrowprops=dict(arrowstyle="-|>", color=C_PURPLE, lw=1.2))
def _ic_merge(ax, x, y, s=0.46):
for dy in (s * 0.85, -s * 0.85):
ax.annotate("", xy=(x + s * 0.6, y), xytext=(x - s * 1.1, y + dy),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.1))
ax.annotate("", xy=(x + s * 1.7, y), xytext=(x + s * 0.65, y),
arrowprops=dict(arrowstyle="-|>", color=C_RED, lw=1.6))
def _ic_power(ax, x, y, s=0.42):
ax.add_patch(Rectangle((x - s * 1.25, y - s * 0.85), s * 2.5, s * 1.7,
fc="#f4ecfa", ec=C_PURPLE, lw=1.4, zorder=3))
ax.text(x, y, "kW", fontsize=8.0, ha="center", va="center", color=C_PURPLE,
zorder=4)
def figG08():
fig, ax = free_ax(10.2, 6.8, (0, 12), (-0.55, 7.5))
cards = [
("①", "获得很大的传动比,结构紧凑",
"一对齿轮 $i<5\\sim7$;轮系 $i$ 可达 10000", _ic_gears),
("②", "实现分路传动", "钟表的时、分、秒针等(1 路输入 → 多路输出)", _ic_split),
("③", "实现换向传动", "改变从动轴的转向", _ic_reverse),
("④", "实现变速传动", "移动双联齿轮,改变输出轴转速", _ic_shift),
("⑤", "运动的合成(加减法运算)",
"差动轮系 $n_H=(n_1+n_3)/2$($z_1=z_2=z_3$)", _ic_merge),
("⑥", "运动的分解", "汽车差速器自动分配两后轮转速", _ic_split),
("⑦", "尺寸、重量较小时实现大功率传动",
"航空发动机主减 $\\phi$430 mm,2850 kW", _ic_power),
]
W, H = 5.85, 1.60
xs = [3.05, 8.95]
ys = [6.10, 4.34, 2.58, 0.82]
for i, (tag, title, desc, icon) in enumerate(cards):
cx, cy = xs[i % 2], ys[i // 2]
ax.add_patch(FancyBboxPatch((cx - W / 2, cy - H / 2), W, H,
boxstyle="round,pad=0.02,rounding_size=0.12",
fc="#fbfbf8", ec="#cfd6dd", lw=1.1, zorder=2))
ax.add_patch(Circle((cx - W / 2 + 0.42, cy + 0.42), 0.25,
fc="#eaf1f8", ec=C_BLUE, lw=1.0, zorder=3))
ax.text(cx - W / 2 + 0.42, cy + 0.42, tag, fontsize=10, ha="center",
va="center", zorder=4, color=C_BLUE)
icon(ax, cx - W / 2 + 1.32, cy - 0.02)
ax.text(cx - W / 2 + 2.22, cy + 0.38, title, fontsize=10.4, ha="left",
va="center", zorder=4)
ax.text(cx - W / 2 + 2.22, cy - 0.40, desc, fontsize=9.2, ha="left",
va="center", color="#555555", zorder=4)
ax.text(6.0, 7.24, "轮系的功用(共七个方面)", fontsize=13.5, ha="center",
va="center")
ax.text(6.0, -0.32, "轮系的用途:减速器、增速器、变速器、换向机构",
fontsize=10.2, ha="center", va="center", color="#555555")
save(fig, "figG08_functions.png")
# =====================================================================
# figG09 汽车差速器(运动分解)
# =====================================================================
def figG09():
fig, ax = new_ax(9.4, 6.6)
L = 3.0
P = (0.0, -7.0)
xl, xr = -L, L
for xx, col in ((xl, C_BLUE), (xr, C_ORANGE)):
line(ax, P, (xx, 0), color=col, lw=1.0, ls=":", zorder=1)
ax.add_patch(Arc(P, 2 * 2.2, 2 * 2.2, theta1=72, theta2=108,
color=C_MAIN, lw=1.3, zorder=2))
ax.text(0.55, -4.55, "$\\omega$", fontsize=13)
dot(ax, *P, C_MAIN, ms=6)
ax.text(0.45, -6.80, "$P$(转弯中心)", fontsize=10.5)
for xx, col in ((xl, C_BLUE), (xr, C_ORANGE)):
ax.add_patch(Rectangle((xx - 0.22, -0.95), 0.44, 1.90, fc="#e6e6e6",
ec=C_MAIN, lw=1.6, zorder=4))
ax.text(xl, 1.25, "轮1", color=C_BLUE, fontsize=11, ha="center")
ax.text(xr, 1.25, "轮3", color=C_ORANGE, fontsize=11, ha="center")
line(ax, (xl, 0), (xr, 0), C_MAIN, 2.0)
ax.add_patch(Rectangle((-0.95, -0.75), 1.90, 1.50, fc="#fdf2e5",
ec=C_ORANGE, lw=1.6, zorder=3))
ax.text(0, 0, "差速器", fontsize=9.5, ha="center", va="center", zorder=5,
color=C_ORANGE)
ax.text(0, 1.95, "$H$(行星架,由发动机驱动)", fontsize=10.2, ha="center",
color=C_ORANGE)
ax.annotate("", xy=(xl, -1.95), xytext=(xl, -0.95),
arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=2.0))
ax.text(xl, -2.35, "$v_1=(r-L)\\,\\omega$", color=C_BLUE, fontsize=11,
ha="center")
ax.annotate("", xy=(xr, -1.95), xytext=(xr, -0.95),
arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=2.6))
ax.text(xr, -2.35, "$v_3=(r+L)\\,\\omega$", color=C_ORANGE, fontsize=11,
ha="center")
ax.set_xlim(-4.3, 4.3)
ax.set_ylim(-8.5, 3.0)
fig.tight_layout(rect=(0, 0.30, 1, 1))
fig.text(0.5, 0.155,
"$z_1=z_3$(两半轴齿轮相同),$n_H=n_4$(行星架与壳体同速);"
"$n_H=\\dfrac{n_1+n_3}{2}$ → 行星架转速是两轮的“中间值”\n"
"该式只有 2 个方程、3 个未知数:直线行驶时还需 $n_1=n_3$ 才能求解",
ha="center", va="bottom", fontsize=10.3, linespacing=1.8,
bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2"))
fig.text(0.5, 0.02,
"转弯时车体绕 $P$ 点转动:$n_1/n_3=v_1/v_3=(r-L)/(r+L)$;"
"轮系按转弯半径自动把 $n_H$ 分解为 $n_1$、$n_3$\n"
"(内侧轮慢、外侧轮快),使车轮始终作纯滚动",
ha="center", va="bottom", fontsize=10.3, linespacing=1.8,
bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2"))
save(fig, "figG09_differential.png")
# =====================================================================
# figG10 行星轮系配齿四条件
# =====================================================================
def figG10():
fig, axes = grid(2, 2, 10.0, 7.8)
a, b, c, d = axes
r1, r2, r3 = 1.1, 0.85, 2.8
dO = r1 + r2
a.set_title("(a) 同心条件:$r_3=r_1+2r_2$ ($z_3=z_1+2z_2$)", fontsize=10.8)
gear(a, 0, 0, r3, lw=1.7, teeth=48, tin=True)
gear(a, 0, 0, r1, lw=1.7, teeth=24)
gear(a, dO, 0, r2, lw=1.6, teeth=18)
line(a, (0, 0), (0, -r3 - 0.55), C_GRAY, 1.0)
line(a, (0, 0), (dO, 0), C_GRAY, 0.9)
a.annotate("", xy=(0, 0.28), xytext=(0, 1.38),
arrowprops=dict(arrowstyle="<->", color=C_BLUE, lw=1.3))
a.text(0.16, 0.83, "$r_1$", color=C_BLUE, fontsize=11)
a.annotate("", xy=(dO, 0.28), xytext=(dO, 1.95),
arrowprops=dict(arrowstyle="<->", color=C_GREEN, lw=1.3))
a.text(dO + 0.16, 1.11, "$r_2$", color=C_GREEN, fontsize=11)
a.annotate("", xy=(-0.55, -r3 + 0.05), xytext=(-0.55, -r3 - 0.55),
arrowprops=dict(arrowstyle="<->", color=C_ORANGE, lw=1.3))
a.text(-0.42, -r3 - 0.25, "$r_3$", color=C_ORANGE, fontsize=11)
a.text(0, r3 + 0.95, "两中心轮齿数应同时为偶数或奇数", fontsize=9.8,
ha="center")
a.set_xlim(-3.4, 4.6)
a.set_ylim(-r3 - 1.3, r3 + 1.5)
b.set_title("(b) 装配条件:$(z_1+z_3)/N$ 必须为整数", fontsize=10.8)
gear(b, 0, 0, r3, lw=1.6, teeth=40, tin=True)
gear(b, 0, 0, r1, lw=1.7, teeth=24)
for ang in (0, 120, 240):
t = np.radians(ang)
px, py = dO * np.cos(t), dO * np.sin(t)
gear(b, px, py, r2, lw=1.5, teeth=16)
line(b, (0, 0), (px, py), C_ORANGE, 1.6, zorder=2)
b.add_patch(Arc((0, 0), 2 * 1.72, 2 * 1.72, theta1=0, theta2=120,
color=C_PURPLE, lw=1.5))
b.text(2.30, 2.45, "$\\varphi_H=2\\pi/N$", color=C_PURPLE, fontsize=10.5,
ha="left", va="center")
lead(b, (0.86, 1.49), (2.20, 2.36), C_PURPLE, 0.9)
b.text(0, -r3 - 0.95, "$N$=行星轮个数;$K=z_1 i_{1H}/N$ 须为整数",
fontsize=9.8, ha="center")
b.set_xlim(-3.4, 4.6)
b.set_ylim(-r3 - 1.6, r3 + 1.4)
c.set_title("(c) 邻接条件:$O_1O_2>2r_{a2}$", fontsize=10.8)
rc, r2c, dOc = 0.60, 0.75, 1.35
gear(c, 0, 0, rc, lw=1.7, teeth=18, fc="#fdf2e5")
t1 = np.radians(105)
p1 = (dOc * np.cos(t1), dOc * np.sin(t1))
p2 = (dOc * np.cos(t1 + np.radians(120)), dOc * np.sin(t1 + np.radians(120)))
for p in (p1, p2):
gear(c, p[0], p[1], r2c, lw=1.5, teeth=14)
line(c, (0, 0), p, C_ORANGE, 1.3, zorder=2)
dot(c, p[0], p[1], C_RED, ms=6)
c.add_patch(Arc(p1, 2 * (r2c + 0.20), 2 * (r2c + 0.20),
theta1=np.degrees(t1) - 160, theta2=np.degrees(t1) - 30,
color=C_GREEN, lw=1.4, ls=":"))
line(c, p1, p2, C_RED, 1.8, ls="--", zorder=1)
c.text(p1[0] - 0.15, p1[1] + 1.00, "$O_1$", color=C_RED, fontsize=10.5,
ha="center")
c.text(p2[0] - 1.15, p2[1] - 0.85, "$O_2$", color=C_RED, fontsize=10.5,
ha="center")
lead(c, p1, (p1[0] - 0.12, p1[1] + 0.92), C_GRAY, 0.9)
lead(c, p2, (p2[0] - 1.10, p2[1] - 0.80), C_GRAY, 0.9)
c.text(0.92, 0.05, "太阳轮\n(中心轮)", fontsize=9.2, ha="left",
va="center", color=C_ORANGE)
lead(c, (0.75, 0.02), (0.88, 0.05), C_GRAY, 0.9)
c.text(0.62, 1.28, "行星轮", fontsize=9.2, ha="left",
va="center", color=C_MAIN)
lead(c, (p1[0] + 0.78, p1[1]), (0.58, 1.28), C_GRAY, 0.9)
c.text(0.75, -2.15, "$O_1O_2>2r_{a2}=2(r_2+h_a^{*}m)$",
fontsize=9.8, ha="left", va="center", color="#555555")
c.text(-2.55, -2.15, "$(z_1+z_2)\\sin\\dfrac{\\pi}{N}>z_2+2h_a^{*}$",
fontsize=11, ha="left", va="center")
c.set_xlim(-2.9, 3.3)
c.set_ylim(-2.6, 2.9)
d.set_title("(d) 配齿公式(前三个条件合并)", fontsize=10.8)
d.text(0.55, 0.55,
"$z_2=\\dfrac{z_1\\,(i_{1H}-2)}{2}$\n\n"
"$z_3=z_1\\,(i_{1H}-1)$\n\n"
"$K=\\dfrac{z_1\\,i_{1H}}{N}$",
fontsize=13, ha="center", va="center", linespacing=1.6)
d.text(0.55, -1.35,
"$z_1,z_2,z_3,K$ 均须为正整数,且 $z_1,z_2,z_3>z_{\\min}$",
fontsize=9.8, ha="center", va="center", color="#333333",
bbox=dict(boxstyle="round,pad=0.40", fc="#fbfbf6", ec="#d9d2c2"))
d.set_xlim(-0.75, 1.85)
d.set_ylim(-2.1, 1.9)
fig.tight_layout()
save(fig, "figG10_assembly.png")
# =====================================================================
# figG11 少齿差行星传动(K-H-V / 孔销式输出机构)
# =====================================================================
def figG11():
fig, axes = grid(1, 2, 10.6, 5.8)
a, b = axes
a.set_title("(a) 渐开线少齿差(K-H-V 型):$z_2-z_1=1\\sim4$", fontsize=10.8)
R1, R2 = 6.0, 5.0
off = R1 - R2
gear(a, 0, 0, R1, lw=1.9, teeth=72, tin=True)
gear(a, off, 0, R2, lw=1.9, teeth=60, fc="#eaf1f8")
line(a, (0, 0), (off, 0), C_ORANGE, 2.2, zorder=2)
gear(a, 0, 0, 0.45, fc=C_ORANGE, lw=1.4, zorder=5)
a.plot(0, 0, "k+", ms=8)
dot(a, R1, 0, C_RED, ms=6)
rot_arrow(a, 0, 0, R1 + 0.50, 110, -40, C_BLUE, lw=1.5)
rot_arrow(a, off, 0, 1.30, -40, 110, C_ORANGE, lw=1.8)
a.text(0, R1 + 0.95, "1 内齿圈(固定)", fontsize=10.3, ha="center")
a.text(off, -1.85, "2 行星轮", fontsize=10.3, ha="center")
a.text(off * 0.5 + 0.18, 0.58, "$H$", color=C_ORANGE, fontsize=12)
a.text(0, -R1 - 1.30,
"$i_{H2}=\\dfrac{\\omega_H}{\\omega_2}=-\\dfrac{z_1}{z_2-z_1}$"
" ($z_1$=100,$z_2$=101 时 $i_{H2}=-100$)",
fontsize=10.5, ha="center", va="top")
a.text(0, -R1 - 2.85,
"系杆主动、行星轮作平面运动,须加输出机构 V 引出其自转",
fontsize=10.0, ha="center", va="top", color="#555555")
a.set_xlim(-R1 - 1.6, R1 + 1.8)
a.set_ylim(-R1 - 3.2, R1 + 1.8)
b.set_title("(b) 孔销式输出机构:$d_h=d_s+2a$", fontsize=10.8)
rho, aa = 2.50, 0.85
OV = (-3.90, -1.50)
O2 = (OV[0] - aa, OV[1])
th = np.radians(62)
oh = (OV[0] + rho * np.cos(th), OV[1] + rho * np.sin(th))
os_ = (O2[0] + rho * np.cos(th), O2[1] + rho * np.sin(th))
line(b, OV, oh, C_PURPLE, 1.6, zorder=3)
line(b, oh, os_, C_RED, 1.8, ls="--", zorder=4)
line(b, os_, O2, C_GREEN, 1.6, zorder=3)
line(b, O2, OV, C_RED, 1.8, ls="--", zorder=4)
for p, col in ((OV, C_PURPLE), (oh, C_PURPLE), (os_, C_GREEN),
(O2, C_GREEN)):
dot(b, p[0], p[1], col, ms=6)
b.text(OV[0], OV[1] - 0.60, "$O_V$", color=C_PURPLE, fontsize=10.5,
ha="center", va="top")
b.text(O2[0], O2[1] - 0.60, "$O_2$", color=C_GREEN, fontsize=10.5,
ha="center", va="top")
b.text(oh[0] + 0.18, oh[1] + 0.10, "$o_h$", color=C_PURPLE, fontsize=10.5,
ha="left", va="bottom")
b.text(os_[0] - 0.20, os_[1] - 0.55, "$o_s$", color=C_GREEN, fontsize=10.5,
ha="center", va="top")
b.text(-3.90, -2.70, "四圆心连成平行四边形", fontsize=9.4, ha="center",
color="#555555")
cx0, cy0 = 2.20, 0.60
rh, rs = 0.90, 0.55
b.add_patch(Circle((cx0, cy0), rh, fc="white", ec=C_PURPLE, lw=1.8, zorder=5))
b.add_patch(Circle((cx0 - (rh - rs), cy0), rs, fc="#eaf7ea", ec=C_GREEN,
lw=1.8, zorder=6))
dot(b, cx0, cy0, C_PURPLE, ms=6)
dot(b, cx0 - (rh - rs), cy0, C_GREEN, ms=6)
dot(b, cx0 - rh, cy0, C_RED, ms=5)
b.text(cx0, cy0 + rh + 0.28, "销孔 $d_h$", color=C_PURPLE,
fontsize=9.8, ha="center", va="bottom")
b.text(cx0, cy0 - rh - 0.28, "销轴 $d_s$", color=C_GREEN,
fontsize=9.8, ha="center", va="top")
b.text(cx0 - rh - 0.15, cy0 + 0.22, "始终相切", color=C_RED, fontsize=9.4,
ha="right", va="center")
b.text(cx0, -1.55, "$d_h=d_s+2a$", fontsize=12.5, ha="center")
b.set_xlim(-5.0, 4.4)
b.set_ylim(-3.3, 3.1)
fig.tight_layout(rect=(0, 0.16, 1, 1))
fig.text(0.5, 0.02,
"四个圆心:输出盘中心 $O_V$、销孔中心 $o_h$、销轴中心 $o_s$、"
"行星轮中心 $O_2$ —— 构成平行四边形;\n"
"$d_h$=销孔直径,$d_s$=销轴直径,$a$=行星轮与输出盘的中心距(偏心距)",
ha="center", va="bottom", fontsize=10.2, linespacing=1.8,
bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2"))
save(fig, "figG11_small_diff.png")
if __name__ == "__main__":
for f in [figG01, figG02, figG03, figG04, figG05, figG06, figG07,
figG08, figG09, figG10, figG11]:
try:
f()
except Exception as e:
import traceback
print("FAILED", f.__name__, "->", repr(e))
traceback.print_exc()
print("done")