Sketchup.send_action


#1

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


#2

Set your Scene transition times to 0.


#3

Jim,

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


#4

Maybe a short timer?

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

#5

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


#6

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.


#7

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


#8

It is answer to John :slight_smile:


#9

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


#10

15.2.685 64-bit
it is filled :wink:


#11

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


#12
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