Sign in to follow this  
SquareDanceSteve

3D Studio Max Custom Exporter or Script Output?

Recommended Posts

I am making my 3d scenes exporting them as *.x files and then using 2d editor program to map the foot print of structures and i was curious if someone could point me in the right direction so i could use max to export binary files (3d foot prints are hard in 2d) --------------------------------------------------- Square Dance Studios

Share this post


Link to post
Share on other sites
I don't quite understand what are you tring to export , a model foots ?

Well anyways ,there is really good documentation in max script. Here is a sample how to read/write binary files, I found it somewhere on the net:

Quote:

----------------------------------------------

In max 4:

Search in Maxscript manual:

BinStream for Binary Reading and Writing

Topic: version 4 MAXScript Language Improvements/Language Improvements

BinStream fopen <String fileName> <String mode>

Opens a file for reading or writing based on the mode parameter. This can either be "wb" for Writing Binary or "rb" for Reading Binary. The function will return a BinStream value.

Boolean FClose <BinStream>

Close a BinStream value. Returns True if it successfully closed the BinStream.

Boolean fseek <BinStream> <Integer> <#seek_set | #seek_cur | #seek_end>

Move the file pointer to the specified location based off the seek parameter.

#seek_set - base off start of file.

#seek_cur - base off current position.

#seek_end - base off end of file.

Integer ftell <BinStream>

Returns the current file pointer position.

Boolean WriteByte <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as one byte. Returns True if write was successful.

Boolean WriteShort <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as two bytes. Returns True if write was successful.

Boolean WriteLong <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as four bytes. Returns True if write was successful.

Boolean WriteFloat <BinStream> <Float>

Writes a Float to the file as four bytes. Returns True if write was successful.

Boolean WriteString <BinStream> <String>

Writes a string to the file. Returns True if write was successful.

Integer ReadByte <BinStream> [#signed | #unsigned]

Read a one byte value and return as an Integer.

Integer ReadShort <BinStream> [#signed | #unsigned]

Read a two byte value and return as an Integer.

Integer ReadLong <BinStream> [#signed | #unsigned]

Read a four byte value and return as an Integer.

Float ReadFloat <BinStream>

Read a four byte value and return as an Float.

String ReadString <BinStream>

Read a string from the file.

Example:

f=fopen "c:\\test.bin" "wb"

WriteString f "String"

WriteByte f 64

WriteShort f 128

WriteLong f 256

WriteFloat f 512.0

WriteString f "gnirtS"

WriteLong f (ftell f)

fclose f

f=fopen "c:\\test.bin" "rb"

ReadString f

ReadByte f

ReadShort f

ReadLong f

ReadFloat f

ReadString f

ftell f

ReadLong f

fclose f


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this