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
7 changes: 4 additions & 3 deletions Examples/Cantilever/Demo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
l = float(input('Length of the cantilever in m: '))
f = float(input('Force in kN: '))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Model class definition
Model(model_name='Demo1')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved

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

Material(1, 'S235')

Expand All @@ -57,12 +58,12 @@

NodalLoad(
1, 1, '2', LoadDirectionType.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W, f*1000)
clientModel.service.finish_modification()
Model.clientModel.service.finish_modification()

Calculate_all()

# model status
modelStatus = clientModel.service.get_model_info()
modelStatus = Model.clientModel.service.get_model_info()
print("Model is calculated") if modelStatus.property_has_results else print("Model is not calculated")
print("Model contains printout report") if modelStatus.property_has_printout_report else print("Model has not printout report")
print ("Model contains " + str(modelStatus.property_node_count) + " nodes")
Expand Down
5 changes: 3 additions & 2 deletions Examples/CantileverQt/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def onOK(self):
sys.exit()

# RFEM 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Model class definition
Model(model_name='Cantilever')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved

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

Material(1, 'S235')

Expand All @@ -98,7 +99,7 @@ def onOK(self):

print('Ready!')

clientModel.service.finish_modification()
Model.clientModel.service.finish_modification()

def onCancel(self):
print('Cancel')
Expand Down
2 changes: 1 addition & 1 deletion Examples/GetRFEMData/GetOptimizedValues.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

if __name__ == "__main__":

optimizationResults = clientModel.service.get_optimized_formula_parameters()
optimizationResults = Model.clientModel.service.get_optimized_formula_parameters()

if optimizationResults != None:
for i in range(0, len(optimizationResults.row)):
Expand Down
14 changes: 7 additions & 7 deletions Examples/GetRFEMData/GlobalParametersAndFormulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@
from RFEM.enums import *

if __name__ == "__main__":

objectLocation = clientModel.factory.create('ns0:object_location')
objectLocation = Model.clientModel.factory.create('ns0:object_location')
objectLocation.type = ObjectTypes.E_OBJECT_TYPE_SECTION.name
objectLocation.no = 1
objectLocation.parent_no = 0

objectParameterLocation = clientModel.factory.create('ns0:object_parameter_location_type')
objectParameterLocation = Model.clientModel.factory.create('ns0:object_parameter_location_type')
objectParameterLocation.attribute = "parametrization"
parameterPathInNestedModelsHierarchy = clientModel.factory.create('ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy')
parameterPathInNestedModelsHierarchyNode = clientModel.factory.create('ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy.node')
parameterPathInNestedModelsHierarchy = Model.clientModel.factory.create('ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy')
parameterPathInNestedModelsHierarchyNode = Model.clientModel.factory.create('ns0:object_parameter_location_type.parameter_path_in_nested_models_hierarchy.node')
parameterPathInNestedModelsHierarchyNode.row_path = "0, 0"
parameterPathInNestedModelsHierarchyNode.column_string_id = "section_parameter_value"
parameterPathInNestedModelsHierarchy.node = parameterPathInNestedModelsHierarchyNode
objectParameterLocation.parameter_path_in_nested_models_hierarchy = parameterPathInNestedModelsHierarchy
formula = clientModel.service.get_formula(objectLocation,objectParameterLocation)
formula = Model.clientModel.service.get_formula(objectLocation,objectParameterLocation)
print('formula: ' + formula.formula)
print('Calculated value: ' + str(formula.calculated_value))
print('Validation results: ' + formula.validation_result)
Expand Down
46 changes: 20 additions & 26 deletions Examples/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import os
import sys
import math
baseName = os.path.basename(__file__)
dirName = os.path.dirname(__file__)
print('basename: ', baseName)
print('dirname: ', dirName)
sys.path.append(r'.')
sys.path.append(".")
from RFEM.enums import *
from RFEM.window import *
from RFEM.dataTypes import *
Expand All @@ -31,24 +25,23 @@
from RFEM.Loads.memberLoad import *
from RFEM.Loads.surfaceLoad import *

