From 9a35556101994126c9dc3cf1f3da51f9e0bc4040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Fri, 15 Oct 2021 09:56:57 +0200 Subject: [PATCH 1/7] First Commit (WIP) --- .../CentreOfGravityAndObjectInfo.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py diff --git a/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py b/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py new file mode 100644 index 00000000..04a6f174 --- /dev/null +++ b/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py @@ -0,0 +1,30 @@ +import sys +sys.path.append(".") + +from RFEM.enums import * +from RFEM.dataTypes import * +from RFEM.initModel import * + +print(clientModel.service.get_center_of_gravity_and_objects_info()) + +# class CentreOfGravityAndObjectInformation(): + +# def Member(self, +# ElmNum: int = 1, +# ParentNo: int = 0): + + +# type = ObjectTypes.E_OBJECT_TYPE_MEMBER.name +# centerOfGravityAndObjectInformation = clientModel.service.get_center_of_gravity_and_objects_info(type, ElmNum, ParentNo) +# print(centerOfGravityAndObjectInformation) + + # if centerOfGravityAndObjectInformation != None: + # for i in range(0, len(centerOfGravityAndObjectInformation.row)): + # for j in range(0, len(centerOfGravityAndObjectInformation.row[i].section)): + + # if hasattr(centerOfGravityAndObjectInformation.row[i].section[j], 'top_text'): + # print(centerOfGravityAndObjectInformation.row[i].section[j].top_text) + + # for k in range(0, len(centerOfGravityAndObjectInformation.row[i].section[j].elements[0])): + # print(centerOfGravityAndObjectInformation.row[i].section[j].elements[0][k].column_name + + # " " + centerOfGravityAndObjectInformation.row[i].section[j].elements[0][k].value) \ No newline at end of file From a027e4380d430fd034c130acb83ee1f48bb60271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Fri, 5 Nov 2021 11:58:58 +0100 Subject: [PATCH 2/7] Class and Functions Created and Tested --- .../CentreOfGravityAndObjectInfo.py | 30 ------ Examples/ObjectInformation_Test.py | 86 +++++++++++++++++ RFEM/Tools/centreOfGravityAndObjectInfo.py | 95 +++++++++++++++++++ RFEM/enums.py | 6 ++ 4 files changed, 187 insertions(+), 30 deletions(-) delete mode 100644 Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py create mode 100644 Examples/ObjectInformation_Test.py create mode 100644 RFEM/Tools/centreOfGravityAndObjectInfo.py diff --git a/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py b/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py deleted file mode 100644 index 04a6f174..00000000 --- a/Examples/GetRFEMData/CentreOfGravityAndObjectInfo.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -sys.path.append(".") - -from RFEM.enums import * -from RFEM.dataTypes import * -from RFEM.initModel import * - -print(clientModel.service.get_center_of_gravity_and_objects_info()) - -# class CentreOfGravityAndObjectInformation(): - -# def Member(self, -# ElmNum: int = 1, -# ParentNo: int = 0): - - -# type = ObjectTypes.E_OBJECT_TYPE_MEMBER.name -# centerOfGravityAndObjectInformation = clientModel.service.get_center_of_gravity_and_objects_info(type, ElmNum, ParentNo) -# print(centerOfGravityAndObjectInformation) - - # if centerOfGravityAndObjectInformation != None: - # for i in range(0, len(centerOfGravityAndObjectInformation.row)): - # for j in range(0, len(centerOfGravityAndObjectInformation.row[i].section)): - - # if hasattr(centerOfGravityAndObjectInformation.row[i].section[j], 'top_text'): - # print(centerOfGravityAndObjectInformation.row[i].section[j].top_text) - - # for k in range(0, len(centerOfGravityAndObjectInformation.row[i].section[j].elements[0])): - # print(centerOfGravityAndObjectInformation.row[i].section[j].elements[0][k].column_name + - # " " + centerOfGravityAndObjectInformation.row[i].section[j].elements[0][k].value) \ No newline at end of file diff --git a/Examples/ObjectInformation_Test.py b/Examples/ObjectInformation_Test.py new file mode 100644 index 00000000..e6e1652b --- /dev/null +++ b/Examples/ObjectInformation_Test.py @@ -0,0 +1,86 @@ +import sys +sys.path.append(".") + +# Import the relevant Libraries +from os import name +from RFEM.enums import * +from RFEM.dataTypes import * +from RFEM.initModel import * +from RFEM.BasicObjects.material import * +from RFEM.BasicObjects.section import * +from RFEM.BasicObjects.thickness import * +from RFEM.BasicObjects.node import * +from RFEM.BasicObjects.line import * +from RFEM.BasicObjects.member import * +from RFEM.BasicObjects.surface import * +from RFEM.BasicObjects.solid import * +from RFEM.Tools.centreOfGravityAndObjectInfo import * + +def test_centre_of_gravity(): + + clientModel.service.begin_modification('new') + + x1, y1, z1, = 0, 0, 0 + x2, y2, z2 = 4, 10, -6 + Node(1, x1, y1, z1), Node(2, x2, y2, z2) + Material(1, 'S235') + Section() + Member(1, start_node_no= 1, end_node_no= 2) + + clientModel.service.finish_modification() + + CoG_X = (x2 - x1) / 2 + CoG_Y = (y2 - y1) / 2 + CoG_Z = (z2 - z1) / 2 + L = round(sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2),3) + + assert CoG_X == ObjectInformation.CentreOfGravity(ObjectInformation, coord= 'X') + assert CoG_Y == ObjectInformation.CentreOfGravity(ObjectInformation, coord= 'Y') + assert CoG_Z == ObjectInformation.CentreOfGravity(ObjectInformation, coord= 'Z') + +def test_member_information(): + + clientModel.service.begin_modification('new') + + x1, y1, z1, = 0, 0, 0 + x2, y2, z2 = 4, 10, -6 + Node(1, x1, y1, z1), Node(2, x2, y2, z2) + Material(1, 'S235') + Section() + Member(1, start_node_no= 1, end_node_no= 2) + + clientModel.service.finish_modification() + + L = sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) + A = 53.80 / (100 * 100) + V = L * A + M = (V * 7850) / 1000 + + assert round(L,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.LENGTH) + assert round(V,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.VOLUME) + assert round(M,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.MASS) + +def test_surface_information(): + + clientModel.service.begin_modification('new') + + x1, y1, z1 = 0 , 0, 0 + x2, y2, z2 = 10, 0, 0 + x3, y3, z3 = 10, 15, 0 + x4, y4, z4 = 0, 15, 0 + + Node(1, x1, y1, z1), Node(2, x2, y2, z2), Node(3, x3, y3, z3), Node(4, x4, y4, z4) + Line(1, '1 2'), Line(2, '2 3'), Line(3, '3 4'), Line(4, '4 1') + Material(2, name='C30/37') + Thickness(material_no= 2) + Surface() + + clientModel.service.finish_modification() + + A = (x2 - x1) * (y4 - y1) + V = A * 0.2 + M = (V * 2500) / 1000 + + assert round(A,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.AREA) + assert round(V,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.VOLUME) + assert round(M,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.MASS) \ No newline at end of file diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py new file mode 100644 index 00000000..09d53940 --- /dev/null +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -0,0 +1,95 @@ +from RFEM.initModel import * +from RFEM.enums import * + +class ObjectInformation(): + + def CentreOfGravity(self, + object_type = ObjectTypes.E_OBJECT_TYPE_MEMBER, + no: int = 1, + parent_no = 0, + coord: str = 'X'): + + self.object_type = object_type + self.no = no + self.parent_no = parent_no + + result = ObjectInformation.__BuildResultsArray(self) + + if coord == 'X' or coord.lstrip().rstrip().upper() == 'X': + return result['section'][0].rows[0][0].value + elif coord == 'Y' or coord.lstrip().rstrip().upper() == 'Y': + return result['section'][0].rows[0][1].value + elif coord == 'Z' or coord.lstrip().rstrip().upper() == 'Z': + return result['section'][0].rows[0][2].value + else: + raise Exception ('WARNING: The desired Coordinate input not requested. Please provide either "X", "Y" or "Z"') + + def MemberInformation(self, + no: int = 1, + information = SelectedObjectsInformation.LENGTH): + + if information.name == 'AREA': + raise Exception ('WARNING: Area information is only relevant for Surface and Volume Information.') + + self.object_type = ObjectTypes.E_OBJECT_TYPE_MEMBER + self.no = no + self.parent_no = 0 + self.information = information + self.row_key = 2 + self.result = ObjectInformation.__BuildResultsArray(self) + + return ObjectInformation.__AreaVolumeMassInformation(self) + + def SurfaceInformation(self, + no: int = 1, + information = SelectedObjectsInformation.AREA): + + if information.name == 'LENGTH': + raise Exception ('WARNING: Length information is only relevant for Member Information.') + + self.object_type = ObjectTypes.E_OBJECT_TYPE_SURFACE + self.no = no + self.parent_no = 0 + self.information = information + self.row_key = 3 + self.result = ObjectInformation.__BuildResultsArray(self) + + return ObjectInformation.__AreaVolumeMassInformation(self) + + def SolidInformation(self, + no: int = 1, + information = SelectedObjectsInformation.AREA): + + if information.name == 'LENGTH': + raise Exception ('WARNING: Length information is only relevant for Member Information.') + + self.object_type = ObjectTypes.E_OBJECT_TYPE_SOLID + self.no = no + self.parent_no = 0 + self.information = information + self.row_key = 4 + self.result = ObjectInformation.__BuildResultsArray(self) + + return ObjectInformation.__AreaVolumeMassInformation(self) + + def __BuildResultsArray(self): + + elements = clientModel.factory.create('ns0:array_of_get_center_of_gravity_and_objects_info_elements_type') + clientObject = clientModel.factory.create('ns0:get_center_of_gravity_and_objects_info_element_type') + clientObject.parent_no = self.parent_no + clientObject.no = self.no + clientObject.type = self.object_type.name + elements.element.append(clientObject) + result = clientModel.service.get_center_of_gravity_and_objects_info(elements) + result = clientModel.dict(result) + + return result + + def __AreaVolumeMassInformation(self): + + if self.information.name == "LENGTH" or self.information.name == "AREA": + return self.result['section'][self.row_key].rows[0][0].value + elif self.information.name == "VOLUME": + return self.result['section'][self.row_key].rows[0][1].value + elif self.information.name == "MASS": + return self.result['section'][self.row_key].rows[0][2].value \ No newline at end of file diff --git a/RFEM/enums.py b/RFEM/enums.py index c45201ad..7ffa9c89 100644 --- a/RFEM/enums.py +++ b/RFEM/enums.py @@ -669,3 +669,9 @@ class export_to_ifc_axis_type(Enum): class export_to_ifc_export_type(Enum): E_EXPORT_IFC4_REFERENCE_VIEW, E_EXPORT_IFC4_STRUCTURAL_ANALYSIS_VIEW = range(2) + +class SelectedObjectsInformation(Enum): + ''' + Information About Members | Enum + ''' + LENGTH, VOLUME, MASS, AREA = range(4) \ No newline at end of file From 174f4c1265eaf8444cb3441973b303a1ce61369c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Fri, 5 Nov 2021 12:02:34 +0100 Subject: [PATCH 3/7] Function Name Edited AreaVolumeMassInformation(self) not encompassing all the paramters. Changed to AreaVolumeMassLength(self). Even though this is a hidden function "__AreaVol...." --- RFEM/Tools/centreOfGravityAndObjectInfo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py index 09d53940..cc42c7d9 100644 --- a/RFEM/Tools/centreOfGravityAndObjectInfo.py +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -38,7 +38,7 @@ def MemberInformation(self, self.row_key = 2 self.result = ObjectInformation.__BuildResultsArray(self) - return ObjectInformation.__AreaVolumeMassInformation(self) + return ObjectInformation.__AreaVolumeMassInformationLength(self) def SurfaceInformation(self, no: int = 1, @@ -54,7 +54,7 @@ def SurfaceInformation(self, self.row_key = 3 self.result = ObjectInformation.__BuildResultsArray(self) - return ObjectInformation.__AreaVolumeMassInformation(self) + return ObjectInformation.__AreaVolumeMassInformationLength(self) def SolidInformation(self, no: int = 1, @@ -70,7 +70,7 @@ def SolidInformation(self, self.row_key = 4 self.result = ObjectInformation.__BuildResultsArray(self) - return ObjectInformation.__AreaVolumeMassInformation(self) + return ObjectInformation.__AreaVolumeMassInformationLength(self) def __BuildResultsArray(self): @@ -85,7 +85,7 @@ def __BuildResultsArray(self): return result - def __AreaVolumeMassInformation(self): + def __AreaVolumeMassInformationLength(self): if self.information.name == "LENGTH" or self.information.name == "AREA": return self.result['section'][self.row_key].rows[0][0].value From 85dd069d5845c5676d9c40c2e3bb6739a6898603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Fri, 5 Nov 2021 12:10:20 +0100 Subject: [PATCH 4/7] Test Script Moved to Relevant Folder Test script moved from example to the more appropriate folder, unit tests SelectedObjects misleading as it is currently limited to single object information returns. Therefore renaimed to SelectedObject (singular) --- RFEM/Tools/centreOfGravityAndObjectInfo.py | 6 +++--- RFEM/enums.py | 2 +- .../test_objectInformation.py | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) rename Examples/ObjectInformation_Test.py => UnitTests/test_objectInformation.py (87%) diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py index cc42c7d9..2aabafce 100644 --- a/RFEM/Tools/centreOfGravityAndObjectInfo.py +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -26,7 +26,7 @@ def CentreOfGravity(self, def MemberInformation(self, no: int = 1, - information = SelectedObjectsInformation.LENGTH): + information = SelectedObjectInformation.LENGTH): if information.name == 'AREA': raise Exception ('WARNING: Area information is only relevant for Surface and Volume Information.') @@ -42,7 +42,7 @@ def MemberInformation(self, def SurfaceInformation(self, no: int = 1, - information = SelectedObjectsInformation.AREA): + information = SelectedObjectInformation.AREA): if information.name == 'LENGTH': raise Exception ('WARNING: Length information is only relevant for Member Information.') @@ -58,7 +58,7 @@ def SurfaceInformation(self, def SolidInformation(self, no: int = 1, - information = SelectedObjectsInformation.AREA): + information = SelectedObjectInformation.AREA): if information.name == 'LENGTH': raise Exception ('WARNING: Length information is only relevant for Member Information.') diff --git a/RFEM/enums.py b/RFEM/enums.py index 7ffa9c89..3c327675 100644 --- a/RFEM/enums.py +++ b/RFEM/enums.py @@ -670,7 +670,7 @@ class export_to_ifc_export_type(Enum): E_EXPORT_IFC4_REFERENCE_VIEW, E_EXPORT_IFC4_STRUCTURAL_ANALYSIS_VIEW = range(2) -class SelectedObjectsInformation(Enum): +class SelectedObjectInformation(Enum): ''' Information About Members | Enum ''' diff --git a/Examples/ObjectInformation_Test.py b/UnitTests/test_objectInformation.py similarity index 87% rename from Examples/ObjectInformation_Test.py rename to UnitTests/test_objectInformation.py index e6e1652b..8a07c2de 100644 --- a/Examples/ObjectInformation_Test.py +++ b/UnitTests/test_objectInformation.py @@ -56,9 +56,9 @@ def test_member_information(): V = L * A M = (V * 7850) / 1000 - assert round(L,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.LENGTH) - assert round(V,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.VOLUME) - assert round(M,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectsInformation.MASS) + assert round(L,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectInformation.LENGTH) + assert round(V,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectInformation.VOLUME) + assert round(M,3) == ObjectInformation.MemberInformation(ObjectInformation, information= SelectedObjectInformation.MASS) def test_surface_information(): @@ -81,6 +81,6 @@ def test_surface_information(): V = A * 0.2 M = (V * 2500) / 1000 - assert round(A,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.AREA) - assert round(V,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.VOLUME) - assert round(M,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectsInformation.MASS) \ No newline at end of file + assert round(A,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectInformation.AREA) + assert round(V,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectInformation.VOLUME) + assert round(M,3) == ObjectInformation.SurfaceInformation(ObjectInformation, information= SelectedObjectInformation.MASS) \ No newline at end of file From 4831c366baa073f59fdf03c634e95ae86fc1ee31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Fri, 5 Nov 2021 12:50:40 +0100 Subject: [PATCH 5/7] DocStrings Added --- RFEM/Tools/centreOfGravityAndObjectInfo.py | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py index 2aabafce..385e6a36 100644 --- a/RFEM/Tools/centreOfGravityAndObjectInfo.py +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -4,12 +4,25 @@ class ObjectInformation(): def CentreOfGravity(self, - object_type = ObjectTypes.E_OBJECT_TYPE_MEMBER, - no: int = 1, + type = ObjectTypes.E_OBJECT_TYPE_MEMBER, parent_no = 0, + no: int = 1, coord: str = 'X'): - self.object_type = object_type + ''' + This function returns the centre of gravity position (X, Y or Z) for a selected object. + + Args: + type (enum): Object Type + parent_no (int): Object Parent Number + Note: + (1) A geometric object has, in general, a parent_no = 0 + (2) The parent_no parameter becomes significant for example with loads + no (int): The Object Tag + coord (str): Desired global basis vector component of the Centre of Gravity (i.e. X, Y or Z) + ''' + + self.object_type = type self.no = no self.parent_no = parent_no @@ -27,6 +40,14 @@ def CentreOfGravity(self, def MemberInformation(self, no: int = 1, information = SelectedObjectInformation.LENGTH): + + ''' + This function returns further information associated with a member. + + Args: + no (int): Member Tag + information (enum): Desired Information (Length / Volume / Mass) + ''' if information.name == 'AREA': raise Exception ('WARNING: Area information is only relevant for Surface and Volume Information.') @@ -44,6 +65,14 @@ def SurfaceInformation(self, no: int = 1, information = SelectedObjectInformation.AREA): + ''' + This function returns further information associated with a surface. + + Args: + no (int): Surface Tag + information (enum): Desired Information (Area / Volume / Mass) + ''' + if information.name == 'LENGTH': raise Exception ('WARNING: Length information is only relevant for Member Information.') @@ -60,6 +89,14 @@ def SolidInformation(self, no: int = 1, information = SelectedObjectInformation.AREA): + ''' + This function returns further information associated with a solid. + + Args: + no (int): Solid Tag + information (enum): Desired Information (Area / Volume / Mass) + ''' + if information.name == 'LENGTH': raise Exception ('WARNING: Length information is only relevant for Member Information.') From 39424b1207cd8d3cc22354c37f86f4fb4ed6a8c9 Mon Sep 17 00:00:00 2001 From: Jaroslav Broz Date: Mon, 8 Nov 2021 10:05:01 +0100 Subject: [PATCH 6/7] White space trailing --- RFEM/Tools/centreOfGravityAndObjectInfo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py index 385e6a36..4340f860 100644 --- a/RFEM/Tools/centreOfGravityAndObjectInfo.py +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -25,7 +25,7 @@ def CentreOfGravity(self, self.object_type = type self.no = no self.parent_no = parent_no - + result = ObjectInformation.__BuildResultsArray(self) if coord == 'X' or coord.lstrip().rstrip().upper() == 'X': @@ -40,7 +40,7 @@ def CentreOfGravity(self, def MemberInformation(self, no: int = 1, information = SelectedObjectInformation.LENGTH): - + ''' This function returns further information associated with a member. @@ -51,7 +51,7 @@ def MemberInformation(self, if information.name == 'AREA': raise Exception ('WARNING: Area information is only relevant for Surface and Volume Information.') - + self.object_type = ObjectTypes.E_OBJECT_TYPE_MEMBER self.no = no self.parent_no = 0 @@ -80,7 +80,7 @@ def SurfaceInformation(self, self.no = no self.parent_no = 0 self.information = information - self.row_key = 3 + self.row_key = 3 self.result = ObjectInformation.__BuildResultsArray(self) return ObjectInformation.__AreaVolumeMassInformationLength(self) @@ -110,7 +110,7 @@ def SolidInformation(self, return ObjectInformation.__AreaVolumeMassInformationLength(self) def __BuildResultsArray(self): - + elements = clientModel.factory.create('ns0:array_of_get_center_of_gravity_and_objects_info_elements_type') clientObject = clientModel.factory.create('ns0:get_center_of_gravity_and_objects_info_element_type') clientObject.parent_no = self.parent_no @@ -119,9 +119,9 @@ def __BuildResultsArray(self): elements.element.append(clientObject) result = clientModel.service.get_center_of_gravity_and_objects_info(elements) result = clientModel.dict(result) - + return result - + def __AreaVolumeMassInformationLength(self): if self.information.name == "LENGTH" or self.information.name == "AREA": From ab193097f82ccc3134feaab1e2d49ea7ea127f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Mon, 8 Nov 2021 12:29:05 +0100 Subject: [PATCH 7/7] Regex Code Check --- RFEM/Tools/centreOfGravityAndObjectInfo.py | 14 +++++++------- UnitTests/test_objectInformation.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RFEM/Tools/centreOfGravityAndObjectInfo.py b/RFEM/Tools/centreOfGravityAndObjectInfo.py index 385e6a36..4340f860 100644 --- a/RFEM/Tools/centreOfGravityAndObjectInfo.py +++ b/RFEM/Tools/centreOfGravityAndObjectInfo.py @@ -25,7 +25,7 @@ def CentreOfGravity(self, self.object_type = type self.no = no self.parent_no = parent_no - + result = ObjectInformation.__BuildResultsArray(self) if coord == 'X' or coord.lstrip().rstrip().upper() == 'X': @@ -40,7 +40,7 @@ def CentreOfGravity(self, def MemberInformation(self, no: int = 1, information = SelectedObjectInformation.LENGTH): - + ''' This function returns further information associated with a member. @@ -51,7 +51,7 @@ def MemberInformation(self, if information.name == 'AREA': raise Exception ('WARNING: Area information is only relevant for Surface and Volume Information.') - + self.object_type = ObjectTypes.E_OBJECT_TYPE_MEMBER self.no = no self.parent_no = 0 @@ -80,7 +80,7 @@ def SurfaceInformation(self, self.no = no self.parent_no = 0 self.information = information - self.row_key = 3 + self.row_key = 3 self.result = ObjectInformation.__BuildResultsArray(self) return ObjectInformation.__AreaVolumeMassInformationLength(self) @@ -110,7 +110,7 @@ def SolidInformation(self, return ObjectInformation.__AreaVolumeMassInformationLength(self) def __BuildResultsArray(self): - + elements = clientModel.factory.create('ns0:array_of_get_center_of_gravity_and_objects_info_elements_type') clientObject = clientModel.factory.create('ns0:get_center_of_gravity_and_objects_info_element_type') clientObject.parent_no = self.parent_no @@ -119,9 +119,9 @@ def __BuildResultsArray(self): elements.element.append(clientObject) result = clientModel.service.get_center_of_gravity_and_objects_info(elements) result = clientModel.dict(result) - + return result - + def __AreaVolumeMassInformationLength(self): if self.information.name == "LENGTH" or self.information.name == "AREA": diff --git a/UnitTests/test_objectInformation.py b/UnitTests/test_objectInformation.py index 8a07c2de..74ce3e0d 100644 --- a/UnitTests/test_objectInformation.py +++ b/UnitTests/test_objectInformation.py @@ -39,7 +39,7 @@ def test_centre_of_gravity(): assert CoG_Z == ObjectInformation.CentreOfGravity(ObjectInformation, coord= 'Z') def test_member_information(): - + clientModel.service.begin_modification('new') x1, y1, z1, = 0, 0, 0