Skip to content

Structure Group

A nested class within Group used to create and manage structure groups containing nodes and elements.

Constructor


Group.Structure(name, nlist=[], elist=[])

Creates a structure group with specified name and optional node/element lists.

Parameters

  • name: Name of the structure group
  • nlist (default=[]): List of node IDs to include in the group
  • elist (default=[]): List of element IDs to include in the group

Class Attributes

Group.Structure.Groups -> List of all structure groups.

Object Attributes

  • NAME (str): The name of the structure group.
  • ID (int): The ID of the structure group.
  • ELIST (list): A list of element numbers belonging to this group.
  • NLIST (list): A list of node numbers belonging to this group.

Methods


Group.Structure.update

Updates an existing structure group with new node/element lists.

Group.Structure.update(name, operation="r", nlist=[], elist=[])

Parameters
  • name: Name of the group to update
  • operation (default="r"): Operation type ("r" for replace, "a" for add)
  • nlist (default=[]): List of node IDs
  • elist (default=[]): List of element IDs
# Replace existing lists
Group.Structure.update("Main Girder", "r", nlist=[1, 2, 3, 4], elist=[1, 2, 3])

# Add to existing lists
Group.Structure.update("Main Girder", "a", nlist=[5], elist=[4])

Group.Structure.json

Returns a JSON representation of all Structure Groups defined in python.

sg1 = Group.Structure("Main Girder", nlist=[1, 2], elist=[1])
print(Group.Structure.json())

# Output:
# {'Assign': {1: {'NAME': 'Main Girder', 'P_TYPE': 0, 'N_LIST': [1, 2], 'E_LIST': [1]}}}

Group.Structure.create

Sends the current structure group list to Civil NX using a PUT request.

Group.Structure.create()

Group.Structure.get

Fetches structure groups from Civil NX and returns the JSON representation.

print(Group.Structure.get())

Group.Structure.sync

Retrieves Structure Group data from Civil NX and rebuilds the internal group list.

Group.Structure.sync()
for sg in Group.Structure.Groups:
    print(f'Structure Group: {sg.NAME} | Nodes: {sg.NLIST} | Elements: {sg.ELIST}')

Group.Structure.delete

Deletes all structure group data from both Python and Civil NX.

Group.Structure.delete()

Examples


# Create nodes and elements first
for i in range(3):
    Node(i*10, 0, 0)
Node.create()

Element.Beam(1, 2)
Element.Beam(2, 3)
Element.create()

# Create structure groups
sg1 = Group.Structure("Main Girder", nlist=[1, 2, 3], elist=[1, 2])
sg2 = Group.Structure("Secondary", nlist=[1], elist=[1])

for sg in Group.Structure.Groups:
    print(f'Group ID: {sg.ID} | Name: {sg.NAME} | Nodes: {sg.NLIST} | Elements: {sg.ELIST}')

# Output:
# Group ID: 1 | Name: Main Girder | Nodes: [1, 2, 3] | Elements: [1, 2]
# Group ID: 2 | Name: Secondary | Nodes: [1] | Elements: [1]