def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_spacing):
def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_spacing, new_model, model_name, delete, reset):
# -------------------------------------------------------------
clientModel.service.begin_modification('new')
print('Geometry...')

Model(new_model, model_name, delete, reset)
Model.clientModel.service.begin_modification('new')
# -------------------------------------------------------------
# Materials
Material(1)
Material(2, "S275", "Test")
Material(3, "Concrete f'c = 20 MPa | CSA A23.3-19", "Test")

# -------------------------------------------------------------
# Sections
Section(1, "HEB 220")
Section(2, "IPE 300")
Section(3, "U 100", 2)
Section(4, "Cable 14.00", 2)

# -------------------------------------------------------------
# Thicknesses
Thickness(1, "Slab", 3, 0.24, "Test")
Expand Down Expand Up @@ -125,19 +118,19 @@ def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_sp
while i <= number_frames:
j = (i-1) * 5
k = (i-1) * 4
Member(k+1, j+1, j+2, 0.0, 1, 1)
Member(k+2, j+2, j+3, 0.0, 2, 2)
Member(k+3, j+3, j+4, 0.0, 2, 2)
Member(k+4, j+4, j+5, 0.0, 1, 1)
Member(k+1, j+1, j+2, 0.0, 1, 1)
Member(k+2, j+2, j+3, 0.0, 2, 2)
Member(k+3, j+3, j+4, 0.0, 2, 2)
Member(k+4, j+4, j+5, 0.0, 1, 1)
i += 1

# Purlins
i = 1
while i <= number_frames-1:
j = (i-1) * 5
Member(4*number_frames+i , j+2, j+7, 0.0, 3, 3, 1, 1)
Member(4*number_frames+i + number_frames-1, j+3, j+8, 0.0, 3, 3)
Member(4*number_frames+i + 2*number_frames-2, j+4, j+9, 180.0, 3, 3, 1, 1)
Member(4*number_frames+i , j+2, j+7, 0.0, 3, 3, 1, 1)
Member(4*number_frames+i + number_frames-1, j+3, j+8, 0.0, 3, 3)
Member(4*number_frames+i + 2*number_frames-2, j+4, j+9, 180.0, 3, 3, 1, 1)
i += 1

# Diagonals on the wall
Expand Down Expand Up @@ -229,7 +222,7 @@ def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_sp

# -------------------------------------------------------------
# Nodal Forces
NodalLoad(1, 1, "9 4 7 2", LoadDirectionType.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W, 2000.0)
NodalLoad(1, 3, "9 4 7 2", LoadDirectionType.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W, 2000.0)

# -------------------------------------------------------------
# Member Loads
Expand All @@ -249,7 +242,7 @@ def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_sp

## Force Type Member Load with LOAD_DISTRIBUTION_CONCENTRATED_2x2 ##
MemberLoad.Force(0, 7, 6, "2 3 6 7", MemberLoadDistribution.LOAD_DISTRIBUTION_CONCENTRATED_2x2, MemberLoadDirection.LOAD_DIRECTION_LOCAL_Z, load_parameter=[False, False, False, 5000, 1, 2, 3])

## Force Type Member Load with LOAD_DISTRIBUTION_CONCENTRATED_2x ##
MemberLoad.Force(0, 8, 7, "2 3 6 7", MemberLoadDistribution.LOAD_DISTRIBUTION_CONCENTRATED_2, MemberLoadDirection.LOAD_DIRECTION_LOCAL_Z, load_parameter=[False, False, 5000, 6000, 1, 2])

