Sketchup.format_area bug?
-
With model units set to inches:
` > Sketchup.format_area(100)
100 Inches ²Sketchup.format_area(2540.mm)
100 Inches ²`With model units set to mm:
` > Sketchup.format_area(100)
64516 Millimeters ²Sketchup.format_area(2540.mm)
64516 Millimeters ²`Surely this is a bug? Should they not yield that same results? Or am I missing something? I can't make sense out of the results I get with the model units set to mm.
-
Sketchup.format_area(number)
You are passing a number as 100 [which SUp assumes is inches] but it's a length as 2540.mm, however,Sketchup.format_area(2540.mm * 1.mm)
will return the expected result as 2540 sqmm, as length x length = number, in inches [3.93700787401575] ? -
I'm not quite following what you are saying. The input of
Sketchup.format_area
is not constant of inches?Sketchup.format_area(100)
yields different result depending on the model settings. If the expected input is inches, then it the result should be the same regardless of model units.If it assumes the number is in the model units, then with mm
Sketchup.format_area(100)
should return"100 Millimeters ²"
- but it does not.I don't understand the value it returns.
-
I'm not sure if you noticed this, but 2540 squared equals
64516
00. That might explain the result.
I don't know why it omitted the last two zeros, though. -
That's the thing - the numbers doesn't seem to add up at all.
-
You're making it hard for some reason.
format_area expects inches (apparently.)
2540.mm == 100.0 inches. ( .mm converts to inches.)
and 100 in² == 64516 mm²
-
Ok - my bad. I was being silly and didn't consider I was dealing with squares when I typed 100.mm.
Sketchup.format_area(100.mm**2) 10000 Millimeters ²
Advertisement