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"]+=600it took ~0.15sec to run.
That's why I hoped usingstart_operationwould help - but alas. But at least, when you do this, ensure that Shadows are not on in SketchUp.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement