Skip to content

Instantly share code, notes, and snippets.

@Eneroth3
Last active November 13, 2023 13:04
Show Gist options
  • Save Eneroth3/5945bb3d75b837bb9828bb8ee7b351f4 to your computer and use it in GitHub Desktop.
Save Eneroth3/5945bb3d75b837bb9828bb8ee7b351f4 to your computer and use it in GitHub Desktop.
Test if SketchUp uses a metric unit or not
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