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: GetDesignOverview() won't work #20

Closed damianbobrowski closed 1 year ago

damianbobrowski commented 1 year ago

Describe the bug GetDesignOverview() reports b"Server raised fault: 'Calculate all first.'" despite Calculate_all()

To Reproduce Run script:

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.TypesForNodes.nodalSupport import NodalSupport
from RSTAB.Results.designOverview import GetDesignOverview

# create the model
Model(True,'Demo')

# create a basic geometry
Node(1, 0,0,0)
Node(2, 5,0,0)
Material()
Section()
Member(1,1,2,0,1,1)
NodalSupport(1, '1', NodalSupportType.FIXED)

# to be able to get design overview, calculation should be done
Calculate_all()

# get design overview
print(GetDesignOverview())

Expected behavior return design overview

Screenshots

PS E:\examples\desing_overview> python .\example.py
Connecting to server...
Traceback (most recent call last):
  File "E:\examples\desing_overview\example.py", line 25, in <module>
    print(GetDesignOverview())
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\RSTAB\Results\designOverview.py", line 8, in GetDesignOverview
    return model.clientModel.service.get_design_overview()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 152, in get_reply
    self.detect_fault(soapbody)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\suds\bindings\binding.py", line 183, in detect_fault
    raise WebFault(p, fault)

Desktop (please complete the following information):

Additional context

OndraMichal commented 1 year ago

Hi @damianbobrowski, just checked GetDesignOverview() and it works in both RFEM and RSTAB. 6.6.2023 it was merged to RFEM, so I recommend using RFEM from 12.6. further. Your script doesn't have any loads, so there is nothing to calculate. But I test your script with load and it is still returning Server raised fault: 'Calculate all first.' so there seems to be a bug.

damianbobrowski commented 1 year ago

I am not sure it is a case. Yes, in script there is no loads but RSTAB adds automatically "self weight" loads. There was calculations, I saw cantiliver displacements. image

Anyway If I add explicitly loads with scripts:

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,
    MemberHingeDiagramType,
    MemberHingeNonlinearity,
    MemberLoadDirection,
    MemberLoadDistribution,
)
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

# create the model
Model(True,'Demo')

# create a basic geometry
Node(1, 0,0,0)
Node(2, 5,0,0)
Material()
Section()
Member(1,1,2,0,1,1)
NodalSupport(1, '1', NodalSupportType.FIXED)

########################        LoadCases and Combination       ################# noqa #
# This is created by default when user opens new model from GUI
StaticAnalysisSettings.GeometricallyLinear(1, "Linear")
# StaticAnalysisSettings.SecondOrderPDelta(2, "SecondOrder")
# StaticAnalysisSettings.LargeDeformation(3, "LargeDeformation")

########################     LoadCases and Combination Wizz     ################# noqa #
load_cases_and_combinations_settings = {
    "current_standard_for_combination_wizard": 6207,
    "activate_combination_wizard_and_classification": True,
    "activate_combination_wizard": False,
    "result_combinations_active": False,
    "result_combinations_parentheses_active": False,
    "result_combinations_consider_sub_results": False,
    "combination_name_according_to_action_category": False
}
LoadCasesAndCombinations(load_cases_and_combinations_settings)

########################           Design Situations            ################# noqa #
DesignSituation(2, DesignSituationType.DESIGN_SITUATION_TYPE_STR_PERMANENT_AND_TRANSIENT_6_10, True, "Stress")
DesignSituation(3, DesignSituationType.DESIGN_SITUATION_TYPE_SLS_CHARACTERISTIC, True, "Deflection")

########################               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})
LoadCase(3, "Wind X", [False], params={"action_category": ActionCategoryType.ACTION_CATEGORY_WIND_QW.name})
LoadCase(4, "Wind Y", [False], params={"action_category": ActionCategoryType.ACTION_CATEGORY_WIND_QW.name})