Expand All @@ -264,25 +257,26 @@ def main(hall_width_L, hall_height_h_o, hall_height_h_m, number_frames, frame_sp

## Force Type Member Load with LOAD_DISTRIBUTION_PARABOLIC ##
MemberLoad.Force(0, 12, 11, "2 3 6 7", MemberLoadDistribution.LOAD_DISTRIBUTION_PARABOLIC, MemberLoadDirection.LOAD_DIRECTION_LOCAL_Z, load_parameter=[4000, 8000, 12000])

## Force Type Member Load with LOAD_DISTRIBUTION_VARYING ##
MemberLoad.Force(0, 13, 12, "2 3 6 7", MemberLoadDistribution.LOAD_DISTRIBUTION_VARYING, MemberLoadDirection.LOAD_DIRECTION_LOCAL_Z, load_parameter=[[1, 1, 4000], [2, 1, 5000]])

## Force Type Member Load with LOAD_DISTRIBUTION_VARYING_IN_Z ##
MemberLoad.Force(0, 14, 13, "2 3 6 7", MemberLoadDistribution.LOAD_DISTRIBUTION_VARYING_IN_Z, MemberLoadDirection.LOAD_DIRECTION_LOCAL_Z, load_parameter=[[1, 1, 4000], [2, 1, 5000]])

# -------------------------------------------------------------
# Surface Loads
SurfaceLoad(1, 3, "3", 20000)

# -------------------------------------------------------------
# Finish client model
print("Calculating...")
clientModel.service.finish_modification()
Model.clientModel.service.finish_modification()

# -------------------------------------------------------------
# Calculate all
Calculate_all()
print("Done")

if __name__ == '__main__':
window(main)
window(main, modelLst)
40 changes: 20 additions & 20 deletions RFEM/BasicObjects/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand All @@ -28,7 +28,7 @@ def __init__(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Polyline(self,
no: int = 1,
Expand All @@ -37,7 +37,7 @@ def Polyline(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand All @@ -59,7 +59,7 @@ def Polyline(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Arc(self,
no: int = 1,
Expand All @@ -70,7 +70,7 @@ def Arc(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand Down Expand Up @@ -98,7 +98,7 @@ def Arc(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Circle(self,
no: int = 1,
Expand All @@ -110,7 +110,7 @@ def Circle(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand Down Expand Up @@ -144,7 +144,7 @@ def Circle(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def EllipticalArc(self,
no: int = 72,
Expand All @@ -158,7 +158,7 @@ def EllipticalArc(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand Down Expand Up @@ -198,7 +198,7 @@ def EllipticalArc(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Ellipse(self,
no: int = 1,
Expand All @@ -208,7 +208,7 @@ def Ellipse(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand Down Expand Up @@ -237,7 +237,7 @@ def Ellipse(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Parabola(self,
no: int = 1,
Expand All @@ -248,7 +248,7 @@ def Parabola(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand Down Expand Up @@ -279,7 +279,7 @@ def Parabola(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def Spline(self,
no: int = 1,
Expand All @@ -288,7 +288,7 @@ def Spline(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand All @@ -310,7 +310,7 @@ def Spline(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)

def NURBS(self,
no: int = 1,
Expand All @@ -321,7 +321,7 @@ def NURBS(self,
params: dict = {}):

# Client model | Line
clientObject = clientModel.factory.create('ns0:line')
clientObject = Model.clientModel.factory.create('ns0:line')

# Clears object atributes | Sets all atributes to None
clearAtributes(clientObject)
Expand All @@ -340,14 +340,14 @@ def NURBS(self,

nurbs_control_points = []
for i in range(len(control_points)):
point = clientModel.factory.create('ns0:line_nurbs_control_points_by_components')
point = Model.clientModel.factory.create('ns0:line_nurbs_control_points_by_components')
point.no = i+1
point.global_coordinate_x = control_points[i][0]
point.global_coordinate_y = control_points[i][1]
point.global_coordinate_z = control_points[i][2]
point.weight = weights[i]
nurbs_control_points.append(point)
clientObject.nurbs_control_points_by_components = clientModel.factory.create('ns0:line_nurbs_control_points_by_components')
clientObject.nurbs_control_points_by_components = Model.clientModel.factory.create('ns0:line_nurbs_control_points_by_components')

# Comment
clientObject.comment = comment
Expand All @@ -357,4 +357,4 @@ def NURBS(self,
clientObject[key] = params[key]

# Add Line to client model
clientModel.service.set_line(clientObject)
Model.clientModel.service.set_line(clientObject)
Loading