Sketchup.send_action

Could any one tell me why?
view.write_image keys
is making before

Sketchup.send_action ('viewRight:')
Sketchup.send_action ('viewIso:')
Sketchup.send_action ('viewZoomExtents:')

in following code:

Sketchup.send_action (‘viewRight:’)
Sketchup.send_action (‘viewIso:’)
Sketchup.send_action (‘viewZoomExtents:’)

keys = {
:filename => “c:/tmp/write_image.png”,
:width => 1000,
:height => 500,
:antialias => true,
:compression => 0.9,
:transparent => false
}

view = Sketchup.active_model.active_view
view.refresh
view.write_image keys

Please

Set your Scene transition times to 0.

Jim,

It did not help. Still the same.;-(

Maybe a short timer?

UI.start_timer(0.1, false) { view.write_image keys }

it works fine for me, but I suggest you remove the whitespace before the brackets…

Sketchup.send_action('viewRight:')

and parenthesise

view.write_image( keys )

whitespace inside () is optional…

john

I have just tried this solution and it worked. But I think its a little bit strange to use start_timer in this case.
But, if there is no another way…
Anyway, thank you Jim.

In may case does not work, maybe that’s because I don’t have pages(scenes)…

It is answer to John :slight_smile:

I meant your original code works for me…

regardless of the transition time…

what SU version are you using [maybe fill in your profile, as well]

john

15.2.685 64-bit
it is filled :wink:

Now is filled, of course.
5 min ago wasn’t.

p Sketchup.send_action('viewRight:')
p Sketchup.send_action('viewIso:')
p Sketchup.send_action('viewZoomExtents:')

keys = {
:filename => "c:/tmp/write_image.png",
:width => 1000,
:height => 500,
:antialias => true,
:compression => 0.9,
:transparent => false
}

view = Sketchup.active_model.active_view
p view.refresh
view.write_image(keys)

this should return
true
true
true
#<Sketchup::View:0x007ff6a79984c8>
true

I’m on a mac and v16, but they are normally fussier…

john