dlubal-software / RSTAB_Python_Client

Python client (or high-level functions) for RSTAB 9 using Web Services, SOAP, and WSDL
MIT License
9 stars 4 forks source link

BUG: ResultTables.MembersInternalForcesBySection won't work with RSTAB 9.02.0069 #21

Closed damianbobrowski closed 10 months ago

damianbobrowski commented 1 year ago

Describe the bug ResultTables.MembersInternalForcesBySection won't work with RSTAB 9.02.0069. It works with 9.02.0067

To Reproduce Run script:

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))

Expected behavior ResultTables.MembersInternalForcesBySection should work as in RSTAB 9.02.0067

Screenshots

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

Desktop (please complete the following information):

Additional context not this time

damianbobrowski commented 1 year ago

What I see now is RSTAB 9.02.67 returns empty string "" RSTAB 9.02.69 throw error ValueError: invalid literal for int() with base 10: 'IPE 100 | 1 - S235

so maybe my API call is wrong, and the difference is how RSTAB handle it between mentioned versions?

OndraMichal commented 1 year ago

Hi @damianbobrowski, no this is in fact a bug. The SUDS is expecting integer where string is placed. We've been registering this error since 13.6.

scja1991 commented 1 year ago

How far is the work on this? Is it still present in Version 9.03.0007?

damianbobrowski commented 1 year ago

@scja1991 When I test above script with RSTAB 9.03.0007 it works without error.

Example two rows:

{
      "location_flags": null,
      "member_number": 1.0,
      "location": 0.0,
      "internal_force_n": 0.0,
      "internal_force_vz": 2000.0,
      "node_number": 1.0,
      "internal_force_my": -10000.0,
      "internal_force_mt": 0.0,
      "internal_force_mz": 0.0,
      "internal_force_vy": 0.0,
      "specification": "1,2 | Beam | 1 - IPE 100 | L : 5.000 m"
    },
    {
      "location_flags": null,
      "member_number": 1.0,
      "location": 5.0,
      "internal_force_n": 0.0,
      "internal_force_vz": 2000.0,
      "node_number": 2.0,
      "internal_force_my": 2.8683189157163724e-10,
      "internal_force_mt": 0.0,
      "internal_force_mz": 0.0,
      "internal_force_vy": 0.0,
      "specification": "1,2 | Beam | 1 - IPE 100 | L : 5.000 m"
    },

@OndraMichal Is it officially fixed?

Sacek073 commented 10 months ago

Hello @damianbobrowski, I just tested the script above on versions RSTAB: 9.04.007 and tool 1.09.1 and it worked. So I would consider it as officially fixed. Thank you for reaching out to us.