View Full Version : maxscript basics

07 July 2006, 08:53 PM
Hi ther ...
i have nevr coded with any kind of graphics b4 ....but now i suddenly have the following problem at hand .....

I need to do this ....

I have a max file with many instances of the basic primitive ~ Sphere in the file ...there is no other shape in the scene ....only many small spheres arranged in a pattern i need a maxscript code to scan this file and write out the coordinates of the centers of the spheres out to a text or xml file.......which i am expecing or hoping to read as xyz coordinates (int) values from a c# code........

i really need to accomplish this xtremely would be forever indetting :-p

do reply
in anticipation

thanx a zillion eitherways......

07 July 2006, 08:32 AM
If you gave me a sample of how you want the file to look I'll knock something up for you quickly.

You should've posted this on the Maxscript forum, you'd get more help there :thumbsup:

07 July 2006, 11:52 AM
Thanx a lot mate ..... i am attaching a link to the scene itself.....i have uploaded it on the use it.......

really glad u replied ....i see hope again.... :-)

but the aim is to run the script on any such arrangement of spheres and get the xyz coordinates of their center in a text file which i will read to run some motors etc .....

is it difficult.....???......i am also starting to learn maxscript today......

i hope i was able to convey what is needed clearly....please do spare some time if u can ...

cheers newys......

07 July 2006, 12:05 PM
thanx 4 replyin mate

I have uploaded the file >>here<< (

the script will run on scenes like this ....the coordinated of center of each sphere are needed in a text file from which some motors etc will be run via the usb.....

see wat u can do with it .......

i see hope again ....thanx a ton

07 July 2006, 01:59 PM
Could you give me an example of how you want the XML file to look?

I'm thinking something like:
<point x=12 y=24 z=16 />
<point x=34 y=54 z=53 />
<point x=11 y=92 z=27 />

Just paste the following code into a new script and hit Ctrl-E, make sure your scene is open:scr = newScript()
for geo in geometry do
format "<point x=% y=% z=% />\n" (geo.pos.x as integer) (geo.pos.y as integer) (geo.pos.z as integer) to:scr

Copy and paste the output into your xml file and it's done.

Another thing it seems your scene has lots of overlapping spheres, is that intentional?

07 July 2006, 07:55 PM
hey dude thanx a lot for taking time out.......but i had to do it by noon burnt the night learning maxscript.........modifies a rollout example for viewing object list and made it with even a nice UI :-) ............but ur reply was encouragement........i was always hoping ud be my safety option maybe thats wat help me thru.......

i must say max reference guid is one of the best i have ever used......its nice n simple.....even for a beginner..........but then again thanx a lot.....


keep in touch as i learn more...

07 July 2006, 08:20 PM
Glad to have been of help :thumbsup:

Just remember to post in the MaxScript forum, in the Autodesk 3DS Max Forum.

CGTalk Moderation
07 July 2006, 08:20 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.