Skip to content

Commit 10687cd

Browse files
Create test_designSupport.py
1 parent e7221d4 commit 10687cd

1 file changed

Lines changed: 167 additions & 0 deletions

File tree

UnitTests/test_designSupport.py

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
import sys
2+
import os
3+
PROJECT_ROOT = os.path.abspath(os.path.join(
4+
os.path.dirname(__file__),
5+
os.pardir)
6+
)
7+
sys.path.append(PROJECT_ROOT)
8+
from RFEM.enums import *
9+
from RFEM.initModel import Model, SetAddonStatus
10+
from RFEM.BasicObjects.material import Material
11+
from RFEM.BasicObjects.section import Section
12+
from RFEM.BasicObjects.node import Node
13+
from RFEM.BasicObjects.member import Member
14+
from RFEM.BasicObjects.memberSet import MemberSet
15+
from RFEM.TypesForMembers.designSupport import DesignSupport
16+
17+
if Model.clientModel is None:
18+
Model()
19+
20+
def test_DesignSituation():
21+
22+
Model.clientModel.service.delete_all()
23+
24+
SetAddonStatus(Model.clientModel, AddOn.steel_design_active)
25+
Model.clientModel.service.begin_modification()
26+
27+
Material(1, 'S235')
28+
29+
Section(1, 'IPE 200')
30+
31+
Node(1, 0.0, 0.0, 0.0)
32+
Node(2, 10, 0.0, 0.0)
33+
Node(3, 0.0, 0.0, -10.0)
34+
Node(4, 10, 0.0, -10.0)
35+
36+
Member(1, 1, 3)
37+
Member(2, 3, 4)
38+
Member(3, 2, 4)
39+
40+
MemberSet(1, '1 2')
41+
MemberSet(2, '2 3')
42+
43+
DesignSupport(1, '1', None, '1 3', [True, True, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_POSITIVE, 0.3], \
44+
[True, False, DesignSupportOrientationYType.DESIGN_SUPPORT_ORIENTATION_YAXIS_NEGATIVE, 0.124, 1.014], 'General1')
45+
46+
DesignSupport(2, None, '1', '4', False, [True, False, DesignSupportOrientationYType.DESIGN_SUPPORT_ORIENTATION_YAXIS_POSITIVE, 0.246, 0.437], 'General2')
47+
48+
Model.clientModel.service.finish_modification()
49+
50+
ds1 = Model.clientModel.service.get_design_support(1)
51+
ds2 = Model.clientModel.service.get_design_support(2)
52+
53+
assert ds1.support_width_z == 0.3
54+
assert ds1.name == 'General1'
55+
assert ds2.activate_in_z == False
56+
assert ds2.assigned_to_nodes == '4'
57+
58+
def test_DesignSituation_Concrete():
59+
60+
Model.clientModel.service.delete_all()
61+
62+
SetAddonStatus(Model.clientModel, AddOn.concrete_design_active)
63+
Model.clientModel.service.begin_modification()
64+
65+
Material(1, 'C8/10')
66+
67+
Section(1, 'R_M1 0.5/1')
68+
69+
Node(1, 0.0, 0.0, 0.0)
70+
Node(2, 10, 0.0, 0.0)
71+
Node(3, 0.0, 0.0, -10.0)
72+
Node(4, 10, 0.0, -10.0)
73+
74+
Member(1, 1, 3)
75+
Member(2, 3, 4)
76+
Member(3, 2, 4)
77+
78+
MemberSet(1, '1 2')
79+
MemberSet(2, '2 3')
80+
81+
DesignSupport.Concrete(1, '3', None, '4', [True, True, True, True, 1.0, 0.1, 0.2], True,'Concre1')
82+
DesignSupport.Concrete(2, None, '2', '2', [True, True, True, False, False, 0.213], False, 'Concre2')
83+
84+
Model.clientModel.service.finish_modification()
85+
86+
ds1 = Model.clientModel.service.get_design_support(1)
87+
ds2 = Model.clientModel.service.get_design_support(2)
88+
89+
assert ds1.support_width_z == 0.1
90+
assert ds1.name == 'Concre1'
91+
assert ds2.activate_in_y == False
92+
assert ds2.assigned_to_nodes == '2'
93+
94+
def test_DesignSituation_Steel():
95+
96+
Model.clientModel.service.delete_all()
97+
98+
SetAddonStatus(Model.clientModel, AddOn.steel_design_active)
99+
Model.clientModel.service.begin_modification()
100+
101+
Material(1, 'S235')
102+
103+
Section(1, 'IPE 200')
104+
105+
Node(1, 0.0, 0.0, 0.0)
106+
Node(2, 10, 0.0, 0.0)
107+
Node(3, 0.0, 0.0, -10.0)
108+
Node(4, 10, 0.0, -10.0)
109+
110+
Member(1, 1, 3)
111+
Member(2, 3, 4)
112+
Member(3, 2, 4)
113+
114+
MemberSet(1, '1 2')
115+
MemberSet(2, '2 3')
116+
117+
DesignSupport.Steel(1, '3', None, '2', [True, True, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_NEGATIVE, False, 0.25], True, 'Steel1')
118+
119+
DesignSupport.Steel(2, None, '1', '4', [True, False, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_POSITIVE, 0.014, 0.246, 0.437], False, 'Steel2')
120+
121+
Model.clientModel.service.finish_modification()
122+
123+
ds1 = Model.clientModel.service.get_design_support(1)
124+
ds2 = Model.clientModel.service.get_design_support(2)
125+
126+
assert ds1.support_width_z == 0.25
127+
assert ds1.name == 'Steel1'
128+
assert ds2.activate_in_z == True
129+
assert ds2.assigned_to_nodes == '4'
130+
131+
def test_DesignSituation_Timber():
132+
133+
Model.clientModel.service.delete_all()
134+
135+
SetAddonStatus(Model.clientModel, AddOn.timber_design_active)
136+
Model.clientModel.service.begin_modification()
137+
138+
Material(1, 'GL32c')
139+
140+
Section(1, 'Batten 50/100')
141+
142+
Node(1, 0.0, 0.0, 0.0)
143+
Node(2, 10, 0.0, 0.0)
144+
Node(3, 0.0, 0.0, -10.0)
145+
Node(4, 10, 0.0, -10.0)
146+
147+
Member(1, 1, 3)
148+
Member(2, 3, 4)
149+
Member(3, 2, 4)
150+
151+
MemberSet(1, '1 2')
152+
MemberSet(2, '2 3')
153+
154+
DesignSupport.Timber(1, '3', None, '2', [True, True, True, False, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_BOTH, True, 1.0, 0.32, 0.42], \
155+
[True, True, True, True, DesignSupportOrientationYType.DESIGN_SUPPORT_ORIENTATION_YAXIS_NEGATIVE, False, 1.45, 0.26], 'Timber1')
156+
157+
DesignSupport.Timber(2, None, '1', '4', [True, False, True, True, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_NEGATIVE], False, 'Timber2')
158+
159+
Model.clientModel.service.finish_modification()
160+
161+
ds1 = Model.clientModel.service.get_design_support(1)
162+
ds2 = Model.clientModel.service.get_design_support(2)
163+
164+
assert ds1.support_width_z == 0.32
165+
assert ds1.name == 'Timber1'
166+
assert ds2.activate_in_y == False
167+
assert ds2.assigned_to_nodes == '4'

0 commit comments

Comments
 (0)