We will show you how to write your own scripts using a simple example. We assume that you have installed a scripting folder and its location is:
Of course you can use own location. We will copy a 20-sim model to the scripting folder and write a script that will open this model in 20-sim and run a simulation.
|1.||Copy the example model FastManipulator.emx to the Octave\tutorials folder. E.g copy:|
'C:\Program Files (x86)\20-sim 4.8\Models\Examples\Drivetrains\FastManipulator.emx'
|2.||Open a text editor (e.g. notepad) and enter the following lines:|
xxsim = controllab.XXSim()
|3.||Save the text file as:|
|6.||In IPython, change the local working directory. Type in the command line:|
|7.||In IPython, run your own script. Type in the command line:|
Now you will see the model being loaded in 20-sim and a simulation being run.
In the tutorial folder there are more scripts. Use these as a template for writing your own scripts and follow the guidelines below:
Create your own subfolder inside your scripting working folder. This allows you to update the 20-sim scripting files when new versions of 20-sim are released.
You can find help on scripting functions in the 20-sim Editor by selecting Help - Python Scripting API.