Max operation rules

From IvanYangYangXi/artclaw_bridge · View interactive version

Max operation rules is an AI agent skill from the GitHub repository IvanYangYangXi/artclaw_bridge. 3ds Max 操作通用规则和最佳实践。所有涉及 Max 场景修改的操作都必须遵守。 AI 在执行任何 3ds Max 场景操作任务前应先读取此 Skill。 包含:坐标系、撤销管理、脚本输出等强制规则。 Use when AI needs to: (1) perform any 3ds Max scene modification, (2) check post-operation best practices, (3) understand 3ds Max coordinate system. 3ds Max only (run_python).

How to use this skill

Skill file

3ds Max 操作通用规则

所有涉及 3ds Max 场景修改的操作都必须遵守以下规则。

⚠️ 仅适用于 3ds Max — 通过 run_python 执行


🌐 规则 0:坐标系

3ds Max 使用 Z-Up 右手坐标系:

| 轴 | 方向 | 说明 |

|---|---|---|

| X | 右 (Right) | 屏幕右侧 |

| Y | 屏幕里 (Away from Viewer) | 面向屏幕时指向屏幕深处 |

| Z | 上 (Up) | 垂直向上 |

右手系判定:右手拇指指向 X(右),食指指向 Y(屏幕里),中指指向 Z(上)。

注意:Max 的 Y 轴方向与 Maya 正好相反(Max Y 指向屏幕里,Maya Z 指向屏幕外)。

与其他 DCC 的换算:

from pymxs import runtime as rt

# Max 坐标示例
box = rt.Box()
box.pos = rt.Point3(10, 20, 5)  # X=右10, Y=屏幕里20, Z=上5
box.rotation = rt.EulerAngles(45, 0, 0)  # 绕 X 轴旋转 45°

🔄 规则 1:批量操作使用 Undo 管理

使用 theHold 或 undo() 上下文确保操作可撤销。

from pymxs import runtime as rt

# 方式 1:undo 上下文(推荐)
with rt.undo(True, 'ArtClaw_BatchOperation'):
    # ... 所有修改操作 ...
    pass

# 方式 2:MAXScript undo
rt.execute('undo "ArtClaw Op" on ( /* operations */ )')

何时使用 Undo 包裹


🖨️ 规则 2:输出方式

Max Python 中 print 输出到 MAXScript Listener。确保重要信息用 print 输出。

# ✅ 输出到 Listener
print("操作完成: 已修改 5 个对象")

💡 规则 3:提示用户可撤销

对场景进行修改后,应告知用户:


📋 规则 4:操作前确认(破坏性操作)

以下操作执行前应向用户确认:

非破坏性操作(调整参数、移动位置等)可以直接执行。


📂 规则 5:中文版 Max 路径注意

3ds Max 中文版的脚本/插件路径可能包含 locale 子目录:

# 常见 locale 目录
CHS/  (简体中文)
ENU/  (英文)
JPN/  (日文)

安装脚本时应自动检测 locale 目录并同步部署。


🔧 标准操作收尾模板

from pymxs import runtime as rt

with rt.undo(True, 'ArtClaw_Operation'):
    # ... 所有操作代码 ...
    pass

print("✅ 操作完成")
# 提示:可用 Ctrl+Z 撤销

🧠 规则 6:记忆系统集成

反复出错时主动查记忆 (强制)

当同一类操作连续失败 2 次以上时,必须先搜索记忆再继续尝试:

from core.memory_store import get_memory_store
mm = get_memory_store()
if mm:
    hints = mm.manager.search("相关关键词", tag="crash", limit=3)
    hints += mm.manager.search("相关关键词", tag="pattern", limit=3)
    team = mm.manager.search_team_memory("相关关键词", limit=3)

多次尝试后成功时提炼教训 (强制)

经过 2 次以上尝试或用户纠正后才正确完成操作时,必须提炼规则并写入记忆:

mm.manager.record(
    key="pattern:简短问题描述",
    value="一句话规则:什么情况 + 正确做法",
    tag="pattern",
    importance=0.8,
    source="retry_learned"
)

发现反直觉行为时记录 (强制)

mm.manager.record(
    key="pattern:API或行为描述",
    value="实际行为 vs 预期行为,正确用法",
    tag="pattern",
    importance=0.9,
    source="gotcha"
)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.