feat(arm): 建模代码拆成每件一模块,查看器新增工程图与装配步骤页

- src/parts/p01~p09 + src/part_tools.py:几何、件号/配色/说明与装配帧归属随各自件文件走,arm_model.py 只留装配流水线并对件级符号做只读转发;P04_CH / P07_CH / P06_WIN_XZ / FENCE_OPEN_CUT 这类开关必须写所在件文件,写 arm_model.X 不生效,A/B 判据为翻转后体积变化
- docs/sheet_{exploded,front,side,joint}.svg + draw_sheet.py:四张工程图进查看器页签,支持图层开关、件号高亮与 BOM/3D 联动跳转
- travel/travel_detail/collide/bom/screws 随最新几何重生成;补线束走线、拆卸定位点与 P04 承压面剖切验证图
- .gitignore 排除 .bak/ 与 *.bak_* 源码快照(旧版本 git 历史里已有)
This commit is contained in:
cbb
2026-10-14 22:03:18 +08:00
parent c754521bde
commit b0efb44368
72 changed files with 94603 additions and 90905 deletions
+24 -25
View File
@@ -30,19 +30,18 @@ def catmull_rom_sample(pts, num_samples_per_seg=25):
def load_solids():
clfs = {}
for prefix in ['P01_C', 'P03', 'P04', 'P05', 'P06', 'P07', 'P08']:
for f in os.listdir('out/parts_step'):
if f.startswith(prefix):
print(f"Loading {prefix} ({f})...", flush=True)
shape = cq.importers.importStep(os.path.join('out/parts_step', f)).val()
clfs[prefix] = BRepClass3d_SolidClassifier(shape.wrapped)
break
for f in os.listdir('out/parts_step'):
if f.endswith('.step'):
tag = f.split('.')[0]
print(f"Loading {tag}...", flush=True)
shape = cq.importers.importStep(os.path.join('out/parts_step', f)).val()
clfs[tag] = BRepClass3d_SolidClassifier(shape.wrapped)
return clfs
def main():
clfs = load_solids()
print("=" * 80)
print("【线束三维物理干涉检测】全通道与 22x22mm 接口零碰撞验证")
print("【线束三维物理干涉检测】全通道、外侧走线与电机全固态零碰撞验证")
print("=" * 80)
with open('src/viewer_tpl.html', 'r', encoding='utf-8') as f:
@@ -67,42 +66,42 @@ def main():
checked_count += len(sampled)
if hits:
total_hits += len(hits)
print(f" ❌ FAIL: {name} (发现 {len(hits)} 处实体穿透! 首击穿部件: {hits[0][0]} 坐标: {hits[0][1]})")
print(f" ❌ FAIL: {name} (发现 {len(hits)} 处实体穿透! 首击穿部件: {hits[0][0]} 坐标: {hits[0][1]})", flush=True)
else:
print(f" ✓ PASS: {name} ({len(sampled)} 采样点零干涉)")
print(f" ✓ PASS: {name} ({len(sampled)} 采样点零干涉)", flush=True)
# Test dynamic bridges at zero pose
bridge_specs = [
('Bridge 1 (J1 轴向扭转段)', [[-15.0, 128.0, 610.0], [0.0, 128.0, 610.0], [15.0, 128.0, 610.0]], ['P03', 'P04']),
('Bridge 2 (J2 俯仰跨越段)', [[28.0, 115.0, 480.0], [26.5, 115.0, 467.5], [25.0, 115.0, 455.0]], ['P04', 'P05']),
('Bridge 3 (J3 旋转过渡段)', [[25.0, 90.0, 390.0], [25.0, 90.0, 381.0], [25.0, 90.0, 372.0]], ['P05', 'P06']),
('Bridge 4 (J4 俯仰跨越段)', [[25.0, 115.0, 294.0], [22.0, 140.0, 294.0], [19.5, 160.0, 296.5]], ['P06', 'P07']),
('Bridge 5 (J5 俯仰跨越段)', [[25.0, 115.0, 190.0], [25.0, 115.0, 187.5], [25.0, 115.0, 185.0]], ['P07', 'P08']),
('Bridge 1 (J1 Ω-Loop 柔性缓冲段)', [[5.5, 86.1, 610.0], [9.13, 79.4, 611.9], [12.75, 76.78, 613.5], [16.38, 79.85, 614.4], [20.0, 87.0, 615.0]]),
('Bridge 2 (J2 U-Loop 柔性缓冲段)', [[-17.5, 102.5, 485.0], [-25.0, 102.5, 475.0], [-30.0, 102.5, 465.0], [-25.0, 102.5, 455.0], [-17.5, 102.5, 445.0]]),
('Bridge 3 (J3 螺旋柔性过渡段)', [[-17.5, 102.5, 400.0], [-24.0, 96.0, 390.0], [-27.0, 93.0, 380.0], [-23.0, 96.0, 370.0], [-17.5, 102.5, 360.0]]),
('Bridge 4 (J4 肘部U-Loop柔性缓冲段)', [[-17.5, 102.5, 305.0], [-24.0, 102.5, 290.0], [-30.0, 102.5, 280.0], [-24.0, 102.5, 270.0], [-17.5, 102.5, 255.0]]),
('Bridge 5 (J5 腕部U-Loop柔性缓冲段)', [[-17.5, 102.5, 205.0], [-22.0, 102.5, 195.0], [-26.0, 102.5, 190.0], [-22.0, 102.5, 182.0], [-17.5, 102.5, 175.0]]),
]
for name, pts, parts in bridge_specs:
for name, pts in bridge_specs:
sampled = catmull_rom_sample(pts, num_samples_per_seg=25)
hits = []
for p in sampled:
pt = gp_Pnt(float(p[0]), float(p[1]), float(p[2]))
for part in parts:
clf = clfs.get(part)
if not clf: continue
for part, clf in clfs.items():
clf.Perform(pt, 1e-3)
if clf.State() == TopAbs_IN:
hits.append((part, p))
checked_count += len(sampled)
if hits:
total_hits += len(hits)
print(f" ❌ FAIL: {name} (发现 {len(hits)} 处实体穿透!)")
print(f" ❌ FAIL: {name} (发现 {len(hits)} 处实体穿透!)", flush=True)
else:
print(f" ✓ PASS: {name} ({len(sampled)} 采样点零干涉)")
print(f" ✓ PASS: {name} ({len(sampled)} 采样点零干涉)", flush=True)
print("=" * 80)
print(f"【最终结论】共评估 {checked_count} 个空间采样点,固体穿透总数: {total_hits}")
print("=" * 80, flush=True)
print(f"【最终结论】共评估 {checked_count} 个空间采样点,固体穿透总数: {total_hits}", flush=True)
if total_hits == 0:
print("🎉 恭喜!线束系统已实现 100% 结构腔体内规范走线与零碰撞干涉!")
print("=" * 80)
print("🎉 恭喜!线束系统已实现 100% 结构腔体内规范走线与零碰撞干涉!", flush=True)
print("=" * 80, flush=True)
import os
os._exit(0 if total_hits == 0 else 1)
if __name__ == '__main__':
main()