Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions RFEM/TypesForSteelDesign/steelBoundaryConditions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
from RFEM.initModel import *
from RFEM.enums import *

class SteelBoundaryConditions():
def __init__(self,
no: int = 1,
user_defined_name: list = [False],
members: str = '',
member_sets : str = '',
intermediate_nodes : bool = False,
different_properties_supports: bool = True,
different_properties_hinges: bool = True,
nodal_supports: list = [
[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""],
[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""]
],
member_hinges: list = [
["Start", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""],
["End", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""]
],
comment: str = '',
params: dict = {}):

"""
Args:
no (int): Boundary Conditions Tag
user_defined_name (list): User Defined Boundary Conditions Name

for user_defined_name[0] == False:
pass
for user_defined_name == True:
user_defined_name[1] = Defined Name

members (str): Assigned Members
member_sets (str): Assigned Member Sets
intermediate_nodes (bool): Intermediate Nodes Option
different_properties_supports (bool): Different Properties Option for Supports
different_properties_hinges (bool): Different Properties Option for Hinges

nodal_supports (list): Nodal Supports Table Definition

nodal_supports[i][0] (int)= Node Sequence No.
nodal_supports[i][1] (enum)= Support Type Enumeration
nodal_supports[i][2] (bool)= Support in X Direction Option
nodal_supports[i][3] (bool)= Support in Y Direction Option
nodal_supports[i][4] (bool)= Support in Z Direction Option
nodal_supports[i][5] (bool)= Restraint About X Option
nodal_supports[i][6] (bool)= Restraint About Y Option
nodal_supports[i][7] (bool)= Restraint About Z Option
nodal_supports[i][8] (bool)= Restraint Warping Option
nodal_supports[i][9] (float)= Rotation Magnitude
nodal_supports[i][10] (float)= Rotation About X Magnitude
nodal_supports[i][11] (float)= Rotation About Y Magnitude
nodal_supports[i][12] (float)= Rotation About Z Magnitude
nodal_supports[i][13] (float)= Support Spring X
nodal_supports[i][14] (float)= Support Spring Y
nodal_supports[i][15] (float)= Support Spring Z
nodal_supports[i][16] (float)= Restraint Spring About X Magnitude
nodal_supports[i][17] (float)= Restraint Spring About Y Magnitude
nodal_supports[i][18] (float)= Restraint Spring About Z Magnitude
nodal_supports[i][19] (float)= Restraint Spring Warping Magnitude
nodal_supports[i][20] (enum)= Eccentricity Type in Z Enumeration
nodal_supports[i][21] (float)= Eccentricity in X Magnitude
nodal_supports[i][22] (float)= Eccentricity in Y Magnitude
nodal_supports[i][23] (float)= Eccentricity in Z Magnitude
nodal_supports[i][24] (str)= Assigned Nodes

member_hinges (list): Member Hinges Table Definition


member_hinges[i][0] = Node Sequence No.
member_hinges[i][1] = Release in X Option
member_hinges[i][2] = Release in Y Option
member_hinges[i][3] = Release in Z Option
member_hinges[i][4] = Release About X Option
member_hinges[i][5] = Release About Y Option
member_hinges[i][6] = Release About Z Option
member_hinges[i][7] = Release Warping Option
member_hinges[i][8] = Release Spring in X Magnitude
member_hinges[i][9] = Release Spring in Y Magnitude
member_hinges[i][10] = Release Spring in Z Magnitude
member_hinges[i][11] = Release Spring About X Magnitude
member_hinges[i][12] = Release Spring About Y Magnitude
member_hinges[i][13] = Release Spring About Z Magnitude
member_hinges[i][14] = Release Spring Warping Magnitude
member_hinges[i][15] = Assigned Nodes

comment (str, optional): Comment
params (dict, optional): Parameters
"""

# Client Model | Types For Steel Design Boundary Conditions
clientObject = Model.clientModel.factory.create('ns0:steel_boundary_conditions')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Boundary Conditions No.
clientObject.no = no

