# Session/File (Root) functions | OpenStaad Python

> The STAAD.Pro session and file — create, open, save, and close .STD files, set active units, read job info, and trigger analysis from the top-level object.

Source: https://www.openstaad.com/docs/session-file-root

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

## Get

### GetApplicationDesktopSize

**Description**

Returns the application desktop size.

**Parameters**

None.

**Returns**

tuple: A tuple of `(int, int)`.

**Example**

```python
from openstaad import ops

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

### GetApplicationVersion

#### Retrieve the version of the application

This document explains how to retrieve the version of the application using OpenStaad python.

##### Description

Returns the application version number as text and in individual parts.

##### 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

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

# Execute de analize funcion from root module.
staad_version = s.GetApplicationVersion()

print(staad_version)
```

### GetBaseUnit

#### Retrieve the base unit of your model

This document explains how to retrieve the base unit of your model using OpenStaad python.

##### Description

Returns the base unit for the currently open .STD file.

The base unit decides the units of every value OpenStaad hands back to your script:

- **Metric** — values derived from a length are in meters (`m`), values derived from a force are in
  kilonewtons (`kN`).
- **English** — values derived from a length are in inches (`in`), values derived from a force are in
  kilopounds (`kip`).

This is independent of the model's input units (the `UNIT` command): `SetInputUnits` does not change
what the getters return. See the [Base Units guide](/guides/base_units) for the full rules and a
conversion pattern.

##### Function type

This function retrieves a value from the open staad file

##### Returns

`str`: `"Metric"` or `"English"`.

##### 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.
units = s.GetBaseUnit()

print(units)
```

### GetErrorMessage

**Description**

Returns the error message.

**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.GetErrorMessage()
print(result)
```

### GetFullJobInfo

**Description**

Returns the full job info.

**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.GetFullJobInfo()
print(result)
```

### GetInputUnitForForce

##### Description

Retrieves the input unit of force of the currently open .STD file.

##### Function type

This function retrive a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
force_units = s.GetInputUnitForForce()

print(force_units)
```

### GetInputUnitForLength

##### Description

Retrieves the input unit of length of the currently open .STD file.

##### Function type

This function retrive a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
length_units = s.GetInputUnitForLength()

print(length_units)
```

### GetMainWindowHandle

**Description**

Returns the main window handle.

**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.GetMainWindowHandle()
print(result)
```

### GetOutputUnitForDensity

**Description**

Returns the output unit for density.

**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.GetOutputUnitForDensity()
print(result)
```

### GetOutputUnitForDimension

**Description**

Returns the output unit for dimension.

**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.GetOutputUnitForDimension()
print(result)
```

### GetOutputUnitForDisplacement

**Description**

Returns the output unit for displacement.

**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.GetOutputUnitForDisplacement()
print(result)
```

### GetOutputUnitForDistForce

**Description**

Returns the output unit for dist force.

**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.GetOutputUnitForDistForce()
print(result)
```

### GetOutputUnitForDistMoment

**Description**

Returns the output unit for dist moment.

**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.GetOutputUnitForDistMoment()
print(result)
```

### GetOutputUnitForForce

**Description**

Returns the output unit for force.

**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.GetOutputUnitForForce()
print(result)
```

### GetOutputUnitForMoment

**Description**

Returns the output unit for moment.

**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.GetOutputUnitForMoment()
print(result)
```

### GetOutputUnitForRotation

**Description**

Returns the output unit for rotation.

**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.GetOutputUnitForRotation()
print(result)
```

### GetOutputUnitForSectArea

**Description**

Returns the output unit for sect area.

**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.GetOutputUnitForSectArea()
print(result)
```

### GetOutputUnitForSectDimension

**Description**

Returns the output unit for sect dimension.

**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.GetOutputUnitForSectDimension()
print(result)
```

### GetOutputUnitForSectInertia

**Description**

Returns the output unit for sect inertia.

**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.GetOutputUnitForSectInertia()
print(result)
```

### GetOutputUnitForSectModulus

**Description**

Returns the output unit for sect modulus.

**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.GetOutputUnitForSectModulus()
print(result)
```

### GetOutputUnitForStress

**Description**

Returns the output unit for stress.

**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.GetOutputUnitForStress()
print(result)
```

### GetProcessHandle

**Description**

Returns the process handle.

**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.GetProcessHandle()
print(result)
```

### GetProcessId

**Description**

Returns the process Id.

**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.GetProcessId()
print(result)
```

### GetShortJobInfo

**Description**

Returns the short job info.

**Parameters**

None.

**Returns**

tuple: A tuple of `(str, str, str)`.

**Example**

```python
from openstaad import ops

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

### GetSTAADFile

##### Description

Retrieves the name of the current .STD file..

##### Function type

This function retrive a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
file_name = s.GetSTAADFile()

print(file_name)
```

### GetSTAADFileFolder

##### Description

Retrieves only the path of the current .STD file.

##### Function type

This function retrive a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
path = s.GetSTAADFileFolder()

print(path)
```

## Set/Assign

### SetCheckForIdenticalEntity

**Description**

Sets the check for identical entity.

**Parameters**

- `entityType` (int): entity type.
- `checkFlag` (bool): check flag.

**Returns**

