Last active
December 3, 2020 12:57
-
-
Save Eneroth3/7173bbf6247c344c5719c08d00d4c0ac to your computer and use it in GitHub Desktop.
Test if SketchUp uses metric units
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def metric?(model = Sketchup.active_model) | |
unit_options = model.options["UnitsOptions"] | |
return false unless unit_options["LengthFormat"] == Length::Decimal | |
[ | |
Length::Millimeter, | |
Length::Centimeter, | |
Length::Meter | |
].include?(unit_options["LengthUnit"]) | |
end | |
# Example usage | |
default = metric? ? 100.mm : 4.inch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment