I would like to create a button into a component that simply reset the
model and execute the simulation for a while in real time.
I to this:
sim = getSimulation()
app = getApplication()
sim.SimSpeed = 1.0
Tha problema is that VC 4.0.5 will crash when I call sim.run()
Where is my mistake?
I just tested your code, also with a button action but it works for me (VC 4.0.4 professional) .
Maybe change sim.run to sim.run(10.0) because it expects a float, but I don’t think that should be an issue.
My best guess is to contact the support.
Hi. I am getting a similar result.
I am trying to run a simulation with
however, my visual components session crashes.
I’ve tested this in VC 4.1 and if I remebered correctly this was a known bug.
I have got it so it doesn’t crash but it just jumps to the end of the simulation and doesn’t play it.
If I remember correctly, there is a difference between run() and continueRun().
- run(): runs the simulation for the specified time in background without visualization
- continueRun(): runs the simulation for the specified time with visualization
Technically there are also be other ways to specify the simulation run time, but unfortunately there seem to be issues when trying to change the value of the property SimulationRunTime.
Like Job said, it is a known issue when trying to control the execution of simulation via Python script. Sorry, try using .NET API to create a simple .NET command that can start and stop the simulation based on a given time argument, and then call that command in your script using the netCommand([Float runtime]).