From b5b77420610733fe93891551b17ff94e79a9eafe Mon Sep 17 00:00:00 2001 From: KaratasD Date: Tue, 19 Oct 2021 08:37:15 +0200 Subject: [PATCH 1/3] mesh_commands_added --- Examples/MeshGenerationStatistics_test.py | 59 +++++++++++++++++++++++ Examples/SurfaceLoad_test.py | 8 +-- RFEM/initModel.py | 14 +++++- 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 Examples/MeshGenerationStatistics_test.py diff --git a/Examples/MeshGenerationStatistics_test.py b/Examples/MeshGenerationStatistics_test.py new file mode 100644 index 00000000..fcd1a972 --- /dev/null +++ b/Examples/MeshGenerationStatistics_test.py @@ -0,0 +1,59 @@ +import sys +sys.path.append(".") +from RFEM.Loads.surfaceLoad import * +from RFEM.Loads.memberLoad import * +from RFEM.Loads.nodalLoad import * +from RFEM.LoadCasesAndCombinations.loadCase import * +from RFEM.LoadCasesAndCombinations.staticAnalysisSettings import * +from RFEM.TypesForMembers.memberHinge import * +from RFEM.TypesForNodes.nodalSupport import * +from RFEM.BasicObjects.solidSet import * +from RFEM.BasicObjects.surfaceSet import * +from RFEM.BasicObjects.memberSet import * +from RFEM.BasicObjects.lineSet import * +from RFEM.BasicObjects.opening import * +from RFEM.BasicObjects.solid import * +from RFEM.BasicObjects.surface import * +from RFEM.BasicObjects.member import * +from RFEM.BasicObjects.line import * +from RFEM.BasicObjects.node import * +from RFEM.BasicObjects.thickness import * +from RFEM.BasicObjects.section import * +from RFEM.BasicObjects.material import * +from RFEM.initModel import * +from RFEM.dataTypes import * +from RFEM.enums import * + +if __name__ == '__main__': + # modal analysis not yet implemmented in released RFEM6 + clientModel.service.begin_modification() + + # Create Material + Material(1, 'S235') + Thickness(1, '20 mm', 1, 0.02) + + Node(1, 0, 0, 0) + Node(2, 5, 0, 0) + Node(3, 0, 5, 0) + Node(4, 5, 5, 0) + + Line(1, '1 2') + Line(2, '2 4') + Line(3, '4 3') + Line(4, '3 1') + + Surface(1, '1 2 3 4', 1) + + NodalSupport(1, '1 2 3 4', NodalSupportType.FIXED) + + GenerateMesh() + + print('Ready!') + + clientModel.service.finish_modification() + + mesh_stats = GetMeshStatics() + + print(mesh_stats) + + diff --git a/Examples/SurfaceLoad_test.py b/Examples/SurfaceLoad_test.py index 12145fbc..87e82efd 100644 --- a/Examples/SurfaceLoad_test.py +++ b/Examples/SurfaceLoad_test.py @@ -77,8 +77,8 @@ ## Force Type Surface Load with RADIAL Load Distribution ## - SurfaceLoad.Force(0, 5, 1, '1', SurfaceLoadDirection.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W_TRUE, SurfaceLoadDistribution.LOAD_DISTRIBUTION_RADIAL, - (5000, 6000, 3, 4, SurfaceLoadAxisDefinitionType.AXIS_DEFINITION_TWO_POINTS, [1,2,3], [4,5,6])) + #SurfaceLoad.Force(0, 5, 1, '1', SurfaceLoadDirection.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W_TRUE, SurfaceLoadDistribution.LOAD_DISTRIBUTION_RADIAL, + #(5000, 6000, 3, 4, SurfaceLoadAxisDefinitionType.AXIS_DEFINITION_TWO_POINTS, [1,2,3], [4,5,6])) ## Temperature Type Surface Load with UNIFORM Load Distribution ## SurfaceLoad.Temperature(0, 6, 1, '1', SurfaceLoadDistribution.LOAD_DISTRIBUTION_UNIFORM, load_parameter=[18, 2]) @@ -102,10 +102,10 @@ SurfaceLoad.Precamber(0, 12, 1, '1', 50) ## Rotary Motion Surface Load ## - SurfaceLoad.RotaryMotion(0, 13, 1, '1', load_parameter=[1, 2, SurfaceLoadAxisDefinitionType.AXIS_DEFINITION_TWO_POINTS, [1,2,3], [4,5,6]]) + #SurfaceLoad.RotaryMotion(0, 13, 1, '1', load_parameter=[1, 2, SurfaceLoadAxisDefinitionType.AXIS_DEFINITION_TWO_POINTS, [1,2,3], [4,5,6]]) ## Mass Type Surface Load ## - SurfaceLoad.Mass(0, 14, 1, '1', individual_mass_components=True, mass_parameter=[500, 600, 700]) + #SurfaceLoad.Mass(0, 14, 1, '1', individual_mass_components=True, mass_parameter=[500, 600, 700]) Calculate_all() diff --git a/RFEM/initModel.py b/RFEM/initModel.py index f1829628..30401da2 100644 --- a/RFEM/initModel.py +++ b/RFEM/initModel.py @@ -258,7 +258,6 @@ def CalculateSelectedCases(loadCases: list = None, designSituations: list = None specificObjectsToCalculateLC.parent_no = 0 specificObjectsToCalculateLC.type = ObjectTypes.E_OBJECT_TYPE_LOAD_CASE.name specificObjectsToCalculate.element.append(specificObjectsToCalculateLC) - clientModel.service.calculate_specific_objects(specificObjectsToCalculate) @@ -297,4 +296,15 @@ def ParseCSVResultsFromSelectedFileToDict(filePath: str): def ParseXMLResultsFromSelectedFileToDict(filePath: str): - return __parseXMLAsDictionary(filePath) \ No newline at end of file + return __parseXMLAsDictionary(filePath) + +def GenerateMesh(generateXmlSolverInput: bool = False): + + clientModel.service.calculate_all(generateXmlSolverInput) + +def GetMeshStatics(): + + mesh_stats = clientModel.service.get_mesh_statistics() + + return mesh_stats + From 4b9f3095d3fbf496177dab88f27be1ddeba16537 Mon Sep 17 00:00:00 2001 From: KaratasD Date: Fri, 22 Oct 2021 13:34:08 +0200 Subject: [PATCH 2/3] requested_changes --- RFEM/initModel.py | 5 +++-- {Examples => UnitTests}/MeshGenerationStatistics_test.py | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename {Examples => UnitTests}/MeshGenerationStatistics_test.py (100%) diff --git a/RFEM/initModel.py b/RFEM/initModel.py index 30401da2..f3c66784 100644 --- a/RFEM/initModel.py +++ b/RFEM/initModel.py @@ -298,13 +298,14 @@ def ParseXMLResultsFromSelectedFileToDict(filePath: str): return __parseXMLAsDictionary(filePath) -def GenerateMesh(generateXmlSolverInput: bool = False): +def GenerateMesh(): - clientModel.service.calculate_all(generateXmlSolverInput) + clientModel.service.generate_mesh() def GetMeshStatics(): mesh_stats = clientModel.service.get_mesh_statistics() + clientModel.dict(mesh_stats) return mesh_stats diff --git a/Examples/MeshGenerationStatistics_test.py b/UnitTests/MeshGenerationStatistics_test.py similarity index 100% rename from Examples/MeshGenerationStatistics_test.py rename to UnitTests/MeshGenerationStatistics_test.py From f2bea49dfe8a13811c548b6bcd5f951f2ac236e1 Mon Sep 17 00:00:00 2001 From: Jaroslav Broz Date: Mon, 25 Oct 2021 10:56:02 +0200 Subject: [PATCH 3/3] return dict --- RFEM/initModel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/RFEM/initModel.py b/RFEM/initModel.py index f3c66784..b65eafc5 100644 --- a/RFEM/initModel.py +++ b/RFEM/initModel.py @@ -305,7 +305,5 @@ def GenerateMesh(): def GetMeshStatics(): mesh_stats = clientModel.service.get_mesh_statistics() - clientModel.dict(mesh_stats) - - return mesh_stats + return clientModel.dict(mesh_stats)