vcSimulation
vcSimulation is the object type for simulation engine and scene graph, thereby providing access to simulation controls. This is not the same as the simulation root node which represents 3D world in global node tree.
Properties
Name | Type | Access | Description |
IgnoreEvents | Boolean | RW | Defines if simulation object ignores event passing in order to avoid cyclic calls. |
IsLooping | Boolean | RW | Defines if the simulation gets automatically restarted when finished. |
IsRunning | Boolean | R | Indicates if simulation is running in 3D world. |
Name | String | R |
Gets the name of simulation object. |
ProcessController | vcProcessController | R |
Gets the global process controller. |
SimSpeed | Real | RW | Defines the step size or speed of simulation. |
SimTime | Real | R | Gets the current time (in seconds) of simulation. |
SimulationRunTime | Real | RW |
Defines a time (in seconds) when simulation should stop running. Note: Changing the SimulationRunTime is only allowed in the OnRun event. |
SimWarmupTime | Real | RW | Defines a time (in seconds) of simulation warmup time. |
Statistics | vcStatisticsManager | R | Gets the statistics manager of simulation used for defining intervals. |
World | vcNode | R | Gets the simulation root node (3D world node). |
Methods
Name | Return Type | Parameters | Description |
autoHalt | Boolean | None | Stops a simulation if there is no active component running a script that generates simulation events, and then returns True. |
continueRun | None | [Real time] | Continues running a simulation with a 10 day runtime or a given amount of time. |
halt | None | None | Stops a simulation immediately. |
newCollisionDetector | vcCollisionDetector | None | Creates a new collision detector in 3D world, and then returns the new detector. |
newVolumeDetector | vcVolumeDetector | None | Creates a new volume detector in 3D world, and then returns the new detector. |
reset | None | None | Resets simulation and static components to initial state and sets simulation clock at zero. |
restoreInitialState | None | None | Restores simulation and static components to initial state. |
run | None | [Real time] | Runs simulation with a 10 day runtime or a given amount of time. |
setFastScheduling | None | Boolean enabled | Updates the fast scheduling flag for all conveyors that support the property. |
setInitialState | None | None | Saves the current state of simulation and static components. |
update | None | None | Updates simulation and 3D world to reflect current state of components. |
Events
Name | Parameters | Description |
OnCollision |
vcCollisionDetector detector |
Triggered when a collision is detected using active tests. |
OnReset | vcSimulation simulation | Triggered when simulation is reset. |
OnStartStop | vcSimulation simulation, Boolean start_stop | Triggered when simulation is started or stopped. |
Examples
Example. Get simulation object and its properties
from vcScript import * app = getApplication() sim = app.getSimulation() #OPTION 1: get handle to vcSimulation-object sim = app.Simulation #OPTION 2: get handle to vcSimulation-object sim = getSimulation() #OPTION 3: get handle to vcSimulation-object sim.SimSpeed = 1.1 print 'IsRunning',sim.IsRunning, sim.SimTime #when you compile the script, sim is not running def OnRun(): while True: print 'IsRunning',sim.IsRunning, sim.SimTime # here sim is running delay(1) |