# Node functions | OpenStaad Python

> The most fundamental modeling primitive — beams, plates, and solids all connect to nodes and are defined from them. Node-related loads and definitions live in their own domains (Load, Group).

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

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

## Create

### AddMultipleNodes

**Description**

Adds multiple the nodes.

**Parameters**

- `coordinates` (list): coordinates.

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

### AddNode

Adds a node with specified coordinates in the current model

This function adds a node with the specified coordinates to the current model and returns the node number automatically assigned.

##### Parameters

- **fCoordX**: Node X coordinate in GLOBAL.
- **fCoordY**: Node Y coordinate in GLOBAL.
- **fCoordZ**: Node Z coordinate in GLOBAL.

##### Return values

- **<Val>**: Node number assigned to this created node.
- **0**: OK.
- **-2004**: Unable to add node.

##### Example

```python
# Example usage of AddNode
from openstaad import ops

# Instanciar el módulo Geometry
s = ops.connect()

# Ejecutar la función desde el módulo geometry
node_id = s.AddNode(fCoordX, fCoordY, fCoordZ)
```

### CreateElementNodeReleaseSpec

**Description**

Creates the element node release spec.

**Parameters**

- `node_id` (int): node id.
- `dof_release` (list): dof release.

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

### CreateMultipleNodes

**Description**

Creates multiple the nodes.

**Parameters**

- `node_ids` (list): node ids.
- `nodeCoordinates` (list): node coordinates.

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

### CreateNode

**Description**

Creates the node.

**Parameters**

- `nNodeNo` (int): n node no.
- `x` (float): x.
- `y` (float): y.
- `z` (float): z.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## Get

### GetBeamsConnectedAtNode

**Description**
Retrieve a list of beams connected to a specific node.

**Parameters**
- node (int): Node number.

**Returns**
list: List of beam numbers connected at the node.

**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 the function from geometry module
beams = s.GetBeamsConnectedAtNode(7)

print(beams)
```

### GetBucklingModeDisplacementAtNode

**Description**

Returns the buckling mode displacement at node.

**Parameters**

- `buckling_mode_no` (int): buckling mode no.
- `node_no` (int): node no.

**Returns**

list: A list of numbers (floats).

**Example**

```python
from openstaad import ops

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

### GetLastNodeNo

**Description**
Retrieve the number of the last node in the STAAD model.

**Parameters**
- None

**Returns**
int: The last node number.

**Example**
```python
from openstaad import ops

# Connect to the running STAAD.Pro session
s = ops.connect()
 
#Execute the function from geometry module
last_node = s.GetLastNodeNo()

print(last_node)
```

### GetModalDisplacementAtNode

**Description**

Returns the modal displacement at node.

**Parameters**

- `modeNo` (int): mode no.
- `nodeNo` (int): node no.

**Returns**

list: A list of numbers (floats).

**Example**

```python
from openstaad import ops

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

### GetNLNodeDisplacements

**Description**

Returns the NL node displacements.

**Parameters**

- `nodeNo` (int): node no.
- `loadCaseNo` (int): load case no.
- `loadStep` (int): load step.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetNodeCoordinates

**Description**
Get the (x, y, z) coordinates of a given node.

**Parameters**
- node (int): The node number to retrieve coordinates for.

**Returns**
tuple: A tuple of (x, y, z) coordinates, rounded to 3 decimals.

**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 the function from geometry module
x, y, z = s.GetNodeCoordinates(1)

print(x,y,z)
```

### GetNodeCount

**Description**
Get the total number of nodes in the STAAD model.

**Parameters**
- None

**Returns**
int: Total number of nodes.

**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 the function from geometry module
count = s.GetNodeCount()

print(count)
```

### GetNodeDisplacements

**Description**

Returns the node displacements.

**Parameters**

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

**Returns**

list: A list of numbers (floats).

**Example**

```python
from openstaad import ops

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

### GetNodeDistance

**Description**
Compute the distance between two nodes.

**Parameters**
- nodeA (int): The first node number.
- nodeB (int): The second node number.

**Returns**
float: Distance between the two nodes, rounded to 3 decimals.

**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 the function from geometry module
distance = s.GetNodeDistance(1, 5)

