Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Units
  RSS 2.0 ATOM  

Units
Rate this thread
 
31840
 
Permlink of this thread  
avatar
  • AndyOaks
  • Posted: 08 July 2009 02:48 AM
  • Location: Horsham
  • Total Posts: 51
  • Joined: 04 October 2006 11:01 AM

I have Max’s metric units set to meters but Maxscript is still returning values in inches.

If I have a model that has its x position set to, say, 1 meter then the $.pos.x commmand will return a value of 39.3701.

Is there a way of returning this value in metric meters without the need to multiply it by, in this case, 0.0254 (number of meters in an inch).

thanks,
andy



Max 9.0 through 2010, XP-Pro 64 SP2.
ATI Radeon HD 4800 series
Core 2 Quad Q9650 3.0GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

I suspect the problem is that although you have Display Units set to Meters, your System Units are still set to the default of Inches. Generally considered to be “not a good idea” mixing Imperial and Metric units - you will run into strange rounding errors which can cause all manner of problems.
Internally Max always uses the System units though you can convert them (for display purposes) with units.formatValue and units.decodeValue.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • AndyOaks
  • Posted: 20 July 2009 12:34 AM

Thanks for your help Steve. This has gone some way to solving my problem :)

The final step is to work out which properies of an object are displayed in, say, meters and which aren’t.

As an example, a sphere in my Max scene would display its radius in meters (e.g. 2.0m) whereas the hemisphere property isn’t displayed in meters (e.g. 0.5).

I`m writing a tool at the moment which builds up a table of a selected objects properties for the user to edit so I need to best match the display of these values within my table.
At present I have no way of distinquishing between certain values (as in the example above) to say whether to display them in meters or not.

Is there a way of checking an object’s property to say whether it’s being displayed, in this example, as meters or not.

thanks again for your help so far.

Andy



Max 9.0 through 2010, XP-Pro 64 SP2.
ATI Radeon HD 4800 series
Core 2 Quad Q9650 3.0GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Not that I know of - it’s a matter of looking at each value and determining (manually, by looking at it) whether it is, in fact, measurable (in terms of units). The “Hemisphere” setting goes from 0.0 to 1.0 - a “normalised” percentage - and so has no relation to the either the System or Display Units.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar

I ran into a similar problem some time ago. I couldn’t find any automatic way of determining the type of value, but since I was manually choosing the properties I wanted to display, I stored the unit type along with the property. If you are going for a more “generic” approach....you might have just hit a wall…



Replies: 0