ScriptSpot

Forum topic · General Scripting

Toggle Display Units

By DotScott1 · 2018-11-28

Description

Hey everyone.

I'm trying to create a shortcut to toggle between display unit types: US Ft with Decimal inches and Metric Millimeters (since I switch between the two so often). I know there's a script out there with a floater that has buttons to switch between these but I was hoping to just have it in a shortcut.

This seems like it should be the simplest thing in the world but... I'm pretty noob and obviously missing something here. Here's what I have:

macroScript ToggleDisplayUnits
category:"MyTools T"
ButtonText:"ToggleDisplayUnits"
Tooltip:"Toggle Display Units"

(
if units.displayType=#US units.USType=#Ft_Dec_In then
(
units.displayType=#Metric units.metricType=#Millimeters
)
else
(
units.displayType=#US units.USType=#Ft_Dec_In
)
)

The error it gives me is:

-- No "=" function for (#us (prop USType Global:units))

Again, I'm a complete newb -_- Any tips or pointers would be greatly appreciated!

Comments (3)

.

miauu · 2018-11-28


(
	if units.displayType == #US and units.USType == #Ft_Dec_In then
	(
		units.displayType = #Metric 
		units.metricType = #Millimeters
	)
	else
	(
		units.displayType = #US 
		units.USType = #Ft_Dec_In
	)
)

Wow

DotScott1 · 2018-11-28

First of all: Miauu... you always come to my rescue! You're awesome!

Second... wow I feel dumb :| It was as simple as that!.... anyway, thank you!

.

miauu · 2018-11-30

I am glad to help. :)