writing binary files with maxscript
recently i've written a bunch of maxscripts to export test data from 3dsmax for various things. doing a c++ exporter would be waaay overkill when i just need a quick spline or mesh. thankfully writing binary data from max is trivial.
maxscript:
f = fopen filename "wb"
count = numKnots $ 1
writeLong f count
for i = 1 to count do (
p = getKnotPoint $ 1 i
writeFloat f p.x
writeFloat f p.y
writeFloat f p.z
)
fclose f
c++:
dword count;
FILE * f = fopen(filename, "rb");
fread(&count, sizeof(count), 1, f);
float3 * knots = alloc(sizeof(float3) * count);
fread(knots, sizeof(float3) * count, 1, f);
fclose(f);
thanks again maxscript! :)
read other posts