import json
from pathlib import Path
from RSTAB.enums import NodalSupportType
from RSTAB.initModel import Model, Calculate_all
from RSTAB.BasicObjects.node import Node
from RSTAB.BasicObjects.material import Material
from RSTAB.BasicObjects.section import Section
from RSTAB.BasicObjects.member import Member
from RSTAB.enums import (
ActionCategoryType,
AnalysisType,
CaseObjectType,
DesignSituationType,
NodalLoadDirection,
)
from RSTAB.LoadCasesAndCombinations.designSituation import DesignSituation
from RSTAB.LoadCasesAndCombinations.loadCase import LoadCase
from RSTAB.LoadCasesAndCombinations.loadCasesAndCombinations import LoadCasesAndCombinations
from RSTAB.LoadCasesAndCombinations.loadCombination import LoadCombination
from RSTAB.LoadCasesAndCombinations.staticAnalysisSettings import StaticAnalysisSettings
from RSTAB.Loads.nodalLoad import NodalLoad
from RSTAB.TypesForNodes.nodalSupport import NodalSupport
# from RSTAB.Results.designOverview import GetDesignOverview
from RSTAB.Results.resultTables import ResultTables
# create the model
Model(True, 'Demo', delete_all=True)
# create a basic geometry
Node(1, 0, 0, 0)
Node(2, 5, 0, 0)
Material(1, "S235", params=None)
Section(1, "IPE 100 | EN 10365:2017 | ArcelorMittal (2018)", params=None)
Member(1, 1, 2, 0, 1 , 1)
NodalSupport(1, '1', NodalSupportType.FIXED)
######################## LoadCases and Combination ################# noqa #
StaticAnalysisSettings.GeometricallyLinear(1, "Linear")
######################## Design Situations ################# noqa #
DesignSituation(2, DesignSituationType.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10, True, "Stress")
######################## Load Cases ################# noqa #
LoadCase(1, "Self Weight", [True, 0.0, 0.0, 1.0], params={"action_category": ActionCategoryType.ACTION_CATEGORY_PERMANENT_G.name})
LoadCase(2, "FinishMaterials", [False], params={"action_category": ActionCategoryType.ACTION_CATEGORY_PERMANENT_G.name})
######################## Load Combination ################# noqa #
LoadCombination(1, AnalysisType.ANALYSIS_TYPE_STATIC, 2, combination_items=[[1.35, 1, 0, False], [1.35, 2, 0, False]])
######################## Nodal Loads ################# noqa #
NodalLoad.Force(1, 2, "2", NodalLoadDirection.LOAD_DIRECTION_LOCAL_Z, 2000.0)
# SetAddonStatus(Model.clientModel, AddOn.steel_design_active, True)
# calculation
Calculate_all()
BASE_DIR = Path(__file__).resolve().parent
# Load Cases
result_file = BASE_DIR / "resultTablesLC.json"
result = {}
result["nd"] = ResultTables.NodesDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["nsf"] = ResultTables.NodesSupportForces(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["mgd"] = ResultTables.MembersGlobalDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["mif"] = ResultTables.MembersInternalForces(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["mifbs"] = ResultTables.MembersInternalForcesBySection(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["mld"] = ResultTables.MembersLocalDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
result["ms"] = ResultTables.MembersStrains(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
with result_file.open(mode="w") as rf:
rf.write(json.dumps(result, indent=2))
# Load Combinations
result_file = BASE_DIR / "resultTablesCO.json"
result = {}
result["nd"] = ResultTables.NodesDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["nsf"] = ResultTables.NodesSupportForces(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["mgd"] = ResultTables.MembersGlobalDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["mif"] = ResultTables.MembersInternalForces(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["mifbs"] = ResultTables.MembersInternalForcesBySection(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["mld"] = ResultTables.MembersLocalDeformations(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
result["ms"] = ResultTables.MembersStrains(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 1, 1)
with result_file.open(mode="w") as rf:
rf.write(json.dumps(result, indent=2))
# Design Situation
result_file = BASE_DIR / "resultTablesDS.json"
result = {}
result["nd"] = ResultTables.NodesDeformations(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["nsf"] = ResultTables.NodesSupportForces(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["mgd"] = ResultTables.MembersGlobalDeformations(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["mif"] = ResultTables.MembersInternalForces(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["mifbs"] = ResultTables.MembersInternalForcesBySection(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["mld"] = ResultTables.MembersLocalDeformations(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
result["ms"] = ResultTables.MembersStrains(CaseObjectType.E_OBJECT_TYPE_DESIGN_SITUATION, 2, 1)
with result_file.open(mode="w") as rf:
rf.write(json.dumps(result, indent=2))
PS E:\debug\rstab_0069_breaks_result_tables> python example.py
Connecting to server...
Traceback (most recent call last):
File "E:\debug\rstab_0069_breaks_result_tables\example.py", line 72, in <module>
result["mifbs"] = ResultTables.MembersInternalForcesBySection(CaseObjectType.E_OBJECT_TYPE_LOAD_CASE, 2, 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\RSTAB\Results\resultTables.py", line 605, in MembersInternalForcesBySection
return ConvertResultsToListOfDct(model.clientModel.service.get_results_for_members_internal_forces_by_section(loading_type.name, loading_no, object_no), include_base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 559, in __call__
return client.invoke(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 618, in invoke
result = self.send(soapenv)
^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 658, in send
result = self.succeeded(binding, reply.message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\client.py", line 696, in succeeded
reply, result = binding.get_reply(self.method, reply)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\bindings\binding.py", line 166, in get_reply
result = unmarshaller.process(nodes[0], resolved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\typed.py", line 66, in process
return Core.process(self, content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 52, in process
return self.append(content)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 67, in append
self.append_children(content)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 148, in append_children
cval = self.append(cont)
^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 67, in append
self.append_children(content)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 148, in append_children
cval = self.append(cont)
^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 67, in append
self.append_children(content)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 148, in append_children
cval = self.append(cont)
^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\core.py", line 68, in append
self.append_text(content)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\typed.py", line 135, in append_text
content.text = self.translated(content.text, known)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\umx\typed.py", line 141, in translated
return resolved.translate(value)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\xsd\sxbuiltin.py", line 97, in translate
return int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'IPE 100 | 1 - S235