Snapshots Crashing The File

I have written a script utilizing rhinoscriptsyntax to create snapshots out of existing geometry. Simplified, it works like this:

import rhinoscriptsyntax as rs

objects = rs.GetObjects()

rs.Command("-_Snapshots Save FIRST _EnterEnd")

for object in objects:
    name = rs.ObjectName(object)
    
    rs.MoveObject(object, (0,0,50))
    rs.Command("-_Snapshots Save " + name + " _EnterEnd")

In small groups of objects, it doesn’t seem to be an issue. However, in larger groups, the process becomes extremely slow until eventually the entire program crashes. I suspect this is because of Snapshots being quite large storage wise. My questions would be as follows:

  1. Is there a way to set which attributes (object position, material, etc.) I want saved in the snapshot through rs.Command()? Like the way you can do it through a manual save. I would assume this would make the individual snapshots lighter each.

  2. If not, is there a way to avoid the program from crashing? Or is creating consecutive snapshots impossible?

  3. Unrelated to the rest, but is there a way to set the camera position after the snapshots have been created?

@dale or @pascal would you be able to help with this?

Hi @Daniel_Díaz, @lignindes,

Can you provide is a model and precise instructions on how to repeat the crash?

Thanks,

– Dale

@dale
Could I sent the model and instructions to you via direct message?

Yes, absolutely. You can dm me here or just reach me at dale@mcneel.com.

Thanks,

– Dale

@dale

Can you recommend another way that we could use Rhino to make animations programmatically? It seems that Snapshots should be the tool, but they bloat the file size if you’re adding via script.

@nathanletwory would you suggest using Blender for animations?

Dan

Hi @lignindes,

For simple animations, you can use the Animation toolbars in Rhino.

image

If you’re willing to look at plug-ins, there is Bongo.

– Dale

Just as a side note, a long, long time ago I made a fairly long animation via Python (no snapshots) and found a similar thing happening. Every move you make in the script goes into the undo stack and sooner or later you run your computer out of memory. Since my animation script was in a loop, at every certain increment, I ran sc.doc.ClearUndoRecords(False). I seem to remember that helped.

@dale and @Helvetosaur

Thanks for your help. It seems like Bongo hasn’t had an update in quite some time. Is it something that will be updated/supported with future versions of Rhino?

Thanks,

Dan

Yep.

– Dale

@Helvetosaur

When you made your animation without Snapshots were you using Named Views? Or what was the general approach (in Python)?

Thanks,

Dan

No, I simply set up the animation loop and let it run full-screen and captured the screen with Camtasia. So no single-frame images generated at all. It was a video that ran 35 minutes…

1 Like

Hello,

If Snapshots isn’t going to do the trick for us it seems that we should be able to use methods from

NamedViewTable Class (rhino3d.com)

and

NamedPositionTable Class (rhino3d.com)

to script our animation. We’re going to look into this, but would appreciate if any others’ experience in using these classes to script animations.

Thanks,

Dan