########################            Load Combination            ################# noqa #
LoadCombination(1, AnalysisType.ANALYSIS_TYPE_STATIC, 2, combination_items=[[1.35, 1, 0, False], [1.35, 2, 0, False], [1.5, 3, 0, False]])
LoadCombination(2, AnalysisType.ANALYSIS_TYPE_STATIC, 2, combination_items=[[1.35, 1, 0, False], [1.35, 2, 0, False], [1.5, 4, 0, False]])
LoadCombination(3, AnalysisType.ANALYSIS_TYPE_STATIC, 2, combination_items=[[1.35, 1, 0, False], [1.35, 2, 0, False]])
LoadCombination(4, AnalysisType.ANALYSIS_TYPE_STATIC, 3, combination_items=[[1, 1, 0, False], [1, 2, 0, False], [1, 3, 0, False]])
LoadCombination(5, AnalysisType.ANALYSIS_TYPE_STATIC, 3, combination_items=[[1, 1, 0, False], [1, 2, 0, False], [1, 4, 0, False]])

########################              Nodal Loads               ################# noqa #
NodalLoad.Force(1, 2, "2", NodalLoadDirection.LOAD_DIRECTION_LOCAL_Z, 2000.0)

# to be able to get design overview, calculation should be done
Calculate_all()

# get design overview
print(GetDesignOverview())

Error still exist on my side, despite on Desktop App everything went OK: image


6.6.2023 it was merged to RFEM, so I recommend using RFEM from 12.6. further

I do not get it. I am using RSTAB 9.02.0069 with RSTAB 1.7.0 (https://pypi.org/project/RSTAB/). Both are seems to be latest versions of Dlubal's Software. What I should change?

OndraMichal commented 1 year ago

Looking at design overview printout it is tied to Addons, so some design addon should be selected. In this case Steel Design and then Load Combination or Result Combination should be created. image

(array_of_design_overview){
   design_overview[] =
      (design_overview_row){
         no = 1
         description = "1"
         row =
            (design_overview){
               addon = "Steel Design"
               object_type = "E_OBJECT_TYPE_MEMBER"
               objects_no = "1"
               location = "x: 0.000"
               design_situation = "1"
               loading = "1"
               design_ratio = 1.898
               design_check_type = "SP4100.03"
               description = "Section Proof | Bending about y-axis acc. to EN 1993-1-1, 6.2.5 | Plastic design"
            }
      },
      (design_overview_row){
         no = 2
         description = "2"
         row =
            (design_overview){
               addon = "Steel Design"
               object_type = "E_OBJECT_TYPE_MEMBER"
               objects_no = "1"
               location = "x: 2.000"
               design_situation = "1"
               loading = "1"
               design_ratio = 1.089
               design_check_type = "SP6500.02"
               description = "Section Proof | Bending about y-axis, axial force and shear acc. to EN 1993-1-1, 6.2.9.1 and 6.2.10 | Plastic design"
            }
      },
      (design_overview_row){
         no = 3
         description = "3"
         row =
            (design_overview){
               addon = "Steel Design"
               object_type = "E_OBJECT_TYPE_MEMBER"
               objects_no = "1"
               location = "x: 0.000"
               design_situation = "1"
               loading = "1"
               design_ratio = 0.178
               design_check_type = "SP3100.02"
               description = "Section Proof | Shear in z-axis acc. to EN 1993-1-1, 6.2.6(2) | Plastic design"
            }
      },
      (design_overview_row){
         no = 4
         description = "4"
         row =
            (design_overview){
               addon = "Steel Design"
               object_type = "E_OBJECT_TYPE_MEMBER"
               objects_no = "1"
               location = "x: 4.500"
               design_situation = "1"
               loading = "1"
               design_ratio = 0.002
               design_check_type = "SP1100.00"
               description = "Section Proof | Tension acc. to EN 1993-1-1, 6.2.3"
            }
      },
 }
damianbobrowski commented 1 year ago

Ok, having info about dependencies is more easier to find solution. Setting Addon makes script working

from RSTAB.initModel import Model, Calculate_all,  SetAddonStatus
from RSTAB.Results.designOverview import GetDesignOverview

SetAddonStatus(Model.clientModel, AddOn.steel_design_active, True)`
Calculate_all()
GetDesignOverview()

So error is misleading, then for better DX experience:

@OndraMichal thanks for your help