orlab is a Python module designed to simplify interaction and scripting with OpenRocket from Python. It leverages JPype to bridge Python and Java, enabling seamless control over OpenRocket's functionalities. Currently, it supports access to simulation capabilities given an .ork file, with the goal of future expansion to enable more sophisticated computational engineering workflows.
This project is an evolution of the original orhelper library, which hasn't been maintained recently and is limited in scope. orlab updates the compatibility with OpenRocket 23.09, reorganizes the code for better structure, and plans to incorporate additional features.
Before installing orlab, ensure you have the following installed on your system:
- OpenRocket version 23.09
- Adoptium JDK 17 LTS (or higher?)
- Download Adoptium JDK
- Other JDK releases (i.e. 22) have been tested and work, but not thoroughly.
- Python version 3.6 or higher
-
Install the Package
Install orlab using
pip:pip install orlab -
Install Java JDK
See Setting Up the JDK for more details.
-
Download OpenRocket JAR
If you haven't already, download the OpenRocket
.jarfile:-
Direct Download: OpenRocket-23.09.jar
-
Using
wgeton Linux:wget https://github.com/openrocket/openrocket/releases/download/release-23.09/OpenRocket-23.09.jar
-
-
Set the
CLASSPATHEnvironment VariableEnsure that the
CLASSPATHincludes the path to the OpenRocket.jarfile. This step is only necessary if the.jarfile is not located in the current directory.export CLASSPATH=/path/to/OpenRocket-23.09.jarReplace
/path/to/with the actual directory path where the.jarfile is located.
-
Install Adoptium JDK 17 LTS
Download and install the Adoptium JDK from the official website. Check the option to set / override
JAVA_HOME, unless you have a specific reason not to in which you will need to defineMANUAL_JVM_PATHin your code. -
Set the
JAVA_HOMEEnvironment VariableIf JPype doesn't automatically detect the JDK, manually set the
JAVA_HOMEenvironment variable:-
Find Installation Directory:
Locate where Adoptium JDK is installed, e.g.,
/usr/lib/jvm/adoptium-17. -
Edit
~/.bashrc:Open the
.bashrcfile with your preferred text editor:nano ~/.bashrc -
Add the Following Line:
export JAVA_HOME="/usr/lib/jvm/adoptium-17" -
Apply Changes:
source ~/.bashrc
-
-
Install Adoptium JDK 17 LTS
Download and install the Adoptium JDK from the official website.
-
Set Environment Variables
-
Open Environment Variables Settings:
Navigate to
Control Panel>System>Advanced system settings>Environment Variables. -
Add
JAVA_HOME:- Click on
Newunder System variables. - Set Variable name to
JAVA_HOME. - Set Variable value to the path where Adoptium JDK is installed, e.g.,
C:\Program Files\Eclipse Adoptium\jdk-17.
- Click on
-
Update
PATH:- Select the
Pathvariable and clickEdit. - Click
Newand add%JAVA_HOME%\bin.
- Select the
-
Apply and Close:
Click
OKto apply the changes.
-
After installation and setup, you can start using orlab to interact with OpenRocket. Refer to the examples/ directory for sample scripts demonstrating various functionalities.
For more detailed information and advanced usage, consult the OpenRocket Wiki on Scripting with Python and JPype.
API docs are a work-in-progress, for now see the examples folder for usage.
If you wish to contribute or modify orlab, follow these steps:
-
Clone the Repository
git clone https://github.com/yourusername/orlab.git cd orlab -
Install Dependencies in Editable Mode
pip install -e . -
Make Your Changes
Modify the codebase as needed. Ensure that your changes are well-documented and tested.
-
Run Tests
(Assuming tests are set up)
pytest -
Submit a Pull Request
Push your changes to a forked repository and submit a pull request for review.
- The original orhelper project by SilentSys
- All contributors to the OpenRocket project over the years
Feel free to contribute, report issues, or suggest enhancements!