Notifications
Clear all

[Closed] how can I use metrics units like 'mm' instead of max units?

My friend asked me how can he write for example ‘100mm’ in a script instead of using max units (or units that he has in preferences i.e. inches).

Is there any way to get max unit from prefs. and recalculate it to other type?

6 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

This is slightly more complex question than it appears.

  1. Max works INTERNALLY in Generic Units. Period.

  2. Max has a SYSTEM UNITS setting which defines the correspondence between Generic Units and some real-world units like m, cm, mm, feet or inches. This is used to decide what to do with objects merged or imported from scenes that have different units settings.
    For example, if you have your scene set to 1 GU == 1m and you create a sphere with radius of 10 units, then you merge another sphere with radius 1000 units from a scene that has 1 GU == 1cm, both spheres will end up the SAME SIZE, because Max can handle the units conversion and “knows” that 1000 cm == 10 m.

  3. Max has DISPLAY UNITS which do an on-the-fly conversion of the system units into any other DISPLAY unit in the USER INTERFACE. By default, the first sphere from 2. would appear to have a radius of 10 Generic Units. If you switch the display units to meters, the Radius spinner will read 10m. If you switch to cm, it will read 1000cm. If you switch to Feet with Decimal Inches, it will read 32’9.70079″
    This lets you keep the system units as they are, and let people switch the display of these units in the User Interface to something they understand. So you can ship a MAX file back and forth between Europe and USA and the users would never touch the System Units, they would just switch the UI “translation” to show something they can work with.

So back to your question – yes, you can set your Spinners in MAXScript to type:#worldunits and they will display the Disaplay Units settings explained in 3. All unit conversions will be done by Max internally, so at the settings explained in 2. and 3., a 10m sphere modeled in Europe will be the same size as a 32’9.70079″ sphere created in the US, without the need for any manual calculations inside the script.

Hope this helps. (Ask questions if necessary.)

you can set the unit type somewhere in the preferences, don’t recall where exactly, but if you serach a little among the common customise tabs, you’ll find it. It’s pretty easy to find. I hate inches. Next up is the metric system, but my favourite to use has gotta be generic. The one problem I have, is when i create something in generic units. I occasionally like to scale it up/down to match some other settings. For instance, to have it match something in UT2004, but I can’t really seem to know how to make the scale VALUE jump back to a 100% so the drawscale doesn’t have some insane value in unrealed. Maybe collapsing the stack?

may try it sometime…

Reset X-form Utility in the Utilities tab, then Collapse the stack.

ok … so now I have a some questions (i had the same doubt – for architectural script of course …)

How can i KNOW which units (or display units) the 3dsmax is set to, get it as a value, and use it in a script for converting other imported objects with orher scales? or convert this value itself for later export ??? or did i get something wronG ?

Later i will as well need to shift pixels in a render effect in a fixed ratio obtained from that value… will it be possiable ?

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Take a look at the MAXScript Reference by typing “units” in the Index tab.
In the latest version (7 or 7Rev1) of the Help file, they are all under letter “U” of
“3ds max System Globals” topic. The units. structure contains all the methods to get and set the units and values related to them. The rest is up to you (and your script).

Thanks …
It seems that the only problem i encounter are syntex problems …