A faster way to obtain shadow_info?
-
Hello,
I would like to obtain SunDirection vector a lot of times on a whole year.
But the method below is too slow. Is there a fast form to find out SU shadow_info?vec=[] info=Sketchup.active_model.shadow_info atime=Time.now for i in 0..50000 info["ShadowTime"]+=600 vec<<info["SunDirection"] end
-
hmm... I looked at it. But found no optimized way. I tried making constants of the string -in case the creation of the strings for every iteration had a cost - but no change.
And you can't address the info with numeric indexes either...
I also wrapped the whole block in a start_operation with the disable_ui argument to true - but still no performance difference. -
Thanks thomthom, maybe could be added to wish list ruby access to SU Solar Position Algorithm in a fast way.
-
It's not actually getting the info that's slow. It's setting it.
When I ran the test it took ~11sec to run.
When I removed
info["ShadowTime"]+=600
it took ~0.15sec to run.
That's why I hoped usingstart_operation
would help - but alas. But at least, when you do this, ensure that Shadows are not on in SketchUp.
Advertisement