Files
reducers/backend/skill/references/reducer-generation-flow.md
T

111 lines
2.7 KiB
Markdown

# Reducer Generation Flow
## 1. 确认项目根目录
工作目录必须是项目根目录,并且至少包含:
```text
pyproject.toml
src/
input/
output/
```
如果这些目录不存在,不要猜测路径,也不要在其他目录生成文件。先报告 `project_root_not_found`。
## 2. 选择输入
普通减速器 requirement 必须来自:
```text
input/requirements/reducers/
```
关节模组 requirement 必须来自:
```text
input/requirements/joint_modules/
```
自动关节设计使用的电机 STEP 和外壳 Python 必须来自:
```text
input/assets/
```
不要读取旧 `output/runs` 的结果作为本次设计依据。旧输出只能用于用户明确要求“查看历史结果”时读取,不能作为验证通过依据。
## 3. 执行 reducer run
优先使用一条 `run` 命令完成求解、CAD 生成、读回和验证:
```bash
PYTHONPATH=/Users/lk/Projects/cadSet/SimpleCADAPI/src:. \
/Users/lk/miniconda3/bin/python -m src.cli run \
--input input/requirements/reducers/simple_2k_h/simple_2kh_industrial_ratio_7p5_spur.json \
--output output/runs/industrial_ratio_7p5_spur
```
只有调试单阶段问题时才拆开执行 `solve`、`generate`、`validate`。
## 4. 执行 joint-run
关节模组使用:
```bash
PYTHONPATH=/Users/lk/Projects/cadSet/SimpleCADAPI/src:. \
/Users/lk/miniconda3/bin/python -m src.cli joint-run \
--input input/requirements/joint_modules/3500_motor_housing.json \
--output output/runs/joint_3500_motor_housing
```
执行后必须读取:
```text
output/runs/<run>/joint_module_validation_report.json
output/runs/<run>/joint_module_manifest.json
```
## 5. 执行 auto-joint-run
自动关节设计使用:
```bash
PYTHONPATH=/Users/lk/Projects/cadSet/SimpleCADAPI/src:. \
/Users/lk/miniconda3/bin/python -m src.cli auto-joint-run \
--motor-step input/assets/motors/3500_motor_part2.step \
--housing-python input/assets/housings/gear_housing.py \
--output output/runs/auto_joint_3500
```
如果外壳包络不足、轴线识别失败或几何干涉失败,必须报告失败,不能调整报告为通过。
## 6. 判断结果
Reducer run 成功标准:
```text
validation/validation_report.json overall_passed == true
cad/reducer.step exists and non-empty
placement/placement_plan.json exists
```
Joint run 成功标准:
```text
joint_module_validation_report.json overall_passed == true
joint_module.step exists and non-empty
reducer/validation/validation_report.json exists
```
## 7. 返回给用户
必须返回 Markdown 文件链接,例如:
```markdown
[reducer.step](</absolute/path/output/runs/name/cad/reducer.step>)
[validation_report.json](</absolute/path/output/runs/name/validation/validation_report.json>)
```
不要只返回纯路径。