# Member Section & Material functions | OpenStaad Python

> Links each member to a cross-section and a material, plus its beta angle — what the member is made of, not its shape in space. Sections are defined in the section domains; materials in Material.

Source: https://www.openstaad.com/docs/member-section-material

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

## Create

### CreateBeamPropertyFromTable

**Description**

Creates a beam section property from the STAAD.Pro section table and returns its property ID, ready to be
passed to [`AssignBeamProperty`](/docs/member/section-material#AssignBeamProperty).

**Parameters**

- `country_code` (int): Country/section-table code. See table below.
- `section_name` (str): Name of the section, exactly as it appears in the STAAD.Pro table (e.g. `"W12X26"`).
- `type_spec` (int): Type specification number. See table below.
- `add_spec_1` (float): Free spacing for a double profile (`0.0` if not applicable).
- `add_spec_2` (float): Reserved; set to `0.0`.

##### Country Codes

| Code | Country                |
|------|------------------------|
| 1    | American               |
| 2    | Australian             |
| 3    | British                |
| 4    | Canadian               |
| 5    | Chinese                |
| 6    | Dutch                  |
| 7    | European               |
| 8    | French                 |
| 9    | German                 |
| 10   | Indian                 |
| 11   | Japanese               |
| 12   | Russian                |
| 13   | SouthAfrican           |
| 14   | Spanish                |
| 15   | Venezuelan             |
| 16   | Korean                 |
| 17   | Aluminum               |
| 18   | American cold formed   |
| 19   | Indian cold formed     |
| 20   | Mexican                |
| 21   | American Steel Joist   |
| 22   | AITCTimber             |
| 23   | Lysaght cold formed    |
| 24   | British cold formed    |
| 25     | Canadian Timber       |
| 26     | Butler cold formed    |
| 27     | Kingspan cold formed  |
| 28     | RCeco cold formed     |
| 29     | Japanese cold formed  |
| 30     | Australian cold formed|
| 31     | Russian cold formed   |
| 32     | STOASChM              |
| 33     | Jindal                |
| 34     | European cold formed  |
| 35     | Tata Structura        |
| 36     | Brazilian             |
| 37     | APL Apollo Tubes      |

##### Type specification (`type_spec`)

| Value | Type spec. | Description                                          |
|-------|------------|-------------------------------------------------------|
| 0     | ST         |                                                        |
| 2     | D          | Double profile.                                       |
| 5     | T          | Tee section cut from an I-section (aluminum).         |

**Returns**

int: The new property ID.

**Example**

```python
from openstaad import ops

s = ops.connect()
property_id = s.CreateBeamPropertyFromTable(1, "W12X26", 0, 0.0, 0.0)
print(property_id)
```

### CreateBeamPropertyFromTableComposite

**Description**

Creates the beam property from table composite.

**Parameters**

- `country_code` (int): country code.
- `section_name` (str): section name.
- `spec_type` (int): spec type.
- `additional_spec_list` (list): additional spec 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.CreateBeamPropertyFromTableComposite(1, "value", 1, [1, 2])
print(result)
```

### CreateBeamPropertyFromTableEx

**Description**

Creates the beam property from table ex.

**Parameters**

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

### CreateBeamPropertyFromTableWithCoverPlates

**Description**

Creates the beam property from table with cover plates.

**Parameters**

- `country_code` (int): country code.
- `section_name` (str): section name.
- `spec_type` (int): spec type.
- `additional_spec_list` (list): additional spec 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.CreateBeamPropertyFromTableWithCoverPlates(1, "value", 1, [1, 2])
print(result)
```

## Get

### GetBeamConstants

**Description**

Returns the beam constants.

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

### GetBeamMaterialName

**Description**

Returns the beam material name.

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

### GetBeamProperty

**Description**

Returns the beam property.

**Parameters**

- `beam_id` (int): beam id.

**Returns**

tuple: eight floats, `(width, depth, ax, ay, az, ix, iy, iz)`. In the model tested, `ix` behaved as the
torsional constant (much smaller than `iy` and `iz`).

Values come back in the model's [base units](/guides/base_units): width and depth in `m` or `in`,
areas in `m²` or `in²`, and inertias in `m⁴` or `in⁴`.

**Example**

```python
from openstaad import ops

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

### GetBeamPropertyAll

**Description**

Returns the beam property all.

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

### GetBeamSectionDisplayName

**Description**

Returns the beam section display name.

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

### GetBeamSectionName

**Description**

Returns the section name assigned to a beam.

**Parameters**

- `beam_id` (int): Beam number ID.

**Returns**

str: The section name as STAAD.Pro reports it.

See the following table for examples of probable section names:

| Sl No. | Section Type                                 | In STD file                    | GetBeamSectionName         |
|--------|----------------------------------------------|-------------------------------|----------------------------|
| 1      | Standard steel database section              | TABLE ST W36X925              | W36X925                    |
|        |                                              | TABLE D W36X925 SP 1          | W36X925                    |
|        |                                              | 5 TABLE SD L20205 SP 1        | L20205                     |
| 2      | Tube and pipe definition                     | 8 TABLE ST PIPE OD 2 ID 1     | PIPE                       |
|        |                                              | 8 TABLE ST TUBE TH 1 WT 2 DT 3| TUBE                       |
| 3      | Prismatic                                    | 3 PRIS YD 1 ZD 2 YB 2 ZB 3    | Prismatic Tee              |
|        |                                              | 8 PRIS YD 3 ZD 1 ZB 2         | Prismatic Trapezoid        |
| 4      | Tapered                                      | 3 TAPERED 1 2 3 1 2 3 1       | Taper                      |
| 5      | Assigned profile                             | 3 ASSIGN ANGLE DOUBLE         | Assign Double Angle        |
| 6      | User provided table                          | 14 TO 23 UPT 2 LANG40404      | LANG40404                  |

**Example**

```python
from openstaad import ops

s = ops.connect()
name = s.GetBeamSectionName(1)
print(name)
```

### GetBeamSectionPropertyRefNo

**Description**

Returns the section property reference number assigned to a beam.

**Parameters**

- `beam_id` (int): Beam number ID.

**Returns**

int: Reference number of the section property assigned to the beam, or `0` if none is assigned.

**Example**

```python
from openstaad import ops

s = ops.connect()
ref_no = s.GetBeamSectionPropertyRefNo(1)
print(ref_no)
```

### GetBeamSectionPropertyTypeNo

**Description**

Returns the beam section property type 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.GetBeamSectionPropertyTypeNo(1)
print(result)
```

### GetBeamSectionPropertyValuesEx

**Description**

Returns the beam section property values ex.

**Parameters**

- `beam_id` (int): beam id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetIsotropicMaterialAssignedBeamCount

**Description**

Returns the isotropic material assigned beam count.

**Parameters**

- `material_name` (str): material 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.GetIsotropicMaterialAssignedBeamCount("value")
print(result)
```

### GetIsotropicMaterialAssignedBeamList

**Description**

Returns the isotropic material assigned beam list.

**Parameters**

- `material_name` (str): material name.

**Returns**

list: A list of integers.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.GetIsotropicMaterialAssignedBeamList("value")
print(result)
```

### GetSectionPropertyAssignedBeamCount

**Description**

Returns the section property assigned beam count.

**Parameters**

- `prof_type` (int): prof 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.GetSectionPropertyAssignedBeamCount(1)
print(result)
```

### GetSectionPropertyAssignedBeamList

**Description**

Returns the section property assigned beam list.

**Parameters**

- `prof_type` (int): prof type.

**Returns**

list: A list of integers.

**Example**

```python
from openstaad import ops

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

## Set/Assign

### AssignBeamProperty

**Description**

Assigns a previously created section property to one or more beams.

**Parameters**

- `beam_ids` (int or list[int]): Beam number ID, or a list of beam number IDs, to assign the property to.
- `property_id` (int): Numeric ID of the section property, as returned by a `Create*PropertyFromTable`/`CreatePrismatic*Property` function.

**Returns**

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

**Notes**

Internally this wraps the OpenSTAAD COM call, which reports these codes on failure (all collapsed to `False` by `ops`):

| Code   | Meaning                                    |
|--------|---------------------------------------------|
| 0      | OK.                                          |
| -106   | `beam_ids` array dimension error.            |
| -3006  | Invalid member number ID(s).                 |
| -6001  | Invalid section / assigned property ID.      |
| -6002  | Library error: property assignment.          |

**Example**

```python
from openstaad import ops

s = ops.connect()
property_id = s.CreateBeamPropertyFromTable(1, "W12X26", 0, 0.0, 0.0)
ok = s.AssignBeamProperty([1, 2, 3], property_id)
print(ok)
```

### AssignMaterialToMember

**Description**

Assigns a material to one or more members.

**Parameters**

- `material_name` (str): Name of an existing material in the model (e.g. `"STEEL"`, `"CONCRETE"`).
- `member_ids` (int or list[int]): Member number ID, or a list of member number IDs.

**Returns**

int: the raw OpenSTAAD result code — `1` if the assignment succeeded, `0` otherwise.

**Example**

```python
from openstaad import ops

s = ops.connect()
result = s.AssignMaterialToMember("STEEL", [1, 2, 3])
print(result)
```

## Remove

### RemoveMaterialFromBeam

**Description**

Removes the material from beam.

**Parameters**

- `beam_id` (int): beam id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### RemovePropertyFromBeam

**Description**

Removes the property from beam.

**Parameters**

- `beam_id` (int): beam id.

**Returns**

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

**Example**

```python
from openstaad import ops

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