直接在MAXScript文本里输入:
mysphere = sphere()
mysphere.name = "sphere00001"
mysphere.pos = [-75,-75,0]
mysphere.wirecolor = red
mybox = box length:20 width:20 height:70
mybox.name = "box1"
mybox.pos = [75,75,0]
mybox.wirecolor = blue
addModifier mybox (Twist angle:60)
mycone = cone()
mycone.name = "cone1"
mycone.pos = [0,0,0]
mycone.wirecolor = white
addModifier mycone(TurboSmooth Iterations:1)
得到的会是:
输入
showclass"Box.*"
showclass"sphere.*"
等可以查看可以读取的模型的属性
用函数封装的逻辑:
fn myFunc ydistance:500 =
(
while ydistance >0 do
(
if ydistance == 300 then
(
mybox = box()
mybox.pos = [0,ydistance,-20]
mybox.scale = [2,2,2]
)
else
(
mysphere = sphere()
mysphere.pos = [0,ydistance,0]
)
ydistance -= 50
)
)
--调用上面的函数
myFunc()
myFunc ydistance:300
Visual MaxScript在保存后需要打开.ms文件进行修改:
rollout UndefinedTitle "无标题" width:162 height:300
(
button 'btn7' "Button" pos:[23,21] width:119 height:42 align:#left
on btn7 pressed do
box()
)
createDialog UndefinedTitle 300 600
注意修改的内容是加入了最后一句话CreateDialog,这个是创建窗口命令,如果没有这句话是不会弹出窗口的