Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["--html=UnitTests\\report.html","--self-contained-html","--cov=RFEM",]
"python.testing.pytestArgs": [
"--html=UnitTests\\report.html",
"--self-contained-html",
"--cov=RFEM",
],
"markdownlint.config": {
"MD028": false,
"MD025": {
"front_matter_title": ""
}
}
}
38 changes: 38 additions & 0 deletions Examples/BaseSettings_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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 *
from RFEM.baseSettings import *

if __name__ == '__main__':

clientModel.service.begin_modification()

# Set Base Settings
BaseSettings(12, GlobalAxesOrientationType.E_GLOBAL_AXES_ORIENTATION_ZUP, LocalAxesOrientationType.E_LOCAL_AXES_ORIENTATION_ZUP, [0.001, 0.002, 0.003, 0.004])

print('Ready!')

clientModel.service.finish_modification()

60 changes: 60 additions & 0 deletions RFEM/baseSettings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from RFEM.initModel import *
from RFEM.enums import *
from enum import Enum

class BaseSettings():
def __init__(self,
gravitational_acceleration: int = 10,
global_axes_orientation = GlobalAxesOrientationType.E_GLOBAL_AXES_ORIENTATION_ZDOWN,
local_axes_orientation = LocalAxesOrientationType.E_LOCAL_AXES_ORIENTATION_ZDOWN,
tolerances = [0.0005, 0.0005, 0.0005, 0.0005],
member_representatives: bool = False,
member_set_representatives: bool = False):
"""
Args:
gravitational_acceleration (int): Gravitational Acceleration (m/sn2)
global_axes_orientation (enum): Global Axes Orientation Enumeration
local_axes_orientation (Enum): Local Axes Orientation Enumeration
tolerances (list): Tolerances
member_representatives (bool): Member Representatives
member_set_representatives (bool): Member Set Representatives

tolerances = [tolerance_for_nodes, tolerance_for_lines, tolerance_for_surfaces_and_planes, tolerance_for_directions]
"""
# Client model | Load Case
clientObject = clientModel.factory.create('ns0:model_settings_and_options_type')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)

# Gravitational Acceleration
clientObject.gravitational_acceleration = gravitational_acceleration

# Global Axes Orientation
clientObject.global_axes_orientation = global_axes_orientation.name

# Local Axes Orientation
clientObject.local_axes_orientation = local_axes_orientation.name

# Tolerances
if len(tolerances) == 4:
pass
else:
raise Exception("WARNING:Expected size of the array. Kindly check the list correctness.")

clientObject.tolerance_for_nodes = tolerances[0]
clientObject.tolerance_for_lines = tolerances[1]
clientObject.tolerance_for_surfaces_and_planes = tolerances[2]
clientObject.tolerance_for_directions = tolerances[3]

# Member Representatives
clientObject.member_representatives_active = member_representatives

# Member Set Representatives
clientObject.member_set_representatives_active = member_set_representatives

# Add Base Data Settings to client model
clientModel.service.set_model_settings_and_options(clientObject)



12 changes: 12 additions & 0 deletions RFEM/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,18 @@ class export_to_ifc_export_type(Enum):

E_EXPORT_IFC4_REFERENCE_VIEW, E_EXPORT_IFC4_STRUCTURAL_ANALYSIS_VIEW = range(2)

class GlobalAxesOrientationType(Enum):
'''
Model Settings and Options Global Axes Orientation Type
'''
E_GLOBAL_AXES_ORIENTATION_ZDOWN, E_GLOBAL_AXES_ORIENTATION_ZUP = range(2)

class LocalAxesOrientationType(Enum):
'''
Model Settings and Local Axes Orientation Type
'''
E_LOCAL_AXES_ORIENTATION_YUPX, E_LOCAL_AXES_ORIENTATION_YUPZ, E_LOCAL_AXES_ORIENTATION_ZDOWN, E_LOCAL_AXES_ORIENTATION_ZUP = range(4)

class ModelType(Enum):
'''
Model Type | Enum
Expand Down
754 changes: 6 additions & 748 deletions UnitTests/report.html

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions UnitTests/test_BaseSettings_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
sys.path.append(".")
import pytest
from RFEM.enums import *
from RFEM.baseSettings import *


def test_base_settings_implemented():

exist = method_exists(clientModel,'set_model_settings_and_options')
assert exist == False #test fail once method is in T9 master or GM


@pytest.mark.skip("all tests still WIP")
def test_baseSettings():

clientModel.service.begin_modification()

# Set Base Settings
BaseSettings(12, GlobalAxesOrientationType.E_GLOBAL_AXES_ORIENTATION_ZUP, LocalAxesOrientationType.E_LOCAL_AXES_ORIENTATION_ZUP, [0.001, 0.002, 0.003, 0.004])

print('Ready!')

clientModel.service.finish_modification()