Last active
November 13, 2023 13:04
-
-
Save Eneroth3/5945bb3d75b837bb9828bb8ee7b351f4 to your computer and use it in GitHub Desktop.
Test if SketchUp uses a metric unit or not
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? | |
unit_options = Sketchup.active_model.options["UnitsOptions"] | |
return false unless unit_options["LengthFormat"] == Length::Decimal | |
[Length::Millimeter, Length::Centimeter, Length::Meter].include?(unit_options["LengthUnit"]) | |
end | |
default = metric? ? 100.mm : 4.inch | |
puts default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment