# Section Query & Attributes functions | OpenStaad Python

> Query section properties — area, moments of inertia, dimensions — for any assigned or table section.

Source: https://www.openstaad.com/docs/section-query-attributes

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

## Get

### GetAssignedAttributeByIndex

**Description**

Returns the assigned attribute by index.

**Parameters**

- `attribute_index` (int): attribute index.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetAssignedAttributeCount

**Description**

Returns the assigned attribute count.

**Parameters**

- `member_id` (int): member 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.GetAssignedAttributeCount(1)
print(result)
```

### GetCentroidLocationForSection

**Description**

Returns the centroid location for section.

**Parameters**

- `property_id` (int): property id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetCountofSectionPropertyValuesEx

**Description**

Returns the countof section property values ex.

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

### GetMaxSectionDisplacement

**Description**

Returns the max section displacement.

**Parameters**

- `memberNo` (int): member no.
- `dir` (str): dir.
- `loadCaseNo` (int): load case no.

**Returns**

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

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.GetMaxSectionDisplacement(1, "value", 1)
print(result)
```

### GetPID

**Description**

Returns the PID.

**Parameters**

- `EntityNo` (int): entity no.
- `EntityType` (int): entity type.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetPropertyUniqueID

**Description**

Returns the property unique ID.

**Parameters**

- `property_unique_id` (int): property unique 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.GetPropertyUniqueID(1)
print(result)
```

### GetRecordForSection

**Description**

Returns the record for section.

**Parameters**

- `country_code` (int): country code.
- `section_name` (str): section 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.GetRecordForSection(1, "value")
print(result)
```

### GetSectionPropertyCount

**Description**

Returns the section property 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.GetSectionPropertyCount()
print(result)
```

### GetSectionPropertyCountry

**Description**

Returns the section property country.

**Parameters**

- `sec_ref_no` (int): sec ref no.

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

### GetSectionPropertyList

**Description**

Returns the section property list.

**Parameters**

None.

**Returns**

list: A list of integers.

**Example**

```python
from openstaad import ops

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

### GetSectionPropertyName

**Description**

Returns the section property name.

**Parameters**

- `sctn_prop_id` (int): sctn prop id.

**Returns**

str: A string value returned by STAAD.Pro for this call.

**Example**

```python
from openstaad import ops

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

### GetSectionPropertyType

**Description**

Returns the section property type.

**Parameters**

- `sec_ref_no` (int): sec ref no.

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

### GetSectionPropertyValues

**Description**

Returns the 10 basic section property values for an assigned profile type.

**Parameters**

- `prof_type` (int): Assigned profile type code:

  | Profile type       | Value |
  |---------------------|-------|
  | AssignAngle         | 0     |
  | AssignDoubleAngle   | 1     |
  | AssignBeam          | 2     |
  | AssignColumn        | 3     |
  | AssignChannel       | 4     |

**Returns**

tuple: A 10-element tuple of floats, in this order: `(width, depth, ax, ay, az, ix, iy, iz, tf, tw)`.

| # | Value | Meaning                                                                             |
|---|-------|--------------------------------------------------------------------------------------|
| 1 | width | Section width (WID).                                                                |
| 2 | depth | Section depth (DEP).                                                                |
| 3 | ax    | Cross-sectional area (Ax).                                                          |
| 4 | ay    | Shear area in local y axis; if zero, shear deformation is ignored in analysis (Ay). |
| 5 | az    | Shear area in local z axis; if zero, shear deformation is ignored in analysis (Az). |
| 6 | ix    | Moment of inertia about local z axis (Ix).                                          |
| 7 | iy    | Moment of inertia about local y axis (Iy).                                          |
| 8 | iz    | Torsional constant (Iz).                                                            |
| 9 | tf    | Top flange thickness (Tf).                                                          |
| 10| tw    | Web thickness (Tw).                                                                 |

**Example**

```python
from openstaad import ops

s = ops.connect()
width, depth, ax, ay, az, ix, iy, iz, tf, tw = s.GetSectionPropertyValues(2)
print(width, depth, ax)
```

### GetSectionPropertyValuesEx

**Description**

Returns the section property values ex.

**Parameters**

- `section_property_id` (int): section property id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetSectionTableNo

**Description**

Returns the section table no.

**Parameters**

- `beam_id` (int): beam 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.GetSectionTableNo(1)
print(result)
```

### GetShapeCode

**Description**

Returns the shape code.

**Parameters**

- `country_code` (int): country code.
- `section_name` (str): section 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.GetShapeCode(1, "value")
print(result)
```

## Set/Assign

### SetPID

**Description**

Sets the PID.

**Parameters**

- `EntityNo` (int): entity no.
- `EntityType` (int): entity type.
- `PropertyID` (int): property ID.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SetPropertyUniqueID

**Description**

Sets the property unique ID.

**Parameters**

- `property_number` (int): property number.
- `property_unique_id` (str): property unique id.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### UpdatePropertiesToDesignSection

**Description**

Updates the properties to design section.

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

## Remove

### RemoveAttribute

**Description**

Removes the attribute.

**Parameters**

- `attribute_name` (str): attribute name.
- `str_value` (str): str value.
- `member_ids` (list): member ids.

**Returns**

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

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.RemoveAttribute("value", "value", [1, 2])
print(result)
```

## Delete

### DeleteProperty

**Description**

Deletes the property.

**Parameters**

- `property_id` (int): property 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.DeleteProperty(1)
print(result)
```
