A noob needs help, how to get dimensions of an object?

Hi everyone,

This is my first post here. I've recently become interested in maxscript and because I have some scripting experience (nothing 3D though) I thought I could do our mod a favor and fix this for us.
So I'm working on a mod and we use an exporter written in max script. So far the exporter has always worked fine except with the latest version of the engine something changed causing collision avoidance to not work anymore (space ships try to fly through other ships, they just don't see them). Now we think we've found the cause and all testing so far is pointing in the right direction. (I can't tell what game or mod I work on, if I do I think I'll break the NDA I signed).

All we have to do is add a line of code and give it some dimensions so the engine can make a volume. In the file the line looks like this:

/! PART_VALUES_RAW: 0; 0; 0; 0; 80000; 40000; 80000; 0; 0; 0; !/

We're not 100% sure what all values do, but the three non 0 values are dimensions of the volume and the rest seem to be rotation and other deformation values.

I want to add this line to the files by modifying the exporter. I already found where and how, but I don't know how to get the dimensions of an object in 3D max script.
If done manually I'd go to the Measurements roll out and check the dimensions there, but there has to be a way to get those in maxscript as well, right?
Now my question is: What code would I need to use to get those dimensions?

I've been googling all over the place, searched the reference, searched this site and others as well and I just can't find an answer. I've seen someone use maxY, maxX and maxZ, but I don't see those in the reference and any output from those is undefined. The lines I have now is this:

format "/! PART_VALUES_RAW: 0; 0; 0; 0; %; %; %; 0; 0; 0; !/%" (maxY) (maxX) (maxZ) os.newline to:os.stream

The stream is made by the rest of the exporter, I just want to add this line in.

Oh btw, I use 3D max 9. I know it's not the latest version, but the code should still pretty much be the same, right? Any help is greatly appreciated (the mod kinda depends on it) and I hope you can help me or at least point me in the right direction.


Edit: Well guys I also found something about getProperty, but it doesn't work. Again no clue why, but I did discover the object is converted to a Trimesh before exporting and that's also what I tried using. I tried mesh.height, doesn't work. I also tried getPropety mesh.height, doesn't work, appearently that property doesn't exist. So I'm no further then I was, but atleast I got the feeling I'm getting closer. Any pointers or other help is still welcome though!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Bounding Box

Bounding Box is the magic world you looking for ;) Search the site again; serach in MaxScript Reference again; and if lost ... there is the "basic" method that will works fine in Max 9:

b = Box() -- create a Box just for clear test
bb = (b.max - b.min) -- collect BBox to variable
-- simple format [x,y,z]:
format "%;%;%\n" bb[1] bb[2] bb[3]

my recent MAXScripts RSS (archive here)

CyberneticSoldier's picture


Thanks Anubis ;) it didn't work immediately, but looking at the error I got I realized I wasn't using the right object to take measurements from xD
So I searched in the code and found the object and now it works like a charm ;)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.