# Boundary Conditions User Defined Name
if user_defined_name[0] == False:
clientObject.user_defined_name_enabled = user_defined_name[0]
else:
clientObject.user_defined_name_enabled = user_defined_name[0]
clientObject.name = user_defined_name[1]

# Intermediate Nodes Option
clientObject.intermediate_nodes = intermediate_nodes

# Boundary Conditions Assigned Members
clientObject.members = ConvertToDlString(members)

# Boundary Conditions Assigned Member Sets
clientObject.member_sets = ConvertToDlString(member_sets)

# Boundary Conditions Nodal Supports
clientObject.nodal_supports = Model.clientModel.factory.create('ns0:steel_boundary_conditions.nodal_supports')

for i,j in enumerate(nodal_supports):
mlvlp = Model.clientModel.factory.create('ns0:steel_boundary_conditions_nodal_supports')
mlvlp.no = i
mlvlp.node_seq_no = nodal_supports[i][0]
mlvlp.support_type = nodal_supports[i][1].name
mlvlp.support_in_x = nodal_supports[i][2]
mlvlp.support_in_y = nodal_supports[i][3]
mlvlp.support_in_z = nodal_supports[i][4]
mlvlp.restraint_about_x = nodal_supports[i][5]
mlvlp.restraint_about_y = nodal_supports[i][6]
mlvlp.restraint_about_z = nodal_supports[i][7]
mlvlp.restraint_warping = nodal_supports[i][8]
mlvlp.rotation = nodal_supports[i][9]
mlvlp.rotation_about_x = nodal_supports[i][10]
mlvlp.rotation_about_y = nodal_supports[i][11]
mlvlp.rotation_about_z = nodal_supports[i][12]
mlvlp.support_spring_in_x = nodal_supports[i][13]
mlvlp.support_spring_in_y = nodal_supports[i][14]
mlvlp.support_spring_in_z = nodal_supports[i][15]
mlvlp.restraint_spring_about_x = nodal_supports[i][16]
mlvlp.restraint_spring_about_y = nodal_supports[i][17]
mlvlp.restraint_spring_about_z = nodal_supports[i][18]
mlvlp.restraint_spring_warping = nodal_supports[i][19]
mlvlp.eccentricity_type_z_type = nodal_supports[i][20].name
mlvlp.eccentricity_x = nodal_supports[i][21]
mlvlp.eccentricity_y = nodal_supports[i][22]
mlvlp.eccentricity_z = nodal_supports[i][23]
mlvlp.nodes = nodal_supports[i][24]

clientObject.nodal_supports.steel_boundary_conditions_nodal_supports.append(mlvlp)

# Boundary Conditions Member Hinges
clientObject.member_hinges = Model.clientModel.factory.create('ns0:steel_boundary_conditions.member_hinges')

for i,j in enumerate(member_hinges):
mlvlp = Model.clientModel.factory.create('ns0:steel_boundary_conditions_member_hinges')
mlvlp.no = i
mlvlp.node_seq_no = member_hinges[i][0]
mlvlp.release_in_x = member_hinges[i][1]
mlvlp.release_in_y = member_hinges[i][2]
mlvlp.release_in_z = member_hinges[i][3]
mlvlp.release_about_x = member_hinges[i][4]
mlvlp.release_about_y = member_hinges[i][5]
mlvlp.release_about_z = member_hinges[i][6]
mlvlp.release_warping = member_hinges[i][7]
mlvlp.release_spring_in_x = member_hinges[i][8]
mlvlp.release_spring_in_y = member_hinges[i][9]
mlvlp.release_spring_in_z = member_hinges[i][10]
mlvlp.release_spring_about_x = member_hinges[i][11]
mlvlp.release_spring_about_y = member_hinges[i][12]
mlvlp.release_spring_about_z = member_hinges[i][13]
mlvlp.release_spring_warping = member_hinges[i][14]
mlvlp.nodes = member_hinges[i][15]

