Save and Run from the Gnenerator

23 views

Hi Vaclav

Here I have the last several questions to ask you before ending my thesis

Here's the description:

As I mentiond before, I've created the Membrane , and soil grains ( through sphere.pack)

First of all, let the spheres drop to the membrane and until all the spheres settle to the membrane then I Save this Situation through 'Save' option form the Generator (F9)

Secondly, I load this situation (this works) and I add one big Sphere to this situation through

from past.builtins import execfile

execfile('RockFall.py')

Here's the question:

the RockFall.py script doesn't contain like the 'from woo import*, import minieigen' which the module has already used in the 1st py script (the save situation script). So the RockFall.py cannot be added to this scene. It will show the error like 'name pi is not defined'

Any idea?

I want to add something to this situation in order to avoid run the particle dropping to the membrane every time.

Thanks a lot

Best Regards

Feixiang Xuan

answered Oct 20, 2016 by (43,450 points)

Hi, what you do with execfile makes no sense; I see you don't understand how scripting in Woo (or in general in programs like blender etc which also embed Python), which is OK, I explain how to what you want.

1. You save your resulting simulation (spheres are deposited) using S.save into some file, call it e.g. a.bin.gz or whatever (.bin.gz will stores it as compressed binary); what you do by hand by clicking save is essentially the same.
2. Then you create another script, which will start like this:
import woo,woo.core,woo.dem
# do other imports here etc, that is not something saved with the simulation
# because it is really python interpreter state, not simulation
from minieigen import *
# ...

# this loads the scene you saved before
# sets the master scene (which you see in the GUI) to be this scene
# and also assigns it to "S" which you can use afterwards