Skip to content

Commit 3a20fa7

Browse files
authored
Merge pull request #352 from Dlubal-Software/heet-meshResult
Heet deformed mesh result
2 parents d2bf835 + b8362bb commit 3a20fa7

File tree

3 files changed

+151
-19
lines changed

3 files changed

+151
-19
lines changed

RFEM/Results/meshTables.py

Lines changed: 102 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from RFEM.initModel import Model
22
from RFEM.Results.resultTables import ConvertResultsToListOfDct
3+
from RFEM.enums import CaseObjectType
34

45
class MeshTables():
56

@@ -9,64 +10,154 @@ def GetAllFENodes(
910
model = Model):
1011
'''
1112
Args:
12-
model(class, optional): Model instance
13+
model (class, optional): Model instance
1314
'''
1415
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_nodes_original_mesh(), include_base)
1516

1617
@staticmethod
17-
def getAllFE1DElements(
18+
def GetAllFE1DElements(
1819
include_base: bool = False,
1920
model = Model):
2021
'''
2122
Args:
22-
model(class, optional): Model instance
23+
model (class, optional): Model instance
2324
'''
2425
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_1D_elements(), include_base)
2526

2627
@staticmethod
27-
def getAllFE2DElements(
28+
def GetAllFE2DElements(
2829
include_base: bool = False,
2930
model = Model):
3031
'''
3132
Args:
32-
model(class, optional): Model instance
33+
model (class, optional): Model instance
3334
'''
3435
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_2D_elements(), include_base)
3536

3637
@staticmethod
37-
def getAllFE3DElements(
38+
def GetAllFE3DElements(
3839
include_base: bool = False,
3940
model = Model):
4041
'''
4142
Args:
42-
model(class, optional): Model instance
43+
model (class, optional): Model instance
4344
'''
4445
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_3D_elements(), include_base)
4546

