Sun Hours extension - anybody use it (doesn't seem to work in 2024)

Long shot here, but I’m trying to use the Sun Hours plugin from the 3d warehouse, and it appears to be extremely simple.

Good documentation and source code is provided.
sunhours/SunHours_Documentation.pdf at master · alexmojaki/sunhours · GitHub

but last updated 7 years ago.

It’s installing and running okay but Adding a Grid (a critical step in the program) throws up an error code:
image

I haven’t had any responses here, and I have also reached out to the author without any response. So I assume that the extension is now defunct.

Given that the source code is available, i wonder if anybody might be able to ressurect it?

Or suggest an alternative?

Did you see any messages in the Ruby Console?

It looks like the UI message is displayed from line 503 of the grid.rb. There’s some exception and the message is the result of a rescue operation.

The code is commented and the problem happens after pressing OK which triggers the fit_grids method… then fit_selection method…

Does this happen if only one face is selected?

I’m somewhat tempted to install it ;^)

This is the message in the Ruby console:

#Sketchup::Face:0x000001e14296e4f0 did not offset:

Error: #<NameError: uninitialized constant AlexHall::SunHours::Fixnum>

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/offset.rb:50:in `offset_face’

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/grid.rb:169:in `block in fit_grid_params’

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/grid.rb:164:in `each’

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/grid.rb:164:in `fit_grid_params’

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/grid.rb:490:in `fit_selection’

C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2024/SketchUp/Plugins/AlexHall_SunHours/grid.rb:550:in `block in fit_grids’

I haven’t used SunHours in a while, could be they discontinued their support?
But i may have found some (better?) alternatives that could help you out.

Maybe you can try the free extension ‘ShadeDat’ which still seems to work (at least in su22).


image

Another option is the payed extension ‘DL-Light’, which offers a variety of options to study natural light in sketchup.


hello,
I recently used it in 2022 version and it worked fine.
I just tried in 2024 and I get the same error you have.
Apparently it’s just for creating grids, as if I generate them in 2022 version, I can then perform other actions (select grids, calculate sunlight hours…)

I suspect that the error is due to the change to Ruby 3 in SketchUp 2024. The Fixnum type was eliminated.

2 Likes

open offset.rb with notepad and in the line :

if (not ((dist.class==Fixnum || dist.class==Float || dist.class==Length) && dist!=0))
                        return nil

replace Fixnum by Integer and it works.
or simply replace offset.rb in your plugin folder (plugins > AlexHall_SunHours)

offset.rb (4.4 KB)

2 Likes

A little mnemonic to remember for troubleshooting older ruby extensions:

If Fixnum Exists?, the code won’t work! To fix, make Integer Exist?