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
54 changes: 18 additions & 36 deletions RFEM/SpecialObjects/resultSection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def __init__(self,
show_section_in_direction = ResultSectionResultDirection.SHOW_RESULTS_IN_LOCAL_PLUS_Z,
show_values_on_isolines: bool = False,
parameters: list = None,
assigned_to_all_surfaces: bool = True,
assigned_to_all_solids: bool = True,
assigned_to_surfaces: str = '',
assigned_to_solids: str = '',
params: dict = None,
model = Model):
"""
Expand All @@ -27,8 +27,8 @@ def __init__(self,
if type == ResultSectionType.TYPE_2_POINTS_AND_VECTOR:
[coordinate_system, first_point_coordinates, second_point_coordinates, projection, vector]
[1, [1,0,0], [0,2,0], ResultSectionProjection.PROJECTION_IN_VECTOR, [1,1,1]]
assigned_to_all_surfaces (bool, optional) = Assigned to all surface
assigned_to_all_solids (bool, optional) Assigned to all solids
assigned_to_surfaces (str, optional) = Assigned to surfaces
assigned_to_solids (str, optional) Assigned to solids
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (class, optional): Model instance
"""
Expand Down Expand Up @@ -69,16 +69,10 @@ def __init__(self,
clientObject.vector_coordinate_3 = parameters[4][2]

# Assigned to all surfaces
if assigned_to_all_surfaces:
clientObject.assigned_to_surfaces = '0'
else:
clientObject.assigned_to_surfaces = ''
clientObject.assigned_to_surfaces = ConvertToDlString(assigned_to_surfaces)

# Assigned to all solids
if assigned_to_all_solids:
clientObject.assigned_to_solids = '0'
else:
clientObject.assigned_to_solids = ''
clientObject.assigned_to_solids = ConvertToDlString(assigned_to_solids)

# Adding optional parameters via dictionary
if params:
Expand All @@ -98,8 +92,8 @@ def TwoPointsAndVector(
second_point_coordinates: list = None,
projection = ResultSectionProjection.PROJECTION_IN_GLOBAL_X,
vector: list = None,
assigned_to_all_surfaces: bool = True,
assigned_to_all_solids: bool = True,
assigned_to_surfaces: str = '',
assigned_to_solids: str = '',
comment: str = '',
params: dict = None,
model = Model):
Expand All @@ -115,8 +109,8 @@ def TwoPointsAndVector(
second_point_coordinates (list, mandatory): Second point coordinates
projection (enum, mandatory): Projection in direction
vector (list, optional): Vector if projection is VECTOR
assigned_to_all_surfaces (bool, optional) = Assigned to all surface
assigned_to_all_solids (bool, optional) Assigned to all solids
assigned_to_surfaces (str, optional) = Assigned to surfaces
assigned_to_solids (str, optional) Assigned to solids
comment (str, optional): Comment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (class, optional): Model instance
Expand Down Expand Up @@ -160,16 +154,10 @@ def TwoPointsAndVector(
clientObject.vector_coordinate_3 = vector[2]

# Assigned to all surfaces
if assigned_to_all_surfaces:
clientObject.assigned_to_surfaces = '0'
else:
clientObject.assigned_to_surfaces = ''
clientObject.assigned_to_surfaces = ConvertToDlString(assigned_to_surfaces)

# Assigned to all solids
if assigned_to_all_solids:
clientObject.assigned_to_solids = '0'
else:
clientObject.assigned_to_solids = ''
clientObject.assigned_to_solids = ConvertToDlString(assigned_to_solids)

# Comment
#clientObject.comment = comment
Expand All @@ -188,8 +176,8 @@ def Line(
show_section_in_direction = ResultSectionResultDirection.SHOW_RESULTS_IN_LOCAL_PLUS_Z,
show_values_on_isolines: bool = False,
lines: str = '1',
assigned_to_all_surfaces: bool = True,
assigned_to_all_solids: bool = True,
assigned_to_surfaces: str = '',
assigned_to_solids: str = '',
comment: str = '',
params: dict = None,
model = Model):
Expand All @@ -202,8 +190,8 @@ def Line(
show_section_in_direction (enum, mandatory): _description_. Defaults to ResultSectionResultDirection.SHOW_RESULTS_IN_LOCAL_PLUS_Z.
show_values_on_isolines (bool, mandatory): _description_. Defaults to False.
lines (int, mandatory): Lines
assigned_to_all_surfaces (bool, optional) = Assigned to all surface
assigned_to_all_solids (bool, optional) Assigned to all solids
assigned_to_surfaces (str, optional) = Assigned to surfaces
assigned_to_solids (str, optional) Assigned to solids
comment (str, optional): Comment
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (class, optional): Model instance
Expand Down Expand Up @@ -231,16 +219,10 @@ def Line(
clientObject.lines = ConvertToDlString(lines)

# Assigned to all surfaces
if assigned_to_all_surfaces:
clientObject.assigned_to_surfaces = '0'
else:
clientObject.assigned_to_surfaces = ''
clientObject.assigned_to_surfaces = ConvertToDlString(assigned_to_surfaces)

# Assigned to all solids
if assigned_to_all_solids:
clientObject.assigned_to_solids = '0'
else:
clientObject.assigned_to_solids = ''
clientObject.assigned_to_solids = ConvertToDlString(assigned_to_solids)

# Comment
#clientObject.comment = comment
Expand Down
3 changes: 2 additions & 1 deletion UnitTests/test_SpecialObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_special_objects():

SurfaceContact(1, 1, '1', '3')

ResultSection(1,ResultSectionType.TYPE_2_POINTS_AND_VECTOR, ResultSectionResultDirection.SHOW_RESULTS_IN_GLOBAL_MINUS_X,True,[1, [1,0,0], [0,2,0], ResultSectionProjection.PROJECTION_IN_VECTOR, [1,1,1]], False, False)
ResultSection(1,ResultSectionType.TYPE_2_POINTS_AND_VECTOR, ResultSectionResultDirection.SHOW_RESULTS_IN_GLOBAL_MINUS_X,True,[1, [1,0,0], [0,2,0], ResultSectionProjection.PROJECTION_IN_VECTOR, [1,1,1]], '2-4')
ResultSection.Line(2,ResultSectionResultDirection.SHOW_RESULTS_IN_LOCAL_PLUS_Z,False, '2')
ResultSection.TwoPointsAndVector(3,1,ResultSectionResultDirection.SHOW_RESULTS_IN_GLOBAL_MINUS_Y,False, [10,0,0], [5,5,5], ResultSectionProjection.PROJECTION_IN_GLOBAL_X)
ResultSection.TwoPointsAndVector(4,1,ResultSectionResultDirection.SHOW_RESULTS_IN_GLOBAL_MINUS_Y,False, [10,0,0], [5,5,5], ResultSectionProjection.PROJECTION_IN_VECTOR, [-1,1,-1])
Expand Down Expand Up @@ -135,6 +135,7 @@ def test_special_objects():
assert rs1.vector_coordinate_1 == 1
assert rs1.vector_coordinate_2 == 1
assert rs1.vector_coordinate_3 == 1
assert rs1.assigned_to_surfaces == '2 3 4'

rs2 = Model.clientModel.service.get_result_section(2)
assert rs2.type == ResultSectionType.TYPE_LINE.name
Expand Down