Skip to content

Commit d47c2c0

Browse files
authored
Merge pull request #346 from Dlubal-Software/heet-coordinateSystemUpdate
Update coordinateSystem.py
2 parents 61a5031 + fc8d95b commit d47c2c0

File tree

4 files changed

+57
-23
lines changed

4 files changed

+57
-23
lines changed
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
class CoordinateSystem():
55
def __init__(self,
66
no: int = 1,
7-
type = CoordinateSystemType.TYPE_OFFSET_XYZ,
87
origin_coordinate_x: float = 0.0,
98
origin_coordinate_y: float = 0.0,
109
origin_coordinate_z: float = 0.0,
@@ -16,11 +15,10 @@ def __init__(self,
1615
'''
1716
Args:
1817
no (int): Coordinate System Tag
19-
type (enum): Coordinate System Type
2018
origin_coordinate_x (float): X-Coordinate
2119
origin_coordinate_y (float): Y-Coordinate
2220
origin_coordinate_z (float): Z-Coordinate
23-
name (str): Name
21+
name (str, optional): User Defined Coordinate System Name
2422
comment (str, optional): Comments
2523
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
2624
model (RFEM Class, optional): Model to be edited
@@ -35,7 +33,7 @@ def __init__(self,
3533
clientObject.no = no
3634

3735
# Coordinate System Type
38-
clientObject.type = type.name
36+
clientObject.type = CoordinateSystemType.TYPE_OFFSET_XYZ.name
3937

4038
# Coordinates
4139
clientObject.origin_coordinate_x = origin_coordinate_x
@@ -44,6 +42,7 @@ def __init__(self,
4442

4543
# Name
4644
if name:
45+
clientObject.user_defined_name_enabled = True
4746
clientObject.name = name
4847

4948
# Comment
@@ -76,7 +75,7 @@ def OffsetXYZ(no: int = 1,
7675
origin_coordinate_x (float): X-Coordinate
7776
origin_coordinate_y (float): Y-Coordinate
7877
origin_coordinate_z (float): Z-Coordinate
79-
name (str): Name
78+
name (str, optional): User Defined Coordinate System Name
8079
comment (str, optional): Comments
8180
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
8281
model (RFEM Class, optional): Model to be edited
@@ -100,6 +99,7 @@ def OffsetXYZ(no: int = 1,
10099

101100
# Name
102101
if name:
102+
clientObject.user_defined_name_enabled = True
103103
clientObject.name = name
104104

105105
# Comment
@@ -144,7 +144,7 @@ def ThreePoints(no: int = 1,
144144
uw_plane_point_coordinate_x (float): Point in +UW-Plane - 2nd Point X-Coordinate
145145
uw_plane_point_coordinate_y (float): Point in +UW-Plane - 2nd Point Y-Coordinate
146146
uw_plane_point_coordinate_z (float): Point in +UW-Plane - 2nd Point Z-Coordinate
147-
name (str): Name
147+
name (str, optional): User Defined Coordinate System Name
148148
comment (str, optional): Comments
149149
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
150150
model (RFEM Class, optional): Model to be edited
@@ -176,6 +176,7 @@ def ThreePoints(no: int = 1,
176176

177177
# Name
178178
if name:
179+
clientObject.user_defined_name_enabled = True
179180
clientObject.name = name
180181

181182
# Comment
@@ -216,7 +217,7 @@ def TwoPointsAndAngle(no: int = 1,
216217
u_axis_point_coordinate_y (float): Point on +U-Axis - 1st point Y-Coordinate
217218
u_axis_point_coordinate_z (float): Point on +U-Axis - 1st point Z-Coordinate
218219
uw_plane_angle (float): Rotation About U-Axis
219-
name (str): Name
220+
name (str, optional): Name
220221
comment (str, optional): Comments
221222
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
222223
model (RFEM Class, optional): Model to be edited
@@ -246,6 +247,7 @@ def TwoPointsAndAngle(no: int = 1,
246247

247248
# Name
248249
if name:
250+
clientObject.user_defined_name_enabled = True
249251
clientObject.name = name
250252

251253
# Comment
@@ -282,11 +284,11 @@ def PointAndThreeAngles(no: int = 1,
282284
origin_coordinate_x (float): Origin Point X-Coordinate
283285
origin_coordinate_y (float): Origin Point Y-Coordinate
284286
origin_coordinate_z (float): Origin Point Z-Coordinate
285-
rotation_angles_sequence (float): Rotation Angles Sequesce
287+
rotation_angles_sequence (enum): Coordinate System Rotation Angles Sequence Enumeration
286288
rotation_angle_1 (float): Rotation about X Axes
287289
rotation_angle_2 (float): Rotation about Y Axes
288290
rotation_angle_3 (float): Rotation about Z Axes
289-
name (str): Name
291+
name (str, optional): User Defined Coordinate System Name
290292
comment (str, optional): Comments
291293
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
292294
model (RFEM Class, optional): Model to be edited
@@ -300,7 +302,6 @@ def PointAndThreeAngles(no: int = 1,
300302
# Coordinate System No.
301303
clientObject.no = no
302304

303-
304305
# Coordinate System Type
305306
clientObject.type = CoordinateSystemType.TYPE_POINT_AND_3_ANGLES.name
306307

@@ -318,6 +319,7 @@ def PointAndThreeAngles(no: int = 1,
318319

319320
# Name
320321
if name:
322+
clientObject.user_defined_name_enabled = True
321323
clientObject.name = name
322324

323325
# Comment
@@ -339,7 +341,7 @@ def GetCoordinateSystem(object_index: int = 1, model = Model):
339341

340342
'''
341343
Args:
342-
obejct_index (int): Thickness Index
344+
obejct_index (int): Coordinate System Index
343345
model (RFEM Class, optional): Model to be edited
344346
'''
345347

RFEM/Tools/GetObjectNumbersByType.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __new__(cls,
6161
# For each of these steps individual record is made (4 total).
6262

6363
# Vector of all function
64-
func_vec = [[ObjectTypes.E_OBJECT_TYPE_COORDINATE_SYSTEM, lambda i: model.clientModel.service.get_coordinate_system(i), 'from RFEM.BasicObjects.coordinateSystem import CoordinateSystem\n', 'CoordinateSystem'],
64+
func_vec = [[ObjectTypes.E_OBJECT_TYPE_COORDINATE_SYSTEM, lambda i: model.clientModel.service.get_coordinate_system(i), 'from RFEM.GuideObjects.coordinateSystem import CoordinateSystem\n', 'CoordinateSystem'],
6565
[ObjectTypes.E_OBJECT_TYPE_MATERIAL, lambda i: model.clientModel.service.get_material(i), 'from RFEM.BasicObjects.material import Material\n', 'Material'],
6666
[ObjectTypes.E_OBJECT_TYPE_SECTION, lambda i: model.clientModel.service.get_section(i), 'from RFEM.BasicObjects.section import Section\n', 'Section'],
6767
[ObjectTypes.E_OBJECT_TYPE_THICKNESS, lambda i: model.clientModel.service.get_thickness(i), 'from RFEM.BasicObjects.thickness import Thickness\n', 'Thickness'],

UnitTests/test_basic_objects.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from RFEM.BasicObjects.memberSet import MemberSet
2121
from RFEM.BasicObjects.solid import Solid
2222
from RFEM.BasicObjects.solidSet import SolidSet
23-
from RFEM.BasicObjects.coordinateSystem import CoordinateSystem
2423
from RFEM.Calculate.meshSettings import GetModelInfo
2524

2625
if Model.clientModel is None:
@@ -788,23 +787,18 @@ def test_thickness_shape_orthotropy():
788787

789788
Model.clientModel.service.finish_modification()
790789

791-
def test_coordinate_system():
790+
def test_get_thickness():
792791

793792
Model.clientModel.service.delete_all()
794793
Model.clientModel.service.begin_modification()
795794

796795
Material(1, 'S235')
797796

798-
Node(1, 0, 0, 0)
799-
800-
CoordinateSystem()
801-
CoordinateSystem.OffsetXYZ(2)
802-
CoordinateSystem.ThreePoints(3)
803-
CoordinateSystem.TwoPointsAndAngle(4)
804-
CoordinateSystem.PointAndThreeAngles(5)
797+
Thickness(1, '20 mm', 1, 0.02)
805798

806799
Model.clientModel.service.finish_modification()
807800

808-
coord = CoordinateSystem.GetCoordinateSystem(2)
801+
thickness = Thickness.GetThickness(1)
809802

810-
assert coord.type == 'TYPE_OFFSET_XYZ'
803+
assert thickness['type'] == "TYPE_UNIFORM"
804+
assert thickness['uniform_thickness'] == 0.02
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from RFEM.BasicObjects.member import Member
1717
from RFEM.BasicObjects.surface import Surface
1818
from RFEM.GuideObjects.note import Note
19+
from RFEM.GuideObjects.coordinateSystem import CoordinateSystem
1920

2021
if Model.clientModel is None:
2122
Model()
@@ -69,3 +70,40 @@ def test_note():
6970
note5 = Model.clientModel.service.get_note(5)
7071
assert note5.surface_first_coordinate == 5
7172
assert note5.offset_coordinate_y == 2
73+
74+
def test_coordinate_system():
75+
76+
Model.clientModel.service.delete_all()
77+
Model.clientModel.service.begin_modification()
78+
79+
Material(1, 'S235')
80+
81+
Node(1, 0, 0, 0)
82+
83+
CoordinateSystem()
84+
CoordinateSystem.OffsetXYZ(2, 1, 0, 0, 'Offset')
85+
CoordinateSystem.ThreePoints(3, 2, 0, 0, 0, 1, 0, 0, 0, 3)
86+
CoordinateSystem.TwoPointsAndAngle(4, 1.5, 0, 0, 0, 0, 0, 5.5)
87+
CoordinateSystem.PointAndThreeAngles(5)
88+
89+
Model.clientModel.service.finish_modification()
90+
91+
coord2 = Model.clientModel.service.get_coordinate_system(2)
92+
93+
assert coord2.type == 'TYPE_OFFSET_XYZ'
94+
assert coord2.name == 'Offset'
95+
assert coord2.origin_coordinate_x == 1
96+
97+
coord3 = Model.clientModel.service.get_coordinate_system(3)
98+
99+
assert coord3.type == 'TYPE_3_POINTS'
100+
assert coord3.u_axis_point_coordinate_y == 1
101+
102+
coord4 = Model.clientModel.service.get_coordinate_system(4)
103+
104+
assert coord4.type == 'TYPE_2_POINTS_AND_ANGLE'
105+
assert coord4.origin_coordinate_x == 1.5
106+
107+
coord5 = Model.clientModel.service.get_coordinate_system(5)
108+
109+
assert coord5.type == 'TYPE_POINT_AND_3_ANGLES'

0 commit comments

Comments
 (0)