3dsmax Scripting 标志

3dsmax Scripting

组织
TerminalSkills
3dsmax-scripting

使用 MAXScript 和 Python 自动化 3ds Max,涵盖场景操作、对象创建、材质分配、相机设置、批量操作、UI 工具和文件 I/O。适用于自动化重复的 3ds Max 工作流、批量处理场景、创建自定义工具,或为建筑可视化、产品可视化和 VFX 编写场景设置脚本等任务。

Add to TypingMind

概览

发布者TerminalSkills
代码仓库skills
技能名称3dsmax-scripting
星标数
155
复刻数
21
附带文件
1
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 TerminalSkills 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 3dsmax Scripting AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/TerminalSkills/skills/tree/main/skills/3dsmax-scripting
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TerminalSkills/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/3dsmax-scripting .claude/skills/3dsmax-scripting
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 3dsmax Scripting,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 3dsmax Scripting。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 3dsmax Scripting 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

3ds Max Scripting

Automate 3ds Max workflows with MAXScript (native) and Python (3ds Max 2022+).

MAXScript Basics

MAXScript is 3ds Max's built-in scripting language. Run scripts from the MAXScript Listener (F11), Script Editor, or command line.

Objects and Scene

maxscript
-- Create objects
local b = Box width:100 height:50 length:100 pos:[0, 0, 0] name:"MyBox"
local s = Sphere radius:25 pos:[200, 0, 25] segments:32
local p = Plane width:500 length:500 pos:[0, 0, 0]

-- Access objects
local obj = $MyBox              -- By name ($ selector)
local obj = getNodeByName "MyBox"  -- By name (function)
local all = objects              -- All scene objects
local sel = selection            -- Current selection

-- Transform
obj.pos = [100, 200, 0]         -- Position
obj.rotation = eulerAngles 0 0 45  -- Rotation (degrees)
obj.scale = [2, 2, 2]           -- Scale

-- Properties
obj.wirecolor = color 255 0 0   -- Wireframe color
obj.renderable = true
obj.isHidden = false

-- Iterate all objects
for obj in objects do (
    if classOf obj == Box then (
        format "Box: % at %\n" obj.name obj.pos
    )
)

Materials

maxscript
-- Standard material
local mat = StandardMaterial()
mat.name = "Red Glossy"
mat.diffuseColor = color 200 30 30
mat.specularLevel = 80
mat.glossiness = 60

-- V-Ray material (requires V-Ray installed)
local vmat = VRayMtl()
vmat.name = "Wood Floor"
vmat.diffuse = color 180 140 100
vmat.reflection = color 30 30 30         -- Subtle reflection
vmat.reflectionGlossiness = 0.85          -- Slightly rough
vmat.texmap_diffuse = BitmapTexture filename:"D:/textures/wood_diffuse.jpg"
vmat.texmap_bump = BitmapTexture filename:"D:/textures/wood_normal.jpg"
vmat.texmap_bump_multiplier = 1.5         -- Bump strength

-- Apply material to object
$MyBox.material = vmat

-- Multi-sub material (different material per face ID)
local multi = MultiSubMaterial numsubs:3
multi[1] = VRayMtl name:"Wall Paint" diffuse:(color 240 238 232)
multi[2] = VRayMtl name:"Wood Trim" diffuse:(color 160 120 80)
multi[3] = VRayMtl name:"Glass" diffuse:(color 200 220 230) refraction:(color 250 250 250)

Cameras

maxscript
-- V-Ray Physical Camera (archviz standard)
fn createArchvizCamera name pos target fov:65.0 = (
    local cam = VRayPhysicalCamera()
    cam.name = name
    cam.pos = pos
    cam.targeted = true
    cam.target.pos = target

    -- Lens
    cam.specify_fov = true
    cam.fov = fov

    -- Exposure
    cam.ISO = 400
    cam.shutter_speed = 60.0
    cam.f_number = 2.8

    -- Auto white balance
    cam.white_balance_preset = 1  -- Daylight

    -- Vertical correction (crucial for archviz — keeps verticals straight)
    cam.auto_vertical_tilt_correction = 1.0

    cam
)

createArchvizCamera "LivingRoom" [5, -3, 1.5] [-2, 5, 1.2] fov:75

Lights

maxscript
-- V-Ray Sun + Sky (exterior lighting)
local sun = VRaySun pos:[100, -50, 80]
sun.intensity_multiplier = 1.0
sun.size_multiplier = 3.0          -- Soft shadows
sun.turbidity = 3.0                -- Atmosphere haze

-- V-Ray Rectangle Light (interior fill)
local rect = VRayLight()
rect.type = 1                       -- Plane light
rect.pos = [0, 0, 2.8]             -- Ceiling height
rect.multiplier = 15.0
rect.color = color 255 244 229      -- Warm white (3000K)
rect.width = 60
rect.height = 60
rect.invisible = true               -- Don't render the light shape

-- V-Ray IES Light (architectural fixtures)
local ies = VRayIES()
ies.pos = [1.5, 3.0, 2.7]
ies.ies_file = "D:/ies/downlight.ies"
ies.multiplier = 800.0              -- Lumens
ies.color_mode = 1                  -- Temperature
ies.color_temperature = 3000        -- Warm

File I/O

maxscript
-- Read JSON config (3ds Max 2022+)
fn readJSON path = (
    local f = openFile path mode:"r"
    local str = ""
    while not eof f do str += readLine f + "\n"
    close f
    -- Use .NET JSON parser
    local jObj = (dotNetClass "Newtonsoft.Json.Linq.JObject").Parse str
    jObj
)

