home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Maximum 3D 3
/
m3d-p3.iso
/
3DS_MAX
/
3DSMAX.2_0
/
SCRIPTS
/
OLE.MS
< prev
next >
Wrap
Text File
|
1997-10-19
|
2KB
|
80 lines
-- OLE Automation demo
--
-- See the section on OLE Automation in the MAXScript manual
-- (Page 138+) for information on setting up MAX for OLE
-- operation and running this demo script.
--
global chart, labels, row_count, col_count
function create_chart n_rows n_cols =
(
row_count = n_rows
col_count = n_cols
chart = for i in 1 to n_rows collect
for i in 1 to n_cols collect 0.0
labels = for i in 1 to n_cols collect ""
)
function add_value row col val =
(
chart[row][col] = val
)
function add_label col val =
(
labels[col] = val
)
fn make_label txt size:15 pos:[0,0,0] =
(
local t = text size:size font:"Arial" text:txt rotation:(quat -90 x_axis),
m = bevel ()
m.level_1_height = (size / 6)
addModifier t m
t.wirecolor = [227,152,152]
rotate t (quat 90 z_axis * quat 90 x_axis)
t.pivot = [t.center.x, t.max.y, t.max.z]
t.pos = pos
t
)
function animate_chart =
(
local x = -100
local bars = for col in chart[1] collect
box width:20 length:10 height:col pos:[x+=22,0,0]
x = -100
for l in labels do make_label l pos:[x+=22,-12,0]
local t = 0, dt = 100 / (chart.count - 1)
animate on
for row in chart do
(
at time t for i in 1 to row.count do bars[i].height = row[i]
t += dt
)
)
fn render_animation =
(
local c = targetCamera pos:[71,-140,224] \
target:(targetObject pos:[-10,-3,10])
animate on
at time 100
(
c.pos = [30,-250,100]
c.target.pos = [-17,3,28]
)
render camera:c framerange:(interval 0f 100f) \
outputwidth:320 outputheight:240 \
outputfile:"chart.avi"
)
registerOLEInterface #(create_chart,
add_value,
add_label,
animate_chart,
render_animation)