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 - Making an Application. for details about the arguments that can be passed.
See Writing Python 3 Applications using Vortex Studio 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
- Make sure you python environment is properly set. PYTHONPATH should include <Vortex Studio Installation Folder>\bin
- Open the Vortex Director
- Go to Tools → Settings
- Set the simulator folder to <Vortex Studio Installation Folder>\resources\config
- In the main Window, you should have a player simulator on the left
- Click on Duplicate and name you simulator
- On the right view, on the Master Application line, click on Vortex Standard
- Click Browse and navigate to <Vortex Studio Installation Folder>\resouces\Python3DefaultInterpreter\python.exe
- 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
- The tool tip over python.exe should show the full command line.
- Click Save
- Click Launch
- A player should be launched. The Master node is actually a python process.
- If you hto take a look at the log, open the Director UI from the system tray.
- On the right view, click on application
- On the Master line, click Log...
- The log shows that the application is python.
- Any errors launching the process would show here. For example, if the Vortex package cannot be found, the error would lool like this
- Make sure PYTHONPATH includes <Vortex Studio Installation Folder>\bin
- Any errors launching the process would show here. For example, if the Vortex package cannot be found, the error would lool like this
Launching manually
To launch SimApp.py as a standalone application
- Make sure you python environment is properly set. PYTHONPATH should include <Vortex Studio Installation Folder>\bin
- Invoke python with the script and the following command line arguments
- --config <Vortex Studio Installation Folder>\resources\config\simapp.vxc