Limiting decimals in ruby in SketchUp

decimals

#1

limiting decimals in ruby in sketchup


#3

See the Sketchup::OptionsManager and Sketchup::OptionsProvider classes.

model = Sketchup.active_model
manager = model.options

manager.each {|key| puts "#{key.name}" }
#=> PageOptions
#=> UnitsOptions
#=> SlideshowOptions
#=> NamedOptions
#=> PrintOptions

opts = manager["UnitsOptions"]
#=> #<Sketchup::OptionsProvider:0x00000009215148>

opts.each {|key,name| puts "#{key} = #{name}" }
#=> LengthPrecision = 3
#=> LengthFormat = 0
#=> LengthUnit = 0
#=> LengthSnapEnabled = true
#=> LengthSnapLength = 0.0001
#=> AnglePrecision = 1
#=> AngleSnapEnabled = true
#=> SnapAngle = 15.0
#=> SuppressUnitsDisplay = false
#=> ForceInchDisplay = false

But beware of changing user’s desired precision. (If only for yourself disregard.)

[P.S. - Moved to Ruby API category.]