Some codes return nil in MAC OS

Dear friends,

unit = Sketchup.active_model.options["UnitsOptions"]["VolumeUnit"]

This code works well in WIN but returns nil in MAC OS. Any idea about the problem? Do you know any source for Ruby Sketchup in MAC OS?
Thank you in advance,

:thinking: Are you sure it is because of the Mac? And not because of the different (earlier) version of SU used on Mac?
https://ruby.sketchup.com/Length.html
image

1 Like

There is something else going on, perhaps the SketchUp version you tested on - as @dezmo noted. Although there are possibly some platform-specific bugs, the Ruby version and the Ruby API have been identical on Mac and Windows SketchUp for some time. The line of code you provided does not return nil on my Mac under SketchUp 2021.

2 Likes

It does return nil in SU2019.1 on Windows.

Sketchup.version
>>19.1.174
Sketchup.active_model.options["UnitsOptions"]["VolumeUnit"].nil?
>>true
1 Like

Thank you so much. My problem was Sketchup Version, not the operating system.