Documentation

Start from Scratch

This guide will walk you through the process of setting up your environment to use OpenStaad Python, starting from scratch. By the end, you'll have everything you need to write and execute your first OpenStaad Python script.


Prerequisites

Before starting, ensure you have the following:

  1. A computer running Windows (required for Staad.PRO).
  2. An active license for Staad.PRO.

Step 1: Install Staad.PRO

  1. Download Staad.PRO from the Bentley Systems website.
  2. Follow the installation instructions provided by Bentley.
  3. Ensure that Staad.PRO is installed and activated with a valid license.

Step 2: Install Visual Studio Code

  1. Download Visual Studio Code (VS Code) from the official website.
  2. Run the installer and follow the setup instructions.
  3. Once installed, open VS Code and install the following extensions:
    • Python (by Microsoft): Provides Python support in VS Code.
    • Markdown All in One (optional): For better Markdown editing.

Step 3: Install Python

  1. Download Python from the official Python website.
  2. During installation, ensure you check the box "Add Python to PATH".
  3. Verify the installation by opening a terminal (Command Prompt or PowerShell) and running:
    python --version
    
    You should see the installed Python version.

Step 4: Install OpenStaad Python

  1. Open a terminal (Command Prompt or PowerShell).
  2. Install OpenStaad Python using pip:
    pip install openstaad
    
  3. Verify the installation by running:
    pip show openstaad
    
    You should see details about the OpenStaad package.

Step 5: Create Your First OpenStaad Python Script

  1. Open Visual Studio Code.
  2. Create a new file and save it with a .py extension (e.g., first_openstaad_script.py).
  3. Write the following code to test your OpenStaad installation:
    from openstaad import Geometry
    
    # Create an instance of the Geometry class
    geometry = Geometry()
    
    # Get a list of beams in the model
    beam_list = geometry.GetBeamList()
    
    # Print the beam list
    print("Beam List:", beam_list)
    
  4. Save the file.
  5. Open Staad.PRO and load a model file.
  6. In the terminal, navigate to the directory where your script is saved and run:
    python first_openstaad_script.py
    
  7. You should see the output of the beam list in the terminal.

Step 6: Explore OpenStaad Python

Now that you have your first script running, you can explore the OpenStaad Python library further.