Notifications
Clear all

[Closed] Units MaxScripts

Hello guys,
I have created some scripts to create doors and windows using MaxScript Listener.
The problem is with the units. I work with inches, but sometimes I have to model in centimeters to customers.
Hence these scripts that did not work correctly in inches in centimeters. The door leaves in wrong size, etc. …
Is there any way to fix this?

4 Replies
1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Take a look units.formatValue struct example

Hello gazybara, and I try to create some tools to streamline my routine work, I’m noob in MAXScript, and then was unable to understand the link you sent me about units.formatValue. I’m trying to use this:
*Variable = units.SystemType
= # inches units.SystemType

To change the unit temporarily. But it did not work. Could you explain me about units.formatValue sincerely help the max this is very complex.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Actually you need to use units.decodeValue
Example
My current units display type is #metric (#centimeters)
When you use units.decodeValue method then you need to add string value and you will get float value as result
Let say I want to convert 586m to current units then

units.decodeValue "586m"
--58600.0

On the same page at the end you can find more examples.

The script is basically recording the listener, move vertex, insert, extrude, etc …