clientObject.member_hinges.steel_boundary_conditions_member_hinges.append(mlvlp)

# Boundary Conditions Different Properties Supports
clientObject.different_properties_supports = different_properties_supports

# Boundary Conditions Different Properties Hinges
clientObject.different_properties_hinges = different_properties_hinges

# Comment
clientObject.comment = comment

# Adding optional parameters via dictionary
for key in params:
clientObject[key] = params[key]

# Add Steel Boundary Conditions to client model
Model.clientModel.service.set_steel_boundary_conditions(clientObject)

13 changes: 13 additions & 0 deletions RFEM/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,3 +1372,16 @@ class SteelEffectiveLengthsMemberTypeZZ(Enum):
'''
MEMBER_TYPE_BEAM, MEMBER_TYPE_CANTILEVER = range(2)

class SteelBoundaryConditionsSupportType(Enum):
'''
Steel Boundary Conditions Support Type
'''
SUPPORT_TYPE_FIXED_ALL, SUPPORT_TYPE_FIXED_IN_Y, SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION_AND_WARPING, \
SUPPORT_TYPE_FIXED_IN_Y_AND_WARPING, SUPPORT_TYPE_INDIVIDUALLY, SUPPORT_TYPE_NONE, SUPPORT_TYPE_TORSION, SUPPORT_TYPE_TORSION_AND_WARPING = range(9)

class SteelBoundaryConditionsEccentricityTypeZ(Enum):
'''
Steel Boundary Conditions Eccentricity Type Z Type
'''
ECCENTRICITY_TYPE_AT_LOWER_FLANGE, ECCENTRICITY_TYPE_AT_UPPER_FLANGE, ECCENTRICITY_TYPE_NONE, ECCENTRICITY_TYPE_USER_VALUE = range(4)

69 changes: 69 additions & 0 deletions UnitTests/test_steelBoundaryConditions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import sys
import os
import pytest
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.pardir)
)
sys.path.append(PROJECT_ROOT)

# Import der Bibliotheken
from RFEM.enums import *
from RFEM.initModel import Model, SetAddonStatus, CheckIfMethodOrTypeExists
from RFEM.TypesForSteelDesign.steelBoundaryConditions import *

if Model.clientModel is None:
Model()

@pytest.mark.skipif(CheckIfMethodOrTypeExists(Model.clientModel,'ns0:steel_boundary_conditions', True), reason="Type ns0:steel_boundary_conditions not in RFEM GM yet")

def test_steelEffectiveLengths():

Model.clientModel.service.begin_modification()

SetAddonStatus(Model.clientModel, AddOn.steel_design_active, True)

SteelBoundaryConditions(1, [True, "BCTEST_1"], '1', '', True, True, True,

nodal_supports= [
[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""],

[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""]
],
member_hinges=[
["Start", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""],
["End", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""]
]
)

SteelBoundaryConditions(2, [True, "BCTEST_2"], '', '', True, True, True,

nodal_supports= [
[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""],

[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""],

[None, SteelBoundaryConditionsSupportType.SUPPORT_TYPE_FIXED_IN_Y_AND_TORSION, False, True, False, True, False, False, False,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SteelBoundaryConditionsEccentricityTypeZ.ECCENTRICITY_TYPE_USER_VALUE, 0.0, 0.0, 0.0, ""]
],
member_hinges=[
["Start", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""],
["Inter.", False, False, False, False, False, False, False, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""],
["End", True, False, False, True, False, False, True, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ""]
]
)

bc_1 = Model.clientModel.service.get_steel_boundary_conditions(1)

assert bc_1.no == 1
assert bc_1.nodal_supports[0][0][0] == 0

bc_2 = Model.clientModel.service.get_steel_boundary_conditions(2)

assert bc_2.member_hinges[0][1][1] == "Inter."

Model.clientModel.service.finish_modification()