Skip to content

Commit

Permalink
Major rework:
Browse files Browse the repository at this point in the history
- unit tests running see UnitTests/README.md
- added template for unit tests
- all files unified
- added script for executing all examples
- corrected pylint errors/warnings/messages
- enabled commented out tests
deleted:
BaseSettings_test.py - superfluous; same function already in unit tests
Member_test.py - replaced with test_Member_test.py
added:
Examples.py - execute all Examples
template.py - unit-test template
test_Member_test.py - Examples replacement
  • Loading branch information
MichalO committed Dec 27, 2021
1 parent 1b686dd commit 935ebca
Show file tree
Hide file tree
Showing 77 changed files with 656 additions and 458 deletions.
22 changes: 0 additions & 22 deletions Examples/BaseSettings_test.py

This file was deleted.

3 changes: 1 addition & 2 deletions Examples/Cantilever/Demo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
f = float(input('Force in kN: '))

Model(True, "Demo1") # crete new model called Demo1
Model.clientModel.service.begin_modification('new')
Model.clientModel.service.begin_modification()

Material(1, 'S235')

Expand Down Expand Up @@ -65,4 +65,3 @@
print ("Model dimension x " + str(modelStatus.property_dimensions.x))
print ("Model dimension y " + str(modelStatus.property_dimensions.y))
print ("Model dimension z " + str(modelStatus.property_dimensions.z))

2 changes: 1 addition & 1 deletion Examples/CantileverQt/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def onOK(self):

# RFEM 6
Model(True, "CantileverQt") # crete new model called CantileverQt
Model.clientModel.service.begin_modification('new')
Model.clientModel.service.begin_modification()

Material(1, 'S235')

Expand Down
6 changes: 3 additions & 3 deletions Examples/GetRFEMData/GetOptimizedValues.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
print('basename: ', baseName)
print('dirname: ', dirName)
sys.path.append(dirName + r'/../..')
from RFEM.initModel import Model, method_exists
from RFEM.initModel import Model, CheckIfMethodOrTypeExists

if __name__ == "__main__":

Model()
if method_exists(Model.clientModel,'get_optimized_formula_parameters'):
if CheckIfMethodOrTypeExists(Model.clientModel,'get_optimized_formula_parameters'):

optimizationResults = Model.clientModel.service.get_optimized_formula_parameters()
if len(optimizationResults):
if len(optimizationResults) > 0:
for i in range(0, len(optimizationResults.row)):
for j in range(0, len(optimizationResults.row[i].section)):

Expand Down
12 changes: 6 additions & 6 deletions Examples/GetRFEMData/GlobalParametersAndFormulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
print('dirname: ', dirName)
sys.path.append(dirName + r'/../..')

from RFEM.initModel import Model, method_exists
from RFEM.initModel import Model, CheckIfMethodOrTypeExists
from RFEM.enums import ObjectTypes

if __name__ == "__main__":

Model()
method_exists(Model.clientModel,'ns0:object_location')
method_exists(Model.clientModel,'ns0:object_parameter_location_type')
method_exists(Model.clientModel,'ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy')
method_exists(Model.clientModel,'ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy.node')
method_exists(Model.clientModel,'get_formula')
CheckIfMethodOrTypeExists(Model.clientModel,'ns0:object_location')
CheckIfMethodOrTypeExists(Model.clientModel,'ns0:object_parameter_location_type')
CheckIfMethodOrTypeExists(Model.clientModel,'ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy')
CheckIfMethodOrTypeExists(Model.clientModel,'ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy.node')
CheckIfMethodOrTypeExists(Model.clientModel,'get_formula')

objectLocation = Model.clientModel.factory.create('ns0:object_location')
objectLocation.type = ObjectTypes.E_OBJECT_TYPE_SECTION.name
Expand Down
11 changes: 8 additions & 3 deletions Examples/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import sys
import os
baseName = os.path.basename(__file__)
dirName = os.path.dirname(__file__)
print('basename: ', baseName)
print('dirname: ', dirName)

PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.pardir)
)
sys.path.append(PROJECT_ROOT)
from RFEM.enums import NodalSupportType, StaticAnalysisType, LoadDirectionType, MemberLoadDistribution, MemberLoadDirection
from RFEM.enums import NodalSupportType, StaticAnalysisType, LoadDirectionType, MemberLoadDistribution, MemberLoadDirection, MemberRotationSpecificationType
from RFEM.window import window
from RFEM.dataTypes import inf
from RFEM.initModel import Model, MemberRotationSpecificationType, Calculate_all, insertSpaces, modelLst
from RFEM.initModel import Model, Calculate_all, insertSpaces, modelLst
from RFEM.BasicObjects.material import Material
from RFEM.BasicObjects.section import Section
from RFEM.BasicObjects.thickness import Thickness
Expand All @@ -32,7 +37,7 @@
def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_spacing, new_model, model_name, delete, reset):
# -------------------------------------------------------------
Model(new_model, model_name, delete, reset)
Model.clientModel.service.begin_modification('new')
Model.clientModel.service.begin_modification()
# -------------------------------------------------------------
# Materials
Material(1)
Expand Down
4 changes: 2 additions & 2 deletions RFEM/BasicObjects/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def Circle(self,
clientObject.circle_center_coordinate_2 = center_of_cirle[1]
clientObject.circle_center_coordinate_3 = center_of_cirle[2]

clientObject.circle_radius = circle_radius,
clientObject.circle_radius = circle_radius

# Point of normal to circle plane
clientObject.circle_normal_coordinate_1 = point_of_normal_to_circle_plane[0]
Expand Down Expand Up @@ -339,7 +339,7 @@ def NURBS(self,
print("Number of control points must comply with number of weights!")

nurbs_control_points = []
for i in range(len(control_points)):
for i,j in enumerate(control_points):
point = Model.clientModel.factory.create('ns0:line_nurbs_control_points_by_components')
point.no = i+1
point.global_coordinate_x = control_points[i][0]
Expand Down
Loading

0 comments on commit 935ebca

Please sign in to comment.