How do i set ShadowTime ?
-
Hi !
I'm currently working in a research department in a architect-engineer group in Paris, and we regularly need to export shade views of the studied buildings at three specific dates and three specific times for those dates.
I've written this little test code for exporting shade views, but i don't seem to manage changing the shade time....
would like some help if anyone has a hint
thanks !
Lydiarequire 'sketchup.rb'
#=============================================================================
def exportShadeView
model = Sketchup.active_model view = model.active_view title = model.titleSketchup.active_model.shadow_info["ShadowTime"]="Thu Mar 21 14:00:00 Paris, Madrid 2002"
if (value)
UI.messagebox value
else
UI.messagebox "Failure"
endfilename = title + "_21mars_10h.jpg" status = view.write_image filename, 5000, 4000if (status)
UI.messagebox status
else
UI.messagebox "Failure"
endend
#=============================================================================
#=============================================================================Add a menu to export shade views
if( not $shadeview_loaded )
shadeview_menu = UI.menu("File")
shadeview_menu.add_item("Shadow Export") { exportShadeView }
$shadeview_loaded = true
end -
Hi Lydia,
First, open the Ruby Console when writing scripts so you are able to view any error messages that are generated.
You are trying to set the time by assigning a String. ShadowInfo["ShadowTime"] expects to be set to a Time object. Try:
Sketchup.active_model.shadow_info["ShadowTime"] = Time.nowor
t = Time.local(2008, 3, 21, 14) Sketchup.active_model.shadow_info["ShadowTime"] = tAlso, the variable "value" is never defined in your example, and will cause an error.
-
Hi Jim,
Thanks loads for your tip!!

I'll go try it out straight away
I'll be back...

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