4647
@staticmethod
47-
def getFENodeOriginalMesh(
48+
def GetFENodeOriginalMesh(
4849
nodeNo: int = 1,
4950
model = Model):
51+
'''
52+
Args:
53+
nodeNo (int): Node Number
54+
model (class, optional): Model instance
55+
'''
5056

5157
return model.clientModel.service.get_FE_node_original_mesh(nodeNo)
5258

5359
@staticmethod
54-
def getFE1DElement(
60+
def GetFE1DElement(
5561
elementNo: int = 1,
5662
model = Model):
63+
'''
64+
Args:
65+
elementNo (int): Element Number
66+
model (class, optional): Model instance
67+
'''
5768

5869
return model.clientModel.service.get_FE_1D_element(elementNo)
5970

6071
@staticmethod
61-
def getFE2DElement(
72+
def GetFE2DElement(
6273
elementNo: int = 1,
6374
model = Model):
75+
'''
76+
Args:
77+
elementNo (int): Element Number
78+
model (class, optional): Model instance
79+
'''
6480

6581
return model.clientModel.service.get_FE_2D_element(elementNo)
6682

6783
@staticmethod
68-
def getFE3DElement(
84+
def GetFE3DElement(
6985
elementNo: int = 1,
7086
model = Model):
87+
'''
88+
Args:
89+
elementNo (int): Element Number
90+
model (class, optional): Model instance
91+
'''
7192

7293
return model.clientModel.service.get_FE_3D_element(elementNo)
94+
95+
@staticmethod
96+
def GetAllFENodesInitialState(
97+
loading_type = CaseObjectType.E_OBJECT_TYPE_LOAD_CASE,
98+
loading_no: int = 1,
99+
increment_number: int = 1,
100+
include_base: bool = False,
101+
model = Model):
102+
'''
103+
Args:
104+
loading_type (emun): Case Object Loading Type Enumeration
105+
loading_no (int): Loading Number
106+
increment_number (int): Increment Number
107+
model (class, optional): Model instance
108+
'''
109+
110+
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_nodes_initial_state_mesh({'case_object': {'type': loading_type.name, 'id': loading_no}, 'increment_number': increment_number}), include_base)
111+
112+
@staticmethod
113+
def GetAllFENodesDeformed(
114+
loading_type = CaseObjectType.E_OBJECT_TYPE_LOAD_CASE,
115+
loading_no: int = 1,
116+
increment_number: int = 1,
117+
include_base: bool = False,
118+
model = Model):
119+
'''
120+
Args:
121+
loading_type (emun): Case Object Loading Type Enumeration
122+
loading_no (int): Loading Number
123+
increment_number (int): Increment Number
124+
model (class, optional): Model instance
125+
'''
126+
127+
return ConvertResultsToListOfDct(model.clientModel.service.get_all_FE_nodes_deformed_mesh({'case_object': {'type': loading_type.name, 'id': loading_no}, 'increment_number': increment_number}), include_base)
128+
129+
@staticmethod
130+
def GetFENodeInitialState(
131+
nodeNo:int = 1,
132+
loading_type = CaseObjectType.E_OBJECT_TYPE_LOAD_CASE,
133+
loading_no: int = 1,
134+
increment_number: int = 1,
135+
model = Model):
136+
'''
137+
Args:
138+
nodeNo (int): Node Number
139+
loading_type (emun): Case Object Loading Type Enumeration
140+
loading_no (int): Loading Number
141+
increment_number (int): Increment Number
142+
model (class, optional): Model instance
143+
'''
144+
145+
return model.clientModel.service.get_FE_node_initial_state_mesh(nodeNo, {'case_object': {'type': loading_type.name, 'id': loading_no}, 'increment_number': increment_number})
146+
147+
@staticmethod
148+
def GetFENodeDeformed(
149+
nodeNo:int = 1,
150+
loading_type = CaseObjectType.E_OBJECT_TYPE_LOAD_CASE,
151+
loading_no: int = 1,
152+
increment_number: int = 1,
153+
model = Model):
154+
'''
155+
Args:
156+
nodeNo (int): Node Number
157+
loading_type (emun): Case Object Loading Type Enumeration
158+
loading_no (int): Loading Number
159+
increment_number (int): Increment Number
160+
model (class, optional): Model instance
161+
'''
162+
163+
return model.clientModel.service.get_FE_node_deformed_mesh(nodeNo, {'case_object': {'type': loading_type.name, 'id': loading_no}, 'increment_number': increment_number})

UnitTests/test_LineLoads_Test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from RFEM.BasicObjects.thickness import Thickness
1919
from RFEM.BasicObjects.material import Material
2020
from RFEM.initModel import Model
21-
from RFEM.enums import LineLoadDistribution, NodalLoadDirection, StaticAnalysisType
21+
from RFEM.enums import LineLoadDistribution, NodalLoadDirection, StaticAnalysisType, LineSetLoadDistribution, LineSetLoadDirection
2222
from RFEM.Loads.lineLoad import LineLoad
2323

2424
if Model.clientModel is None:
@@ -322,9 +322,11 @@ def test_line_set_loads():
322322
LineSetLoad.Force(2, 1, '1', load_parameter=2500)
323323
LineSetLoad.Mass(3, 1, '1', False, [3100])
324324
LineSetLoad.Moment(4, load_parameter=4000)
325+
LineSetLoad.Force(5, 1, '1', LineSetLoadDistribution.LOAD_DISTRIBUTION_CONCENTRATED_VARYING, LineSetLoadDirection.LOAD_DIRECTION_LOCAL_Z, [[1,1200],[3,2300]])
325326
Model.clientModel.service.finish_modification()
326327

327328
assert Model.clientModel.service.get_line_set_load(1, 1).magnitude == 1200.5
328329
assert Model.clientModel.service.get_line_set_load(2, 1).magnitude == 2500
329330
assert Model.clientModel.service.get_line_set_load(3, 1).mass_global == 3100
330331
assert Model.clientModel.service.get_line_set_load(4, 1).magnitude == 4000
332+
assert Model.clientModel.service.get_line_set_load(5, 1).load_distribution == 'LOAD_DISTRIBUTION_CONCENTRATED_VARYING'

UnitTests/test_MeshTables.py

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
)
77
sys.path.append(PROJECT_ROOT)
88

9-
from RFEM.initModel import Model
9+
from RFEM.initModel import Model, Calculate_all
10+
from RFEM.enums import *
11+
from RFEM.dataTypes import inf
1012
from RFEM.BasicObjects.material import Material
1113
from RFEM.BasicObjects.thickness import Thickness
14+
from RFEM.BasicObjects.section import Section
1215
from RFEM.BasicObjects.node import Node
1316
from RFEM.BasicObjects.line import Line
1417
from RFEM.BasicObjects.surface import Surface
15-
from RFEM.BasicObjects.section import Section
1618
from RFEM.BasicObjects.member import Member
19+
from RFEM.TypesForNodes.nodalSupport import NodalSupport
20+
from RFEM.LoadCasesAndCombinations.staticAnalysisSettings import StaticAnalysisSettings
21+
from RFEM.LoadCasesAndCombinations.loadCase import LoadCase
22+
from RFEM.LoadCasesAndCombinations.designSituation import DesignSituation
23+
from RFEM.LoadCasesAndCombinations.loadCasesAndCombinations import LoadCasesAndCombinations
24+
from RFEM.LoadCasesAndCombinations.loadCombination import LoadCombination
25+
from RFEM.Loads.nodalLoad import NodalLoad
1726
from RFEM.Results.meshTables import MeshTables
1827

1928
if Model.clientModel is None:
@@ -53,17 +62,47 @@ def test_mesh_tables():
5362
allFeNodes = MeshTables.GetAllFENodes()
5463
assert allFeNodes[4]['y'] == 20
5564

56-
customNode = MeshTables.getFENodeOriginalMesh(8)
65+
customNode = MeshTables.GetFENodeOriginalMesh(8)
5766
assert customNode['y'] == 1.5
5867

59-
all1DElements = MeshTables.getAllFE1DElements()
68+
all1DElements = MeshTables.GetAllFE1DElements()
6069
assert all1DElements[12]['FE_node1_no'] == 454
6170

62-
all2DElemets = MeshTables.getAllFE2DElements()
71+
all2DElemets = MeshTables.GetAllFE2DElements()
6372
assert all2DElemets[5]['surface_no'] == 1
6473

65-
custom1DElement = MeshTables.getFE1DElement(5)
74+
custom1DElement = MeshTables.GetFE1DElement(5)
6675
assert custom1DElement['FE_node2_no'] == 447
6776

68-
custom2DElement = MeshTables.getFE2DElement(18)
77+
custom2DElement = MeshTables.GetFE2DElement(18)
6978
assert custom2DElement['FE_node3_no'] == 37
79+
80+
def test_deformed_mesh():
81+
82+
Model.clientModel.service.delete_all()
83+
Model.clientModel.service.begin_modification()
84+
85+
Material(1)
86+
Section(1)
87+
88+
Node(1, 0.0, 0.0, 0.0)
89+
Node(2, 5, 0.0, 0.0)
90+
91+
Member(1, 1, 2, 0.0, 1, 1)
92+
93+
NodalSupport(1, '1', NodalSupportType.HINGED)
94+
NodalSupport(2, '2', [0, inf, inf, inf, 0, inf])
95+
LoadCasesAndCombinations()
96+
LoadCase.StaticAnalysis(1, 'Self-Weight',analysis_settings_no=1,action_category= ActionCategoryType.ACTION_CATEGORY_PERMANENT_G,self_weight=[True, 0.0, 0.0, 1.0])
97+
DesignSituation(1, DesignSituationType.DESIGN_SITUATION_TYPE_EQU_PERMANENT_AND_TRANSIENT, True)
98+
StaticAnalysisSettings.GeometricallyLinear(1, "Linear")
99+
LoadCombination(1, combination_items=[[1,1,0,False]])
100+
LoadCombination(2, combination_items=[[1.5,1,0,False]])
101+
NodalLoad(1, 1, '2', NodalLoadDirection.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W, 1000)
102+
Model.clientModel.service.finish_modification()
103+
104+
Calculate_all()
105+
106+
assert Model.clientModel.service.has_any_results()
107+
assert MeshTables.GetAllFENodesDeformed(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 2)
108+
assert MeshTables.GetFENodeDeformed()

0 commit comments

Comments
 (0)