# View functions | OpenStaad Python

> Drives the STAAD.Pro viewport — views, zoom/pan/rotate, visibility, selection, and annotation. Visual only; it never changes the model.

Source: https://www.openstaad.com/docs/view

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

## Create

### CreateNewViewForSelections

**Description**

Creates the new view for selections.

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

### CreateNewViewForSelectionsEx

**Description**

Creates the new view for selections ex.

**Parameters**

- `windowOptions` (int): window options.

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

## Get

### GetFlagForHiddenEntities

**Description**

Returns the flag for hidden entities.

**Parameters**

None.

**Returns**

int: An integer value returned by STAAD.Pro for this call.

**Example**

```python
from openstaad import ops

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

### GetInterfaceMode

**Description**

Returns the interface mode.

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

### GetScaleCount

**Description**

Returns the scale count.

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

### GetScaleValueByType

**Description**

Returns the scale value by type.

**Parameters**

- `scaleTypeId` (int): scale type Id.

**Returns**

float: A numeric value returned by STAAD.Pro for this call.

**Example**

```python
from openstaad import ops

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

### GetScaleValues

**Description**

Returns the scale values.

**Parameters**

None.

**Returns**

list: A list of numbers (floats).

**Example**

```python
from openstaad import ops

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

### GetWindowCount

**Description**

Returns the window count.

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

### GetWindowTitle

**Description**

Returns the window title.

**Parameters**

- `id` (int): id.

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

## Set/Assign

### RenameView

**Description**

Renames the view.

**Parameters**

- `viewName` (str): view name.

**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.RenameView("value")
print(result)
```

### SetActiveWindow

**Description**

Sets the active window.

**Parameters**

- `id` (int): id.

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

### SetDiagramMode

**Description**

Sets the diagram mode.

**Parameters**

- `which` (int): which.
- `showFlag` (bool): show flag.
- `refreshFlag` (bool): refresh flag.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetDiagramMode(1, True, True)
```

### SetFlagForHiddenEntities

**Description**

Sets the flag for hidden entities.

**Parameters**

- `flag` (int): 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.SetFlagForHiddenEntities(1)
print(result)
```

### SetInterfaceMode

**Description**

Sets the interface mode.

**Parameters**

- `interfaceMode` (int): interface mode.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SetLabel

**Description**

Sets the label.

**Parameters**

- `which` (int): which.
- `showFlag` (bool): show flag.

**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.SetLabel(1, True)
print(result)
```

### SetModeSectionPage

**Description**

Sets the mode section page.

**Parameters**

- `interfaceMode` (int): interface mode.
- `sectionNumber` (int): section number.
- `pageNumber` (int): page number.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SetReactionAnnotationMode

**Description**

Sets the reaction annotation mode.

**Parameters**

- `dFlag` (bool): d flag.
- `refreshFlag` (bool): refresh flag.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetReactionAnnotationMode(True, True)
```

### SetScaleValueByType

**Description**

Sets the scale value by type.

**Parameters**

- `scaleTypeId` (int): scale type Id.
- `value` (float): 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.SetScaleValueByType(1, 1.0)
print(result)
```

### SetScaleValues

**Description**

Sets the scale values.

**Parameters**

- `ScalesList` (list): scales list.

**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.SetScaleValues([1, 2])
print(result)
```

### SetSectionView

**Description**

Sets the section view.

**Parameters**

- `plane` (int): plane.
- `minVal` (float): min val.
- `maxVal` (float): max val.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetSectionView(1, 1.0, 1.0)
```

### SetWindowPosition

**Description**

Sets the window position.

**Parameters**

- `xTop` (float): x top.
- `yTop` (float): y top.
- `xWindow` (float): x window.
- `yWindow` (float): y window.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SetWindowPosition(1.0, 1.0, 1.0, 1.0)
```

## Select

### SelectByItemList

**Description**

Selects the by item list.

**Parameters**

- `entityType` (int): entity type.
- `nItems` (int): n items.
- `itemList` (list): item list.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.SelectByItemList(1, 1, [1, 2])
```

### SelectByMissingAttribute

**Description**

Selects the by missing attribute.

**Parameters**

- `attributeCode` (int): attribute code.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SelectInverse

**Description**

Selects the inverse.

**Parameters**

- `entityType` (int): entity type.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## View

### DetachView

**Description**

Detaches the view.

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

### HideEntity

**Description**

Hides the entity.

**Parameters**

- `nEntity` (int): n entity.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### RefreshView

**Description**

Refreshes the view.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### RotateDown

**Description**

Rotates the down.

**Parameters**

- `dDegrees` (float): d degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.RotateDown(1.0)
```

### RotateLeft

**Description**

Rotates the left.

**Parameters**

- `dDegrees` (float): d degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.RotateLeft(1.0)
```

### RotateRight

**Description**

Rotates the right.

**Parameters**

- `dDegrees` (float): d degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.RotateRight(1.0)
```

### RotateUp

**Description**

Rotates the up.

**Parameters**

- `dDegrees` (float): d degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

s = ops.connect()
s.RotateUp(1.0)
```

### ShowBack

**Description**

Shows the back.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowBottom

**Description**

Shows the bottom.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowFront

**Description**

Shows the front.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowIsometric

**Description**

Shows the isometric.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowLeft

**Description**

Shows the left.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowPlan

**Description**

Shows the plan.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ShowRight

**Description**

Shows the right.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SpinLeft

**Description**

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

**Parameters**

- `Degrees` (value): degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SpinRight

**Description**

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

**Parameters**

- `Degrees` (value): degrees.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ZoomAll

**Description**

Zooms the all.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### ZoomExtentsMainView

**Description**

Zooms the extents main view.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## Open

### OpenView

**Description**

Opens the view.

**Parameters**

- `viewName` (str): view name.
- `windowOptions` (bool): window options.

**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.OpenView("value", True)
print(result)
```

## Save

### SaveView

**Description**

Saves the view.

**Parameters**

- `viewName` (str): view name.
- `overWrite` (bool): over write.

**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.SaveView("value", True)
print(result)
```

## Close

### CloseActiveWindow

**Description**

Closes the active window.

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

## Export

### CopyPicture

**Description**

Copies the picture.

**Parameters**

None.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### ExportView

**Description**

Exports the view.

**Parameters**

- `FileLocation` (str): file location.
- `FileName` (str): file name.
- `FileFormat` (int): file format.
- `Overwrite` (bool): overwrite.

**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.ExportView("value", "value", 1, True)
print(result)
```
