Exporting: Animation, Printers, & Time-out's

pdf
animation
printing
freezing

#1

Hello again All - I’ve been trying to write a script that will automatically export still images, an mp4 animation, and send scenes to a printer. The still images were easy enough to figure out, but I’m not sure about the others:

  • As the still images export, Sketchup bogs down so I update the Status Text to show which image is currently being written. Two images in, the Windows loading cursor pops up, and the Status Text no longer updates. Any way to keep Sketchup from timing out?
  • Is it even possible to export scenes to an mp4 file? I haven’t had much luck on the API documentation… Does the Animation class have anything at all to do with it?
  • Should I go through the Win32 class to get access to my local printer? I’m actually using a PDF writer as a bootleg method for exporting all scenes to PDF’s, and combining them without using additional software (anyone got a better method that?)

Thanks in advance for any thoughts!


#2

What edition (Pro or Make) and what version(s) are targeted ?
(Pro and Make have differing capabilities re export.)

Status Text is poor means for this use. Whenever the user moves the mouse (or otherwise SketchUp thinks the status bar needs updating,) the text is overwritten by the active tool. So, generally speaking, the status text is meant for use by tools (native or custom tools.)

If you target SU2018+ likely use Notifications instead.

For older versions perhaps a html dialog, that just appends messages to the body element’s content.

Perhaps call UI.refresh_inspectors and/or model.active_view.refresh in between image writes to let SketchUp peek it’s window messages and prevent the “Not responding” (greyed out) state ?

Just noting that PDF export from SketchUp is Pro only.

Ruby has shell access via execute command strings. You send command strings to the system via %x or backtick delimiters. (On the key left of 1 key on most keyboards.) Example …

`somefile.pdf > PRN`

… or …

%x{dir}

%x may use any delimiters you care to. Either matching brackets, braces, parenthesis or whatever character follows the “x”.

(Note SU2018 M0 may have the return command strings bugged again. Would nope a fix comes in a maintenance release.)


#3

As Dan says, output to Status Text is limited, especially if you have’t taken control of it in a tool object and the mouse is moved. In addition, in time consuming loops, writes to the Ruby console tend to hang and be delayed as well.

I have written over a thousand images to file in a Ruby script. Sketchup appears to lock up, and it is difficult to output the status. Unless you have an infinite loop, it will eventually stop. For example, writing 1300 images to my laptop’s SSD takes 55 minutes with Sketchup 2017 Make. I write to an empty folder, and progress can tracked by periodically refreshing the folder (on Windows, the F5 key), and seeing how many images have been written.

I don’t refresh anything within the Ruby API, especially “active_view.refresh”, because Sketchup will update the entire view each frame, significantly slowing down the writes.

I have played around with animation quite a bit, and I’m not aware of anything. I merge the still images outside of Sketchup.
Even if you were to activate Sketchup’s animation menu option, no Ruby code runs so the only animation would be scene changes as configured through the dialog boxes.

That would be a lot of work, and not be portable to a Mac. As Dan also mentioned, shell access can allow system calls. You could make a system call to another program to batch print them. If you have raw images in memory that you want sent to the printer, I’m not aware of anything.
I don’t know if there is a Ruby gem for Windows that allows defining and sending an image to the printer.


#4

As always, thanks for the replies! My apoligies for the delay in responding… I’ve been targeting the 2017 Pro version for the scripts, really as internal productivity booster (likely, the routine would be too task-specific/ sloppy for public consumption…).

Right now, we’re debating the jump to 2018, held back mainly by the lack of a 2018 Make for the non-pro users in the office, but the use of Notifications might help sway the argument in favor of 2018.

I had no luck with the UI.refresh nor active_view.refresh, with Sketchup just timing out, so I might pursue the HTML dialog, when I make I continue to learn it/Java in the near future (hopefully).

This might be my de facto way of checking if I can’t figure out a different solution.

I’ll have to brush up on my Ruby that isn’t Sketchup-centric to figure out how to get the shell comands to work right, but it’s a step in the right direction. Thanks for the direction!


#5

Make - no matter the year - is for non-commercial uses only! Use of Sketchup by “non-pro users in the office” (emphasis added) is still commercial use.

I’m assuming that price is an issue for you. You should contact SketchUp’s Corporate Solutions team and talk it over with them.


#6

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.