print(distance)
```

### GetNodeIncidence

**Description**
Get the incidence (x, y, z) of a given node.
*Note: This method is equivalent to GetNodeCoordinates.*

**Parameters**
- node (int): The node number to retrieve incidence for.

**Returns**
tuple: A tuple of (x, y, z) incidence values, rounded to 3 decimals.

**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 the function from geometry module
x, y, z = s.GetNodeIncidence(2)

print(x,y,z)
```

### GetNodeIncidence_CIS2

**Description**

Returns the node incidence CIS 2.

**Parameters**

- `nodeId` (int): node Id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### GetNodeList

**Description**
Retrieve a list of all node numbers in the model.

**Parameters**
- None

**Returns**
list: List of all node numbers.

**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 the function from geometry module
nodes = s.GetNodeList()

print(nodes)
```

### GetNodeNumber

**Description**
Find the node number corresponding to a given set of coordinates.

**Parameters**
- x_y_z_coordinates (tuple): A tuple of (x, y, z) coordinates.

**Returns**
int: Node number at the given coordinates.

**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 the function from geometry module
node = s.GetNodeNumber((3.0, 0.0, 0.0))

print(node)
```

### GetNodeUniqueID

**Description**

Returns the node unique ID.

**Parameters**

- `nodeNo` (int): node 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.GetNodeUniqueID(1)
print(result)
```

### GetNoOfBeamsConnectedAtNode

**Description**
Get the number of beams connected at a specific node.

**Parameters**
- node (int): Node number.

**Returns**
int: Number of beams connected at the given node.

**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 the function from geometry module
count = s.GetNoOfBeamsConnectedAtNode(7)

print(count)
```

### GetNoOfSelectedNodes

**Description**
Get the number of selected nodes in the model.

**Parameters**
- None

**Returns**
int: Number of selected nodes.

**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 the function from geometry module
count = s.GetNoOfSelectedNodes()

print(count)
```

### GetPlateNodeCount

**Description**

Returns the plate node count.

**Parameters**

- `plateNo` (int): plate 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.GetPlateNodeCount(1)
print(result)
```

### GetSelectedNodes

**Description**
Retrieve a list of currently selected nodes.

**Parameters**
- None

**Returns**
list: List of selected node numbers.

**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 the function from geometry module
selected = s.GetSelectedNodes()

print(selected)
```

## Set/Assign

### SetNodeAnnotationMode

**Description**

Sets the node 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.SetNodeAnnotationMode(True, True)
```

### SetNodeCoordinate

**Description**

Sets the node coordinate.

**Parameters**

- `nodeNo` (int): node no.
- `x` (float): x.
- `y` (float): y.
- `z` (float): z.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SetNodeUniqueID

**Description**

Sets the node unique ID.

**Parameters**

- `nodeNo` (int): node no.
- `uniqueID` (str): unique ID.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

## Delete

### ClearNodeSelection

**Description**

Clears the node selection.

**Parameters**

None.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### DeleteNode

**Description**

Deletes the node.

**Parameters**

- `nNodeNo` (int): n node no.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### RemoveAllElementNodeReleaseSpec

**Description**

Removes the all element node release spec.

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

### RemoveElementNodeReleaseSpecFromPlate

**Description**

Removes the element node release spec from plate.

**Parameters**

- `plate_id` (int): plate id.
- `node_id` (int): node id.

**Returns**

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

**Example**

```python
from openstaad import ops

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

## Select

### SelectEntitiesConnectedToNode

**Description**

Selects the entities connected to node.

**Parameters**

- `entityType` (int): entity type.
- `nodeNo` (int): node no.

**Returns**

None: This function does not return a value.

**Example**

```python
from openstaad import ops

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

### SelectMultipleNodes

**Description**

Selects multiple the nodes.

**Parameters**

- `nodes` (list): nodes.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### SelectNode

**Description**

Selects the node.

**Parameters**

- `nodeID` (int): node ID.

**Returns**

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

**Example**

```python
from openstaad import ops

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

## Transform

### BreakBeamsAtSpecificNodes

**Description**

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

**Parameters**

- `nodeList` (list): node list.

**Returns**

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

**Example**

```python
from openstaad import ops

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

### MergeNodes

**Description**

Merges the nodes.

**Parameters**

- `new_Id` (int): new Id.
- `nodeList` (list): node list.

**Returns**

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

**Example**

```python
from openstaad import ops

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

## Is

### IsOrphanNode

**Description**

Checks whether orphan node.

**Parameters**

- `nodeNo` (int): node no.

**Returns**

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

**Example**

```python
from openstaad import ops

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