value: See the official OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

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

### SetFullJobInfo

**Description**

Sets the full job info.

**Parameters**

- `job_name` (str): job name.
- `job_client` (str, optional (default `''`)): job client.
- `eng_name` (str, optional (default `''`)): eng name.
- `eng_date` (str, optional (default `''`)): eng date.
- `job_number` (str, optional (default `''`)): job number.
- `revision` (str, optional (default `''`)): revision.
- `part_name` (str, optional (default `''`)): part name.
- `reference` (str, optional (default `''`)): reference.
- `checker_name` (str, optional (default `''`)): checker name.
- `checker_date` (str, optional (default `''`)): checker date.
- `approver_name` (str, optional (default `''`)): approver name.
- `approval_date` (str, optional (default `''`)): approval date.
- `comments` (str, optional (default `''`)): comments.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetFullJobInfo("value", "value", "value", "value", "value", "value", "value", "value", "value", "value", "value", "value", "value")
```

### SetInputUnitForForce

**Description**

Sets the input unit for force.

**Parameters**

- `forceUnit` (int): force unit code.

| Code | Force unit |
|---|---|
| 0 | Kilopound |
| 1 | Pound |
| 2 | Kilogram |
| 3 | Metric Ton |
| 4 | Newton |
| 5 | KiloNewton |
| 6 | MegaNewton |
| 7 | DecaNewton |

These units govern the values you **send**, not the values returned. See [Input Units](/guides/input_units) for how they work, and [Base Units](/guides/base_units) for the values returned.

**Returns**

value: See the official OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

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

### SetInputUnitForLength

**Description**

Sets the input unit for length.

**Parameters**

- `lengthUnit` (int): length unit code.

| Code | Length unit |
|---|---|
| 0 | Inch |
| 1 | Feet |
| 2 | Feet (duplicate of `1`) |
| 3 | CentiMeter |
| 4 | Meter |
| 5 | MilliMeter |
| 6 | DeciMeter |
| 7 | KiloMeter |

The official OpenSTAAD reference lists code `2` as a second `Feet`; testing on STAAD.Pro 2025
confirms `2` behaves exactly like `1`. Use `1`.

These units govern the values you **send**, not the values returned. See [Input Units](/guides/input_units) for how they work, and [Base Units](/guides/base_units) for the values returned.

**Returns**

value: See the official OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

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

### SetInputUnits

**Description**

Sets the input units.

**Parameters**

- `lengthUnit` (int): length unit code.
- `forceUnit` (int): force unit code.

**Length codes**

| Code | Length unit |
|---|---|
| 0 | Inch |
| 1 | Feet |
| 2 | Feet (duplicate of `1`) |
| 3 | CentiMeter |
| 4 | Meter |
| 5 | MilliMeter |
| 6 | DeciMeter |
| 7 | KiloMeter |

The official OpenSTAAD reference lists code `2` as a second `Feet`; testing on STAAD.Pro 2025
confirms `2` behaves exactly like `1`. Use `1`.

**Force codes**

| Code | Force unit |
|---|---|
| 0 | Kilopound |
| 1 | Pound |
| 2 | Kilogram |
| 3 | Metric Ton |
| 4 | Newton |
| 5 | KiloNewton |
| 6 | MegaNewton |
| 7 | DecaNewton |

These units govern the values you **send**, not the values returned. See [Input Units](/guides/input_units) for how they work, and [Base Units](/guides/base_units) for the values returned.

**Returns**

value: See the official OpenSTAAD API reference for this method's exact return semantics.

**Example**

```python
from openstaad import ops

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

### SetShortJobInfo

**Description**

Sets the short job info.

**Parameters**

- `job_name` (str): job name.
- `job_id` (str): job id.
- `job_status` (str): job status.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetShortJobInfo("value", "value", "value")
```

### SetSilentMode

**Description**

Sets the silent mode.

**Parameters**

- `silent` (bool): silent.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetSilentMode(True)
```

### SetUnits

**Description**

Sets the units.

**Parameters**

- `uType` (int): u type.
- `strUnit` (str): str unit.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetUnits(1, "value")
```

### UpdateStructure

**Description**

Updates the structure.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## View

### ShowApplication

**Description**

Shows the application.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## Open

### NewSTAADFile

##### Description

This function creates a .STD file with specified length and force units.

##### Function type

This function execute an action over the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
s.NewSTAADFile()
```

### OpenSTAADFile

**Description**

Opens the STAAD file.

**Parameters**

- `file` (str): file.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.OpenSTAADFile("value")
```

## Save

### SaveModel

##### Description

This function saves the current structure with optional silent mode.

##### Function type

This function retrive a value from the open staad file

##### Example 

To use this function see the following example:

```python
from openstaad import ops

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

# Execute de analize funcion from root module.
status = s.GetAnalysisStatus()

print(status)
```

## Close

### CloseSTAADFile

**Description**

Closes the STAAD file.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### Quit

**Description**

Calls the `Quit` function on the OpenStaad `ops` session.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## Is

### IsPhysicalModel

**Description**

Checks whether physical model.

**Parameters**

None.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### IsZUp

**Description**

Checks whether z up.

**Parameters**

None.

**Returns**

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

**Example**

```python
from openstaad import ops

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