# Analysis (Command) functions | OpenStaad Python

> Runs the solver — static, P-Delta, buckling, nonlinear, direct, and cable — and reports analysis status. Results are read in the results domains.

Source: https://www.openstaad.com/docs/analysis-command

Every function is a method of the session `s = ops.connect()` (`from openstaad import ops`).

## Add

### AddDirectAnalysisDefinitionParameter

**Description**

Adds the direct analysis definition parameter.

**Parameters**

- `pParamType` (int): p param type.
- `members` (list): members.
- `param` (float): param.

**Returns**

bool: `True` if the call succeeded, `False` otherwise.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.AddDirectAnalysisDefinitionParameter(1, [1, 2], 1.0)
print(result)
```

## Get

### GetAnalysisErrorMessages

**Description**

Returns the analysis error messages.

**Parameters**

- `modelPath` (Optional[str], optional (default `None`)): model path.

**Returns**

list: A list of strings.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.GetAnalysisErrorMessages(1)
print(result)
```

### GetAnalysisStatus

#### Retrieve the analysis status of your model

This document explains how to retrieve the analysis status of your model using OpenStaad python.

##### Description

Get analysis status for any STD model.

##### Function type

This function retrieves a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

# instantiate the root module
s = ops.connect()

# Execute the analyze function from root module.
status = s.GetAnalysisStatus()

print(status)
```

### GetAnalysisWarningMessages

**Description**

Returns the analysis warning messages.

**Parameters**

- `modelPath` (Optional[str], optional (default `None`)): model path.

**Returns**

list: A list of strings.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.GetAnalysisWarningMessages(1)
print(result)
```

### GetStaticCheckResult

**Description**

Returns the static check result.

**Parameters**

- `loadCaseNo` (int): load case no.

**Returns**

tuple: A tuple of `(list[float], list[float])`.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.GetStaticCheckResult(1)
print(result)
```

## Set/Assign

### SetCheckIrregularitiesCommand

**Description**

Sets the check irregularities command.

**Parameters**

- `DesignCode` (int): design code.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.SetCheckIrregularitiesCommand(1)
print(result)
```

### SetCheckSoftStoryCommand

**Description**

Sets the check soft story command.

**Parameters**

- `DesignCode` (int): design code.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.SetCheckSoftStoryCommand(1)
print(result)
```

### SetFloorDiaphragmBaseCommand

**Description**

Sets the floor diaphragm base command.

**Parameters**

- `baseElevationValue` (float): base elevation value.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.SetFloorDiaphragmBaseCommand(1.0)
print(result)
```

## Delete

### DeleteAllAnalysisCommands

**Description**

Deletes the all analysis commands.

**Parameters**

None.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteAllAnalysisCommands()
print(result)
```

### DeleteCheckIrregularitiesCommand

**Description**

Deletes the check irregularities command.

**Parameters**

None.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteCheckIrregularitiesCommand()
print(result)
```

### DeleteCheckSoftStoryCommand

**Description**

Deletes the check soft story command.

**Parameters**

None.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteCheckSoftStoryCommand()
print(result)
```

### DeleteDirectAnalysisDefinition

**Description**

Deletes the direct analysis definition.

**Parameters**

None.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteDirectAnalysisDefinition()
print(result)
```

### DeleteDirectAnalysisDefinitionParameter

**Description**

Deletes the direct analysis definition parameter.

**Parameters**

- `pParamType` (int): p param type.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteDirectAnalysisDefinitionParameter(1)
print(result)
```

### DeleteFloorDiaphragmBaseCommand

**Description**

Deletes the floor diaphragm base command.

**Parameters**

None.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.DeleteFloorDiaphragmBaseCommand()
print(result)
```

## Execute

### Analyze

This document provides details on how to perform analysis using OpenStaad Python.

#### Overview

> **Note:** Ensure that the Staad.PRO file is open and valid before running the analysis. The `Analyze` function does not return results directly; you need to use other functions to extract analysis results.

The `Analyze` function in OpenStaad Python allows users to run structural analysis on their Staad.PRO models programmatically. This is particularly useful for automating workflows and integrating analysis into larger Python-based applications.

#### Example Usage

```python
from openstaad import ops

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

# Run the analysis
s.Analyze()

print("Analysis completed successfully.")
```

#### Key Points

- Ensure that the Staad.PRO file is open and valid before running the analysis.
- The `Analyze` function does not return results directly; you need to use other functions to extract analysis results.

---

For more details, refer to the [Official OpenStaad Documentation](https://docs.bentley.com/LiveContent/web/STAAD.Pro%20Help-v14/en/GUID-93E26CB6-E60E-4175-920A-72D504639722.html).

### AnalyzeEx

**Description**

Runs analysis on the ex.

**Parameters**

- `silentMode` (int): silent mode.
- `hiddenMode` (int): hidden mode.
- `waitTillComplete` (int): wait till complete.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.AnalyzeEx(1, 1, 1)
print(result)
```

### AnalyzeModel

**Description**

Runs analysis on the model.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.AnalyzeModel()
```

### PerformAnalysis

**Description**

Performs the analysis.

**Parameters**

- `printOption` (int): print option.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.PerformAnalysis(1)
```

### PerformBucklingAnalysis

**Description**

Performs the buckling analysis.

**Parameters**

- `MaxNoOfIterations` (int): max no of iterations.
- `PrintOption` (int): print option.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.PerformBucklingAnalysis(1, 1)
```

### PerformBucklingAnalysisEx

**Description**

Performs the buckling analysis ex.

**Parameters**

- `Method` (int): method.
- `MaxNoOfIterations` (int): max no of iterations.
- `PrintOption` (int): print option.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.PerformBucklingAnalysisEx(1, 1, 1)
print(result)
```

### PerformDirectAnalysis

**Description**

Performs the direct analysis.

**Parameters**

- `Option` (int): option.
- `Params` (list): params.
- `AddOptions` (list): add options.
- `PrintOption` (int): print option.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.PerformDirectAnalysis(1, [1, 2], [1, 2], 1)
print(result)
```

### PerformNonlinearAnalysisEx

**Description**

Performs the nonlinear analysis ex.

**Parameters**

- `PrintOption` (int): print option.
- `Arclength` (float): arclength.
- `NoOfIterations` (int): no of iterations.
- `Tolerance` (float): tolerance.
- `Steps` (int): steps.
- `Rebuild` (int): rebuild.
- `AddGeometricStiffness` (int): add geometric stiffness.
- `DispLimitData` (list): disp limit data.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.PerformNonlinearAnalysisEx(1, 1.0, 1, 1.0, 1, 1, 1, [1, 2])
print(result)
```

### PerformPDeltaAnalysisEx

**Description**

Performs the p delta analysis ex.

**Parameters**

- `NoOfIterations` (int): no of iterations.
- `PrintOption` (int): print option.
- `bSmallDelta` (int): b small delta.
- `AddGeometricStiffness` (int): add geometric stiffness.

**Returns**

raw: The raw return value from the underlying OpenSTAAD COM call. Refer to the official Bentley OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.PerformPDeltaAnalysisEx(1, 1, 1, 1)
print(result)
```

### PerformPDeltaAnalysisNoConverge

**Description**

Performs the p delta analysis no converge.

**Parameters**

- `NoOfIterations` (int): no of iterations.
- `PrintOption` (int): print option.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.PerformPDeltaAnalysisNoConverge(1, 1)
```

## Is

### IsAnalyzing

**Description**

Checks whether STAAD.Pro is currently analyzing.

**Parameters**

None.

**Returns**

bool: `True` if the call succeeded, `False` otherwise.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.IsAnalyzing()
print(result)
```
