Simulation Application tutorial (Python 3)

Name

Location

Simulation Application<Vortex Studio Installation Folder>\tutorials\Python\Vortex\PySimApp\SimApp.py

This tutorial provide an example of creating a custom Vortex, very similiar to simapp.exe in python.

This application is meant to be run either as a standalone application or launch with the Vortex Director as a simulator node.

SimApp.py

The script is a simplified version of the SimApp.exe application.

It reads the command lines arguments and creates a VxApplication from it.

Then the application is run.

This script, like a simapp.exe process, does not load content automatically.

To load content, the provided setup file in the arguments must have an extension to do it, or the script can be modified to support it.

See Mechanism Viewer Tutorial (Python 3) for an example.


The script can be launched from python directly, provided that the proper command line arguments are given.

You need at least a setup file.


See Vortex Studio SDK Advanced - Creating an Application. for details about the arguments that can be passed.

See Vortex Studio SDK - Python 3 Scripting for more details about using Python.


Using the tutorial

Launching with the Director

This example will modify the Vortex Player to replace it's Master node with a python process

  1. Make sure you python environment is properly set. PYTHONPATH should include <Vortex Studio Installation Folder>\bin
  2. Open the Vortex Director
  3. Go to Tools → options
  4. Set the simulator folder to <Vortex Studio Installation Folder>\resources\config 
  5. In the main Window, you should have a player simulator on the left 
  6. Click on Duplicate and name you simulator
  7. On the right view, on the Master Application line, click on Vortex Standard
  8. Click Browse and navigate to <Vortex Studio Installation Folder>\resouces\Python3DefaultInterpreter\python.exe 
  9. Click twice on python.exe to enter edit mode and add a space and the path to <Vortex Studio Installation Folder>\tutorials\Python\Vortex\PySimApp\SimApp.py 
  10. The tool tip over python.exe should show the full command line. 
  11. Click Save
  12. Click Launch
  13. A player should be launched. The Master node is actually a python process.
  14. If you hto take a look at the log, open the Director UI from the system tray. 
  15. On the right view, click on application
  16. On the Master line, click Log... 
  17. The log shows that the application is python. 
    1. Any errors launching the process would show here. For example, if the Vortex package cannot be found, the error would lool like this 
      1. Make sure  PYTHONPATH includes <Vortex Studio Installation Folder>\bin

Launching manually

To launch SimApp.py as a standalone application

  1. Make sure you python environment is properly set. PYTHONPATH should include <Vortex Studio Installation Folder>\bin
  2. Invoke python with the script and the following command line arguments 
    1. --config <Vortex Studio Installation Folder>\resources\config\simapp.vxc