-- Write log file
fn writeLog path msg = (
    local f = openFile path mode:"a"
    if f == undefined then f = createFile path
    format "% | %\n" localTime msg to:f
    close f
)

-- Import/export
importFile "D:/models/furniture.fbx" #noPrompt
exportFile "D:/export/scene.fbx" #noPrompt selectedOnly:true

Python in 3ds Max

3ds Max 2022+ includes Python 3 with pymxs module for accessing MAXScript objects:

python
"""scene_audit.py — Audit scene for common archviz issues."""
import pymxs
from pymxs import runtime as rt

def audit_scene():
    """Check scene for common issues: missing textures, high-poly objects, etc."""
    issues = []

    for obj in rt.objects:
        # Check for high-poly objects (>500K faces in archviz is suspicious)
        if rt.classOf(obj) in [rt.Editable_Poly, rt.Editable_Mesh]:
            face_count = rt.getNumFaces(obj)
            if face_count > 500000:
                issues.append(f"High poly: {obj.name} ({face_count:,} faces)")

        # Check for missing materials
        if obj.material is None and obj.renderable:
            issues.append(f"No material: {obj.name}")

    # Check for missing texture files
    for mat in rt.sceneMaterials:
        check_material_textures(mat, issues)

    return issues

def check_material_textures(mat, issues):
    """Recursively check material tree for missing texture files."""
    if hasattr(mat, 'texmap_diffuse') and mat.texmap_diffuse:
        tex = mat.texmap_diffuse
        if hasattr(tex, 'filename') and tex.filename:
            import os
            if not os.path.exists(tex.filename):
                issues.append(f"Missing texture: {tex.filename} (in {mat.name})")

Batch Operations

Command Line Rendering

bash
# Render a scene from command line (no GUI)
"C:\Program Files\Autodesk\3ds Max 2025\3dsmax.exe" ^
  -silent -mxs "loadMaxFile \"D:/scene.max\"; render()" ^
  -o "D:/output/render.exr" -w 4000 -h 2250

# Run a MAXScript file
3dsmax.exe -silent -mxs "fileIn \"D:/scripts/batch_render.ms\""

# Run with specific camera
3dsmax.exe -silent -mxs "loadMaxFile \"D:/scene.max\"; viewport.setCamera (getNodeByName \"Camera01\"); render()"

Batch Process Multiple Files

maxscript
-- batch_process.ms — Process all .max files in a directory

fn processAllScenes folderPath = (
    local files = getFiles (folderPath + "/*.max")
    local results = #()

    for f in files do (
        format "Processing: %\n" f
        loadMaxFile f quiet:true

        -- Do something with each scene
        local objCount = objects.count
        local camCount = (for c in cameras where classOf c != Targetobject collect c).count

        append results #(getFilenameFile f, objCount, camCount)

        resetMaxFile #noPrompt
    )

    results
)

Scene Management

maxscript
-- Layer management
fn organizeByType = (
    local layerMgr = LayerManager

    -- Create layers
    local furnitureLayer = layerMgr.newLayerFromName "Furniture"
    local architectureLayer = layerMgr.newLayerFromName "Architecture"
    local lightsLayer = layerMgr.newLayerFromName "Lights"

    for obj in objects do (
        case (superClassOf obj) of (
            Light: lightsLayer.addNode obj
            default: (
                if matchPattern obj.name pattern:"*chair*" or
                   matchPattern obj.name pattern:"*table*" or
                   matchPattern obj.name pattern:"*sofa*" then
                    furnitureLayer.addNode obj
                else
                    architectureLayer.addNode obj
            )
        )
    )
)

-- Selection sets
selectionSets["Interior Cameras"] = for c in cameras where
    matchPattern c.name pattern:"int_*" collect c

-- Named selection sets for render elements
fn selectByMaterialName matName = (
    select (for obj in objects where obj.material != undefined and
            obj.material.name == matName collect obj)
)

Guidelines

  • Always #noPrompt for batch operations — without it, file dialogs block script execution
  • Use undo on blocks for destructive operations — wrap scene changes so they can be undone
  • gc() (garbage collect) in loops — MAXScript leaks memory in long-running scripts. Call gc light:true periodically.
  • Test in Listener first — debug scripts interactively before running them in batch mode
  • V-Ray objects require V-Ray loaded — check renderers.current before creating V-Ray-specific objects
  • File paths use forward slashes or escaped backslashes — "D:/path" or "D:\\path", never raw "D:\path"
  • Python pymxs is slower than MAXScript — use Python for file I/O and logic, MAXScript for scene manipulation
  • Save before batch operations — saveMaxFile (maxFilePath + maxFileName) as a safety net

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

3dsmax Scripting AI 技能有什么作用?

使用 MAXScript 和 Python 自动化 3ds Max,涵盖场景操作、对象创建、材质分配、相机设置、批量操作、UI 工具和文件 I/O。适用于自动化重复的 3ds Max 工作流、批量处理场景、创建自定义工具,或为建筑可视化、产品可视化和 VFX 编写场景设置脚本等任务。

为什么在 TypingMind 中使用 3dsmax Scripting?

因为您只需安装一次,就能搭配任何模型使用。3dsmax Scripting 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 3dsmax Scripting?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/TerminalSkills/skills/tree/main/skills/3dsmax-scripting。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 3dsmax Scripting?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

3dsmax Scripting 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 3dsmax Scripting 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

3dsmax Scripting AI 技能免费吗?

是的。TerminalSkills 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