diff --git a/src/Mod/Machining_Distortion/postprocess.py b/src/Mod/Machining_Distortion/postprocess.py index 79fa4a9d70..250c81414b 100755 --- a/src/Mod/Machining_Distortion/postprocess.py +++ b/src/Mod/Machining_Distortion/postprocess.py @@ -2,17 +2,22 @@ # Form implementation generated from reading ui file 'postprocess.ui' # -# Created: Wed Jan 26 13:34:56 2011 -# by: PyQt4 UI code generator 4.7.4 +# Created: Mon Aug 20 15:18:09 2012 +# by: PyQt4 UI code generator 4.8.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + _fromUtf8 = lambda s: s + class Ui_dialog(object): def setupUi(self, dialog): - dialog.setObjectName("dialog") - dialog.resize(380, 170) + dialog.setObjectName(_fromUtf8("dialog")) + dialog.resize(425, 240) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -20,76 +25,70 @@ class Ui_dialog(object): dialog.setSizePolicy(sizePolicy) dialog.setMinimumSize(QtCore.QSize(0, 0)) self.gridLayout_2 = QtGui.QGridLayout(dialog) - self.gridLayout_2.setObjectName("gridLayout_2") - self.groupBox_2 = QtGui.QGroupBox(dialog) - self.groupBox_2.setObjectName("groupBox_2") - self.gridLayout = QtGui.QGridLayout(self.groupBox_2) - self.gridLayout.setObjectName("gridLayout") - self.check_fly_to_buy_7 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_7.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_7.setChecked(False) - self.check_fly_to_buy_7.setObjectName("check_fly_to_buy_7") - self.gridLayout.addWidget(self.check_fly_to_buy_7, 0, 0, 1, 1) - self.check_fly_to_buy_4 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_4.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_4.setChecked(False) - self.check_fly_to_buy_4.setObjectName("check_fly_to_buy_4") - self.gridLayout.addWidget(self.check_fly_to_buy_4, 0, 1, 1, 1) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem1, 1, 1, 1, 1) - self.check_fly_to_buy_8 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_8.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_8.setChecked(False) - self.check_fly_to_buy_8.setObjectName("check_fly_to_buy_8") - self.gridLayout.addWidget(self.check_fly_to_buy_8, 2, 0, 1, 1) - self.check_fly_to_buy_2 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_2.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_2.setChecked(False) - self.check_fly_to_buy_2.setObjectName("check_fly_to_buy_2") - self.gridLayout.addWidget(self.check_fly_to_buy_2, 2, 1, 1, 1) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem2, 3, 0, 1, 1) - spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem3, 3, 1, 1, 1) - self.check_fly_to_buy_5 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_5.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_5.setChecked(False) - self.check_fly_to_buy_5.setObjectName("check_fly_to_buy_5") - self.gridLayout.addWidget(self.check_fly_to_buy_5, 4, 0, 1, 1) - self.check_fly_to_buy_3 = QtGui.QCheckBox(self.groupBox_2) - self.check_fly_to_buy_3.setMinimumSize(QtCore.QSize(148, 18)) - self.check_fly_to_buy_3.setChecked(False) - self.check_fly_to_buy_3.setObjectName("check_fly_to_buy_3") - self.gridLayout.addWidget(self.check_fly_to_buy_3, 4, 1, 1, 1) - self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 2) + self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.buttonBox = QtGui.QDialogButtonBox(dialog) self.buttonBox.setOrientation(QtCore.Qt.Vertical) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout_2.addWidget(self.buttonBox, 0, 2, 1, 1) + self.buttonBox.setObjectName(_fromUtf8("buttonBox")) + self.gridLayout_2.addWidget(self.buttonBox, 0, 3, 1, 1) self.button_select_results_folder = QtGui.QPushButton(dialog) - self.button_select_results_folder.setObjectName("button_select_results_folder") - self.gridLayout_2.addWidget(self.button_select_results_folder, 1, 0, 1, 1) + self.button_select_results_folder.setObjectName(_fromUtf8("button_select_results_folder")) + self.gridLayout_2.addWidget(self.button_select_results_folder, 3, 0, 1, 1) self.button_start_postprocessing = QtGui.QPushButton(dialog) self.button_start_postprocessing.setEnabled(False) self.button_start_postprocessing.setMinimumSize(QtCore.QSize(0, 23)) - self.button_start_postprocessing.setObjectName("button_start_postprocessing") - self.gridLayout_2.addWidget(self.button_start_postprocessing, 1, 1, 1, 1) + self.button_start_postprocessing.setObjectName(_fromUtf8("button_start_postprocessing")) + self.gridLayout_2.addWidget(self.button_start_postprocessing, 3, 1, 1, 1) + self.groupBox_2 = QtGui.QGroupBox(dialog) + self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) + self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox_2) + self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) + self.check_abs_disp_x = QtGui.QRadioButton(self.groupBox_2) + self.check_abs_disp_x.setObjectName(_fromUtf8("check_abs_disp_x")) + self.verticalLayout_2.addWidget(self.check_abs_disp_x) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem) + self.check_abs_disp_y = QtGui.QRadioButton(self.groupBox_2) + self.check_abs_disp_y.setObjectName(_fromUtf8("check_abs_disp_y")) + self.verticalLayout_2.addWidget(self.check_abs_disp_y) + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem1) + self.check_abs_disp_z = QtGui.QRadioButton(self.groupBox_2) + self.check_abs_disp_z.setObjectName(_fromUtf8("check_abs_disp_z")) + self.verticalLayout_2.addWidget(self.check_abs_disp_z) + self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 1) + self.groupBox_3 = QtGui.QGroupBox(dialog) + self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) + self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3) + self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) + self.check_rot_x = QtGui.QRadioButton(self.groupBox_3) + self.check_rot_x.setObjectName(_fromUtf8("check_rot_x")) + self.verticalLayout_3.addWidget(self.check_rot_x) + spacerItem2 = QtGui.QSpacerItem(20, 33, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem2) + self.check_rot_y = QtGui.QRadioButton(self.groupBox_3) + self.check_rot_y.setObjectName(_fromUtf8("check_rot_y")) + self.verticalLayout_3.addWidget(self.check_rot_y) + spacerItem3 = QtGui.QSpacerItem(20, 34, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem3) + self.check_rot_z = QtGui.QRadioButton(self.groupBox_3) + self.check_rot_z.setObjectName(_fromUtf8("check_rot_z")) + self.verticalLayout_3.addWidget(self.check_rot_z) + self.gridLayout_2.addWidget(self.groupBox_3, 0, 1, 1, 1) self.retranslateUi(dialog) QtCore.QMetaObject.connectSlotsByName(dialog) def retranslateUi(self, dialog): dialog.setWindowTitle(QtGui.QApplication.translate("dialog", "Machining Distortion Prediction", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_2.setTitle(QtGui.QApplication.translate("dialog", "Output Elements", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_7.setText(QtGui.QApplication.translate("dialog", "Max Displacement X", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_4.setText(QtGui.QApplication.translate("dialog", "Min Displacement X", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_8.setText(QtGui.QApplication.translate("dialog", "Max Displacement Y", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_2.setText(QtGui.QApplication.translate("dialog", "Min Displacement Y", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_5.setText(QtGui.QApplication.translate("dialog", "Max Displacement Z", None, QtGui.QApplication.UnicodeUTF8)) - self.check_fly_to_buy_3.setText(QtGui.QApplication.translate("dialog", "Min Displacement Z", None, QtGui.QApplication.UnicodeUTF8)) self.button_select_results_folder.setText(QtGui.QApplication.translate("dialog", "Select Results Folder", None, QtGui.QApplication.UnicodeUTF8)) self.button_start_postprocessing.setText(QtGui.QApplication.translate("dialog", "Start Postprocessing", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_2.setTitle(QtGui.QApplication.translate("dialog", "Select Z-Axis", None, QtGui.QApplication.UnicodeUTF8)) + self.check_abs_disp_x.setText(QtGui.QApplication.translate("dialog", "Absolute Displacement X", None, QtGui.QApplication.UnicodeUTF8)) + self.check_abs_disp_y.setText(QtGui.QApplication.translate("dialog", "Absolute Displacement Y", None, QtGui.QApplication.UnicodeUTF8)) + self.check_abs_disp_z.setText(QtGui.QApplication.translate("dialog", "Absolute Displacement Z", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_3.setTitle(QtGui.QApplication.translate("dialog", "Select Y-Axis", None, QtGui.QApplication.UnicodeUTF8)) + self.check_rot_x.setText(QtGui.QApplication.translate("dialog", "Rotation around X-Axis", None, QtGui.QApplication.UnicodeUTF8)) + self.check_rot_y.setText(QtGui.QApplication.translate("dialog", "Rotation around Y-Axis", None, QtGui.QApplication.UnicodeUTF8)) + self.check_rot_z.setText(QtGui.QApplication.translate("dialog", "Rotation around Z-Axis", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/src/Mod/Machining_Distortion/postprocess.ui b/src/Mod/Machining_Distortion/postprocess.ui index f4d23a1175..fdd46ed199 100755 --- a/src/Mod/Machining_Distortion/postprocess.ui +++ b/src/Mod/Machining_Distortion/postprocess.ui @@ -6,8 +6,8 @@ 0 0 - 380 - 170 + 425 + 240 @@ -26,164 +26,7 @@ Machining Distortion Prediction - - - - Output Elements - - - - - - - 148 - 18 - - - - Max Displacement X - - - false - - - - - - - - 148 - 18 - - - - Min Displacement X - - - false - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 148 - 18 - - - - Max Displacement Y - - - false - - - - - - - - 148 - 18 - - - - Min Displacement Y - - - false - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 148 - 18 - - - - Max Displacement Z - - - false - - - - - - - - 148 - 18 - - - - Min Displacement Z - - - false - - - - - - - + Qt::Vertical @@ -193,14 +36,14 @@ - + Select Results Folder - + false @@ -216,6 +59,118 @@ + + + + Select Z-Axis + + + + + + Absolute Displacement X + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Absolute Displacement Y + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Absolute Displacement Z + + + + + + + + + + Select Y-Axis + + + + + + Rotation around X-Axis + + + + + + + Qt::Vertical + + + + 20 + 33 + + + + + + + + Rotation around Y-Axis + + + + + + + Qt::Vertical + + + + 20 + 34 + + + + + + + + Rotation around Z-Axis + + + + + + diff --git a/src/Mod/Machining_Distortion/postprocess_gui.py b/src/Mod/Machining_Distortion/postprocess_gui.py index 4ad1cfbcef..cf5d3ef198 100755 --- a/src/Mod/Machining_Distortion/postprocess_gui.py +++ b/src/Mod/Machining_Distortion/postprocess_gui.py @@ -42,7 +42,7 @@ class MyForm(QtGui.QDialog,Ui_dialog): ltc_coeff = [] sigini = True for root, dirs, files in os.walk(str(self.dirname)): - if 'geometry_fe_input.frd' in files: + if 'final_fe_input.frd' in files: bbox_orig,\ bbox_distorted,\ relationship,\ @@ -51,7 +51,7 @@ class MyForm(QtGui.QDialog,Ui_dialog): max_disp_y,\ min_disp_y,\ max_disp_z,\ - min_disp_z = calculix_postprocess(os.path.join(root,'geometry_fe_input.frd')) + min_disp_z = calculix_postprocess(os.path.join(root,'final_fe_input.frd')) if sigini: sigini = False lc_coeff,ltc_coeff = get_sigini_values(os.path.join(root,'sigini_input.txt')) @@ -102,35 +102,86 @@ class MyForm(QtGui.QDialog,Ui_dialog): def start_gnu_plot(self,list,lc_coeff,ltc_coeff): + filename = "graph" + title = "Absolut Displacement in " + x_axis_label ="" + y_axis_label="" + z_axis_label="" + #define all the different variations that could occur and assign proper variable names + if self.check_abs_disp_x.isChecked(): + filename = filename + "_max_disp_x" + title = title + "X vs. " + z_axis_label = "Abs Displacement in X-Direction" + abs_disp_column = 12 + if self.check_abs_disp_y.isChecked(): + filename = filename + "_max_disp_y" + title = title + "Y vs. " + z_axis_label = "Abs Displacement in Y-Direction" + abs_disp_column = 13 + if self.check_abs_disp_z.isChecked(): + filename = filename + "_max_disp_z" + title = title + "Z vs. " + z_axis_label = "Abs Displacement in Z-Direction" + abs_disp_column = 14 + + #The Z-Level Offset is fix and therefore the corresponding variables are predefined: + filename = filename + "_offset_z" + title = title + "Z-Level Offset " + x_axis_label = "Z-Offset" + offset_column = 1 + + if self.check_rot_x.isChecked(): + filename = filename + "_rotation_x" + title = title + "and Rotation around X-Axis" + y_axis_label = "Rotation around X-Axis" + rot_column = 2 + if self.check_rot_y.isChecked(): + filename = filename + "_rotation_y" + title = title + "and Rotation around Y-Axis" + y_axis_label = "Rotation around Y-Axis" + rot_column = 3 + if self.check_rot_z.isChecked(): + filename = filename + "_rotation_z" + title = title + "and Rotation around Z-Axis" + y_axis_label = "Rotation around Z-Axis" + rot_column = 4 + + + gnu_plot_input_file = open(str(self.dirname + "/gnu_plot_input.txt"),"wb") gnu_plot_input_file.write( "set term png\n" + - "set output \"max_disp_z.png\"\n"+ + "set output \"" + filename + ".png\"\n"+ "set surface\n" + "set grid\n"+ "set hidden3d\n"+ "set dgrid3d " + str(len(list)-1) + "," + str(len(list)-1) + ",100\n" + "set view 80,05,1.3,1.0\n"+ - "set title \"Abs Displacement in Z vs. Z-Level Offset and Rotation around Z-Axis\" 0,-2\n"+ + "set title \"" + title + "\" offset 0,-2\n"+ "show title\n"+ - "set pm3d\n"+ - "set label \"L Coefficients used for the calculation:" + lc_coeff[0] + "," + lc_coeff[1] + "," + lc_coeff[2] + "," + lc_coeff[3] + "," + lc_coeff[4] + "," + lc_coeff[5][:-1] + "\" at screen 0.1, screen 0.95 left\n"+ - "set label \"LT Coefficients used for the calculation:" + ltc_coeff[0] + "," + ltc_coeff[1] + "," + ltc_coeff[2] + "," + ltc_coeff[3] + "," + ltc_coeff[4] + "," + ltc_coeff[5][:-1] + "\" at screen 0.1, screen 0.93 left\n"+ - "set label \"Z-Offset\\nin [mm]\" at screen 0.5, screen 0.1 center rotate by 0\n"+ - "set label \"Rotation around Z-Axis\\nin [" + str(chr(248)) +"]\" at screen 0.91, screen 0.2 center rotate by 50\n"+ - "set label \"Max Displacement Z direction\\nin [mm]\" at screen 0.03, screen 0.5 center rotate by 90\n"+ - "set xtics nomirror\n"+ - "splot \"postprocessing_input.txt\" u 1:4:14 with pm3d title \"\"\n" + + "set label \"Fly to Buy Ratio = " + str( + "set label \"L Coefficients used for the calculation:" + lc_coeff[0] + "," + lc_coeff[1] + "," + lc_coeff[2] + "," + lc_coeff[3] + "," + lc_coeff[4] + "," + lc_coeff[5][:-1] + "\" at screen 0.1, screen 0.95 left font \"Arial,8\"\n"+ + "set label \"LT Coefficients used for the calculation:" + ltc_coeff[0] + "," + ltc_coeff[1] + "," + ltc_coeff[2] + "," + ltc_coeff[3] + "," + ltc_coeff[4] + "," + ltc_coeff[5][:-1] + "\" at screen 0.1, screen 0.93 left font \"Arial,8\"\n"+ + "set label \"" + x_axis_label + "\\nin [mm]\" at screen 0.5, screen 0.1 center rotate by 0\n"+ + "set label \"" + y_axis_label +"\\nin [" + str(chr(248)) +"]\" at screen 0.91, screen 0.2 center rotate by 50\n"+ + "set label \"" + z_axis_label + "\\nin [mm]\" at screen 0.03, screen 0.5 center rotate by 90\n"+ + "set xtics in nomirror offset character 0,-0.5\n"+ + "splot \"postprocessing_input.txt\" u " + str(offset_column) + ":" + str(rot_column) + ":" + str(abs_disp_column) + " with pm3d title \"\"\n" + "exit" ) - - - + gnu_plot_input_file.close() os.chdir(str(self.dirname)) fnull = open(os.devnull, 'w') - commandline = "gnuplot gnu_plot_input.txt" + commandline = FreeCAD.getHomePath() + "gnuplot gnu_plot_input.txt" result = subprocess.call(commandline, shell = True, stdout = fnull, stderr = fnull) fnull.close() - + self.button_start_postprocessing.setEnabled(False) + #Reset all radio buttons + self.check_rot_x.setChecked(False) + self.check_rot_y.setChecked(False) + self.check_rot_z.setChecked(False) + self.check_abs_disp_x.setChecked(False) + self.check_abs_disp_y.setChecked(False) + self.check_abs_disp_z.setChecked(False)