diff --git a/RFEM/SpecialObjects/resultSection.py b/RFEM/SpecialObjects/resultSection.py index e4953dbb..51c9791e 100644 --- a/RFEM/SpecialObjects/resultSection.py +++ b/RFEM/SpecialObjects/resultSection.py @@ -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): """ @@ -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 """ @@ -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: @@ -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): @@ -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 @@ -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 @@ -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): @@ -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 @@ -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 diff --git a/UnitTests/test_SpecialObjects.py b/UnitTests/test_SpecialObjects.py index 58b1b5e5..00ea7841 100644 --- a/UnitTests/test_SpecialObjects.py +++ b/UnitTests/test_SpecialObjects.py @@ -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]) @@ -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