diff --git a/pyNastran/converters/nastran/gui/results_helper.py b/pyNastran/converters/nastran/gui/results_helper.py index 769b0c7a8..5ddddc8a8 100644 --- a/pyNastran/converters/nastran/gui/results_helper.py +++ b/pyNastran/converters/nastran/gui/results_helper.py @@ -11,7 +11,8 @@ from pyNastran.femutils.utils import safe_norm from pyNastran.gui.gui_objects.gui_result import GuiResult, GuiResultIDs from pyNastran.gui.gui_objects.displacements import ( - DisplacementResults, ForceTableResults) #, TransientElementResults + #DisplacementResults, + ForceTableResults) #, TransientElementResults from pyNastran.op2.result_objects.stress_object import ( _get_nastran_header, get_rod_stress_strain, @@ -1467,20 +1468,14 @@ def _fill_nastran_ith_displacement(result, resname: str, 3: {'title': 'M_', 'corner': 'M_'}, } if deflects: - if use_new_sidebar_objects: - nastran_res2 = DisplacementResults2( - subcase_idi, node_ids, xyz_cid0, case, - title=resname, - t123_offset=t123_offset, - dim_max=dim_max, - data_format='%g', nlabels=None, labelsize=None, - ncolors=None, colormap='', set_max_min=False, - uname=resname) - if use_old_sidebar_objects: - nastran_res = DisplacementResults(subcase_idi, titles, headers, - xyz_cid0, t123, tnorm, - scales, - uname=resname) + nastran_res2 = DisplacementResults2( + subcase_idi, node_ids, xyz_cid0, case, + title=resname, + t123_offset=t123_offset, + dim_max=dim_max, + data_format='%g', nlabels=None, labelsize=None, + ncolors=None, colormap='', set_max_min=False, + uname=resname) for itime in range(ntimes): # mode = 2; freq = 75.9575 Hz @@ -1491,27 +1486,11 @@ def _fill_nastran_ith_displacement(result, resname: str, case.superelement_adaptivity_index, case.pval_step) - if use_old_sidebar_objects: - tnorm_abs_max = get_tnorm_abs_max(case, t123, tnorm, itime) - scale = dim_max - if tnorm_abs_max > 0.0: - scale = dim_max / tnorm_abs_max * 0.10 - scales.append(scale) - titles.append(title1) - headers.append(f'{title1}: {header}') - - # fill the case - cases[icase] = (nastran_res, (itime, title1)) # do I keep this??? - formii: Form = (title1, icase, []) - form_dict[(key, itime)].append(formii) - icase += 1 - - if use_new_sidebar_objects: - headers2.append(header) - cases[icase] = (nastran_res2, (itime, title1)) # do I keep this??? - formii: Form = (title1, icase, []) - form_dict[(key, itime)].append(formii) - icase += 1 + headers2.append(header) + cases[icase] = (nastran_res2, (itime, title1)) # do I keep this??? + formii: Form = (title1, icase, []) + form_dict[(key, itime)].append(formii) + icase += 1 #if name == 'Displacement': # Displacement; itime=361 time=3.61 tnorm=1.46723 @@ -1519,24 +1498,18 @@ def _fill_nastran_ith_displacement(result, resname: str, #pass else: dim_max = 1.0 - if use_old_sidebar_objects: - nastran_res = ForceTableResults(subcase_idi, titles, headers, - t123, tnorm, - scales, #deflects=deflects, - uname=resname) methods_txyz_rxyz = ['Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'] - if use_new_sidebar_objects: - nastran_res2 = ForceResults2( - subcase_idi, node_ids, xyz_cid0, case, - title=resname, - t123_offset=t123_offset, - methods_txyz_rxyz=methods_txyz_rxyz, - index_to_base_title_annotation=force_index_to_base_title_annotation, - dim_max=dim_max, - data_format='%g', nlabels=None, labelsize=None, - ncolors=None, colormap='', set_max_min=False, - uname=resname) + nastran_res2 = ForceResults2( + subcase_idi, node_ids, xyz_cid0, case, + title=resname, + t123_offset=t123_offset, + methods_txyz_rxyz=methods_txyz_rxyz, + index_to_base_title_annotation=force_index_to_base_title_annotation, + dim_max=dim_max, + data_format='%g', nlabels=None, labelsize=None, + ncolors=None, colormap='', set_max_min=False, + uname=resname) for itime in range(ntimes): dt = case._times[itime] header = _get_nastran_header(case, dt, itime) @@ -1547,27 +1520,12 @@ def _fill_nastran_ith_displacement(result, resname: str, #tnorm_abs_max = get_tnorm_abs_max(case, t123, tnorm, itime) #tnorm_abs_max = tnorm.max() - if use_old_sidebar_objects: - scale = 1. - scales.append(scale) - titles.append(title1) - headers.append(f'{title1}: {header}') - # fill data - cases[icase] = (nastran_res, (itime, title1)) # do I keep this??? - formii = (title1, icase, []) - form_dict[(key, itime)].append(formii) - icase += 1 - - if use_new_sidebar_objects: - headers2.append(header) - cases[icase] = (nastran_res2, (itime, title1)) # do I keep this??? - formii: Form = (title1, icase, []) - form_dict[(key, itime)].append(formii) - icase += 1 - if use_old_sidebar_objects: - nastran_res.save_defaults() - if use_new_sidebar_objects: - nastran_res2.headers = headers2 + headers2.append(header) + cases[icase] = (nastran_res2, (itime, title1)) # do I keep this??? + formii: Form = (title1, icase, []) + form_dict[(key, itime)].append(formii) + icase += 1 + nastran_res2.headers = headers2 return icase def _fill_nastran_temperatures(cases: Cases, model: OP2, diff --git a/pyNastran/converters/nastran/nastran_to_vtk.py b/pyNastran/converters/nastran/nastran_to_vtk.py index 49ad85b03..90af12d5c 100644 --- a/pyNastran/converters/nastran/nastran_to_vtk.py +++ b/pyNastran/converters/nastran/nastran_to_vtk.py @@ -60,10 +60,10 @@ def save_nastran_results(gui: NastranGUI, point_data, cell_data, log) continue - elif isinstance(case, DisplacementResults): - _save_displacement_results(icase, case, key, index_name, used_titles, - point_data, cell_data, log) - continue + # elif isinstance(case, DisplacementResults): + # _save_displacement_results(icase, case, key, index_name, used_titles, + # point_data, cell_data, log) + # continue elif isinstance(case, SimpleTableResults): _save_simple_table_results(icase, case, key, index_name, used_titles, diff --git a/pyNastran/converters/nastran/test_nastran_gui.py b/pyNastran/converters/nastran/test_nastran_gui.py index 1edc94d17..307e92521 100644 --- a/pyNastran/converters/nastran/test_nastran_gui.py +++ b/pyNastran/converters/nastran/test_nastran_gui.py @@ -42,7 +42,9 @@ from pyNastran.gui.qt_files.gui_attributes import IS_CUTTING_PLANE from pyNastran.gui.gui_objects.gui_result import GuiResult, NormalResult, GridPointForceResult -from pyNastran.gui.gui_objects.displacements import DisplacementResults, ForceTableResults, ElementalTableResults +from pyNastran.gui.gui_objects.displacements import ( + #DisplacementResults, + ForceTableResults, ElementalTableResults) from pyNastran.converters.nastran.gui.result_objects.simple_table_results import SimpleTableResults from pyNastran.converters.nastran.gui.result_objects.layered_table_results import LayeredTableResults @@ -52,7 +54,7 @@ from pyNastran.converters.nastran.gui.result_objects.plate_stress_results import PlateStrainStressResults2 from pyNastran.converters.nastran.gui.result_objects.solid_stress_results import SolidStrainStressResults2 -RED = (1., 0., 0.) +RED_FLOAT = (1., 0., 0.) class NastranGUI(NastranIO, FakeGUIMethods): @@ -138,7 +140,8 @@ def validate_result_object_methods(self): res.get_annotation(itime, res_name) elif isinstance(res, GridPointForceResult): pass - elif isinstance(res, (DisplacementResults, ForceTableResults)): # ElementalTableResults + elif isinstance(res, ForceTableResults): + # DisplacementResults, , ElementalTableResults res.get_annotation(itime, res_name) res.get_arrow_scale(itime, res_name) #res.get_case_flag(itime, res_name) @@ -312,7 +315,7 @@ def test_settings(self): test.settings.update_coord_scale(coord_scale=None, render=True) test.settings.set_background_color_to_white(render=True) - color = RED + color = RED_FLOAT opacity = 0.4 test.settings.set_background_color(color, render=True) test.settings.set_background_color2(color, render=True) @@ -822,8 +825,8 @@ def test_solid_bending_missing_nodes(self): def test_beam_modes_01(self): """CBAR/CBEAM - PARAM,POST,-1""" - bdf_filename = os.path.join(MODEL_PATH, 'beam_modes', 'beam_modes.dat') - op2_filename = os.path.join(MODEL_PATH, 'beam_modes', 'beam_modes_m1.op2') + bdf_filename = MODEL_PATH / 'beam_modes' / 'beam_modes.dat' + op2_filename = MODEL_PATH / 'beam_modes' / 'beam_modes_m1.op2' test = NastranGUI() test.load_nastran_geometry(bdf_filename) @@ -1045,7 +1048,7 @@ def test_bwb_gui(self): #nplate_force=0 ) assert nresults == 85, (len(test.result_cases), nresults) # -95 - asdf + raise RuntimeError(nresults) test.group_actions.create_groups_by_property_id() test.group_actions.create_groups_by_visible_result(nlimit=50) @@ -1981,6 +1984,7 @@ def get_nreal_nresults(test, if not nastran_settings.strain_energy: nstrain_energy = 0 ntables = ( + # *2 is for translation/rotation nspc_force + nmpc_force + nload_vectors + ndisplacement + neigenvectors) * 2 diff --git a/pyNastran/gui/menus/results_sidebar.py b/pyNastran/gui/menus/results_sidebar.py index 4b6569683..50d1602fc 100644 --- a/pyNastran/gui/menus/results_sidebar.py +++ b/pyNastran/gui/menus/results_sidebar.py @@ -30,6 +30,7 @@ SHOW_NAME_MAIN = False SHOW_CASE_SPINNER = False +SPINNER_READ_ONLY = 'QSpinBox {background-color: lightblue;}' SkippableSpinBox = QSpinBox #class SkippableSpinBox(QSpinBox): @@ -382,6 +383,9 @@ def set_output_checkbox(self, self.vector_checkbox.setChecked(is_checked_vector) def hide_dev(self): + #self.case_spinner_label + #self.case_spinner.setReadOnly(True) + self.case_spinner.setStyleSheet(SPINNER_READ_ONLY) objs = [ self.case_spinner_label, self.case_spinner, self.deflection_label, self.deflection_edit, @@ -722,6 +726,11 @@ def on_apply(self): index_list_b = [0] self.update_vtk_window(keys_a, index_list_b) + #self._update_case = False + #self.case_spinner.setValue(icase) + #self._update_case = True + #self.case_spinner.setValue(icase) + def update_vtk_window(self, key_a: int, keys_b: list[int]) -> None: diff --git a/pyNastran/gui/qt_files/gui_qt_common.py b/pyNastran/gui/qt_files/gui_qt_common.py index 2207db076..df0a2be9d 100644 --- a/pyNastran/gui/qt_files/gui_qt_common.py +++ b/pyNastran/gui/qt_files/gui_qt_common.py @@ -204,6 +204,8 @@ def get_subtitle_label(self, subcase_id: int) -> tuple[str, str]: def on_clear_results(self, show_msg: bool=True) -> None: """clears the model of all results""" + if self.icase == -1: + return (obj, (i, resname)) = self.result_cases[self.icase] unused_location = obj.get_location(i, resname) diff --git a/pyNastran/gui/test/test_gui.py b/pyNastran/gui/test/test_gui.py index 1ae509354..b345ea002 100644 --- a/pyNastran/gui/test/test_gui.py +++ b/pyNastran/gui/test/test_gui.py @@ -26,8 +26,8 @@ from pyNastran.gui.arg_handling import ( INPUT_FORMAT_TO_EXTENSION, OUTPUT_FORMAT_TO_EXTENSION) -INPUT_FORMAT_TO_EXTENSION['nastran].append('.dat') -#INPUT_FORMAT_TO_EXTENSION['tecplot].append('.dat') +INPUT_FORMAT_TO_EXTENSION['nastran'].append('.dat') +#INPUT_FORMAT_TO_EXTENSION['tecplot'].append('.dat') #pkg_path = pyNastran.__path__[0] diff --git a/pyNastran/op2/tables/oef_forces/oef.py b/pyNastran/op2/tables/oef_forces/oef.py index 8e8aa0faa..d89caf30a 100644 --- a/pyNastran/op2/tables/oef_forces/oef.py +++ b/pyNastran/op2/tables/oef_forces/oef.py @@ -1015,7 +1015,7 @@ def _read_oef1_loads(self, data: bytes, ndata: int): """Reads the OEF1 table; stores the element forces/heat flux.""" op2 = self.op2 #self._apply_oef_ato_crm_psd_rms_no('') # TODO: just testing - if op2._results.is_not_saved('forces'): + if op2._results.is_not_saved('force'): return ndata prefix, postfix = self.get_oef_prefix_postfix()