Automatically scenes creation


#1

Hello,
I use the following code to automatically create scenes :

model=Sketchup.active_model
prompts=[“Delta t: “]
values=[@delta]
popups=[””]
title="DeltaT"
results=inputbox(prompts,values,popups,title)
return nil if not results
@delta=results

    si = model.shadow_info
    ps = model.pages
    si["DisplayShadows"]= true
    t = Time.gm(@annee,@mois,@jour,5,0,0).to_i
    34.times do |day|
    si["ShadowTime_time_t"]=t
    page = ps.add
    status = page.use_camera=false
    page.transition_time = 0.0
    t= t+(60 * @delta)
    end

It doesn’t work because it does not recognize @delta (in the line t= t+(60 * @delta)),
but when I directly replaces this variable with a number i don’t have this problem.

Could you help me?

Thank you by advance


#2

inputbox returns an array, even if there is only one value. You need to set @delta=results[0]


#3

Thank slbaumgartner for your answer,

But it still does not work, even by defining @delta=results[0]

You see another way to retrieve the input value for my delta t?
Because when I create a variable i = 30 and I multiply by i [t= t+(60 * i)] it works


#4

I forgot, you probably need results[0].to_f so that you have a float not a string for the multiply. Oops!


#5

Perfect, many thanks slbaumgartner :smile: