# 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](https://www.bentley.com/software/staad/).

---

## Step 1: Install Staad.PRO

1. Download Staad.PRO from the [Bentley Systems website](https://www.bentley.com/software/staad/).
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](https://code.visualstudio.com/).
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](https://www.python.org/downloads/).
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:
   ```bash
   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:
   ```bash
   pip install openstaad
   ```
3. Verify the installation by running:
   ```bash
   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:
   ```python
   from openstaad import ops

   # Connect to the running STAAD.Pro instance
   s = ops.connect()

   # Get a list of beams in the model
   beam_list = s.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:
   ```bash
   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.

Source: https://www.openstaad.com/guides/start_from_scratch
