Ruby in mm


how to set ruby ​​to always use measurements in mm


By default SketchUp always uses inches in its internal data files and calculations.
However, metric measurements can be displayed and inputted, and auto-converted, for user convenience.
Similarly with radians and degrees for angles…

Read up on the use of ‘Length’.

You can specify metric lengths thus: d =
d = "123.4".to_l
But there’s no simple ‘global’ settings…


" ’

def dpre (dist1,dist2)
@np = (dist1 / dist2).to_i
@dpv = dist1 / @np
if @dpv > dist2
@np = @np + 1
@dpv = dist1 / @np
@dpv = ((@dpv/5).to_i * 5)

puts @np
puts @dpv

’ "






I’m unsure about why you seem to get different results.
Please format your posted code using the code tags or
### your code here
And two-space indents etc…
What do your expect the results to be ?
Why are you using @ variables ?
Remember that integers and floats give different results when multiplying and dividing.
Use .to_f rather than .to_i if it’s creating an issue…
If you add a ‘puts’ in front of any variable setting code, then it’ll print it in the Ruby Console, and help you see what you are getting at each step.


This forum’s “coding” format uses three back-ticks ` NOT single quotes ’
They are quite different.
Also try putting them on a line separately from other text…

Try another edit…