diff --git a/src/Mod/Fem/App/AppFem.cpp b/src/Mod/Fem/App/AppFem.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/AppFemPy.cpp b/src/Mod/Fem/App/AppFemPy.cpp old mode 100644 new mode 100755 index 838a5aeab..9bb9cead4 --- a/src/Mod/Fem/App/AppFemPy.cpp +++ b/src/Mod/Fem/App/AppFemPy.cpp @@ -150,7 +150,82 @@ static PyObject * SMESH_PCA(PyObject *self, PyObject *args) Base::Matrix4D Trafo = pca.Transform(); /*Let´s transform the input mesh with the PCA Matrix*/ inputMesh->getFemMeshPtr()->transformGeometry(Trafo); - //inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/PCA_alignment.unv"); + //inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/Temp/PCA_alignment.unv"); + //Now lets check if the smallest dimension of the BBox is oriented towards the Z-Axis. If not, lets rotate it around the X or Y axis + //Use the SMESH structure for that + // aMesh.Transform(Trafo); + + //Base::Rotation rotatex,rotatey,rotatez; + //const Base::Vector3d rotate_axis_x(1.0,0.0,0.0),rotate_axis_y(0.0,1.0,0.0),rotate_axis_z(0.0,0.0,1.0); + //double bbox_length_x,bbox_length_y,bbox_length_z; + ////Rotate around the each axes and choose the settings for the min bbox + //Base::Matrix4D final_trafo; + //Base::BoundBox3f aBBox; + ////Get the current BBOX and look for the size + //aBBox = aMesh.GetBoundBox(); + //bbox_length_x = aBBox.LengthX();bbox_length_y = aBBox.LengthY();bbox_length_z = aBBox.LengthZ(); + ////Now do the rotation stuff + //if (bbox_length_z < bbox_length_x && bbox_length_z < bbox_length_y) + // Py_Return; + //else if ( + + + //MeshCore::MeshKernel atempkernel; + + //float it_steps=10.0; + //double step_size; + //double alpha_x=0.0,alpha_y=0.0,alpha_z=0.0; + //double perfect_ax=0.0,perfect_ay=0.0,perfect_az=0.0; + + ////Do a Monte Carlo approach and start from the Principal Axis System + ////and rotate +/- 60° around each axis in a first iteration + //double angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0, + // angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0, + // angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0; + + ////We rotate until we are 0.1° sure to be in the right position + //for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/3600.0);step_size=(2.0*PI/it_steps)) + //{ + // for(alpha_x=angle_range_min_x;alpha_xnext(); current_node.Set(float(aNode->X()),float(aNode->Y()),float(aNode->Z())); current_node = matrix * current_node; - if(current_node.z > billet_thickness || current_node.z < 0.0) + if(current_node.z > billet_thickness || current_node.z < -0.1) { //lets jump out of the function as soon as we find a //Node that is higher or lower than billet thickness @@ -564,7 +639,7 @@ static PyObject * minBoundingBox(PyObject *self, PyObject *args) float(0.0),float(0.0),float(0.0),float(1.0)); inputMesh->getFemMeshPtr()->transformGeometry(trans_matrix); - //inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/fine_tuning.unv"); + //inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/temp/fine_tuning.unv"); } PY_CATCH; diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp old mode 100644 new mode 100755 index a3c98e586..13f2a9f81 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -58,9 +58,13 @@ #include #include +//to simplify parsing input files we use the boost lib +#include + using namespace Fem; using namespace Base; +using namespace boost; TYPESYSTEM_SOURCE(Fem::FemMesh , Base::Persistence); @@ -374,23 +378,32 @@ void FemMesh::readNastran(const std::string &Filename) inputfile.open(Filename.c_str()); inputfile.seekg(std::ifstream::beg); std::string line1,line2,temp; + std::vector token_results; + token_results.clear(); Base::Vector3d current_node; std::vector vertices; vertices.clear(); + std::vector nodal_id; + nodal_id.clear(); std::vector tetra_element; std::vector > all_elements; std::vector element_id; element_id.clear(); + bool nastran_free_format = false; do { std::getline(inputfile,line1); if (line1.size() == 0) continue; - if (line1.find("GRID*")!= std::string::npos) //We found a Grid line + if (!nastran_free_format && line1.find(",")!= std::string::npos) + nastran_free_format = true; + if (!nastran_free_format && line1.find("GRID*")!= std::string::npos ) //We found a Grid line { //Now lets extract the GRID Points = Nodes //As each GRID Line consists of two subsequent lines we have to //take care of that as well std::getline(inputfile,line2); + //Get the Nodal ID + nodal_id.push_back(atoi(line1.substr(8,24).c_str())); //Extract X Value current_node.x = atof(line1.substr(40,56).c_str()); //Extract Y Value @@ -400,7 +413,7 @@ void FemMesh::readNastran(const std::string &Filename) vertices.push_back(current_node); } - else if (line1.find("CTETRA")!= std::string::npos) + else if (!nastran_free_format && line1.find("CTETRA")!= std::string::npos) { tetra_element.clear(); //Lets extract the elements @@ -422,6 +435,46 @@ void FemMesh::readNastran(const std::string &Filename) all_elements.push_back(tetra_element); } + else if (nastran_free_format && line1.find("GRID")!= std::string::npos ) //We found a Grid line + { + char_separator sep(","); + tokenizer > tokens(line1, sep); + token_results.assign(tokens.begin(),tokens.end()); + if (token_results.size() < 3) + continue;//Line does not include Nodal coordinates + nodal_id.push_back(atoi(token_results[1].c_str())); + current_node.x = atof(token_results[3].c_str()); + current_node.y = atof(token_results[4].c_str()); + current_node.z = atof(token_results[5].c_str()); + vertices.push_back(current_node); + } + else if (nastran_free_format && line1.find("CTETRA")!= std::string::npos) + { + tetra_element.clear(); + //Lets extract the elements + //As each Element Line consists of two subsequent lines as well + //we have to take care of that + //At a first step we only extract Quadratic Tetrahedral Elements + std::getline(inputfile,line2); + char_separator sep(","); + tokenizer > tokens(line1.append(line2), sep); + token_results.assign(tokens.begin(),tokens.end()); + if (token_results.size() < 11) + continue;//Line does not include enough nodal IDs + element_id.push_back(atoi(token_results[1].c_str())); + tetra_element.push_back(atoi(token_results[3].c_str())); + tetra_element.push_back(atoi(token_results[4].c_str())); + tetra_element.push_back(atoi(token_results[5].c_str())); + tetra_element.push_back(atoi(token_results[6].c_str())); + tetra_element.push_back(atoi(token_results[7].c_str())); + tetra_element.push_back(atoi(token_results[8].c_str())); + tetra_element.push_back(atoi(token_results[10].c_str())); + tetra_element.push_back(atoi(token_results[11].c_str())); + tetra_element.push_back(atoi(token_results[12].c_str())); + tetra_element.push_back(atoi(token_results[13].c_str())); + + all_elements.push_back(tetra_element); + } } while (inputfile.good()); @@ -431,10 +484,10 @@ void FemMesh::readNastran(const std::string &Filename) std::vector::const_iterator anodeiterator; SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS(); meshds->ClearMesh(); - int j=1; + unsigned int j=0; for(anodeiterator=vertices.begin(); anodeiterator!=vertices.end(); anodeiterator++) { - meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,j); + meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,nodal_id[j]); j++; } @@ -442,7 +495,8 @@ void FemMesh::readNastran(const std::string &Filename) { //Die Reihenfolge wie hier die Elemente hinzugefügt werden ist sehr wichtig. //Ansonsten ist eine konsistente Datenstruktur nicht möglich - meshds->AddVolumeWithID( + meshds->AddVolumeWithID + ( meshds->FindNode(all_elements[i][0]), meshds->FindNode(all_elements[i][2]), meshds->FindNode(all_elements[i][1]), @@ -458,6 +512,7 @@ void FemMesh::readNastran(const std::string &Filename) } } + void FemMesh::read(const char *FileName) { Base::FileInfo File(FileName); diff --git a/src/Mod/Fem/App/FemMesh.h b/src/Mod/Fem/App/FemMesh.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshObject.cpp b/src/Mod/Fem/App/FemMeshObject.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshObject.h b/src/Mod/Fem/App/FemMeshObject.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshProperty.cpp b/src/Mod/Fem/App/FemMeshProperty.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshProperty.h b/src/Mod/Fem/App/FemMeshProperty.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/HypothesisPy.cpp b/src/Mod/Fem/App/HypothesisPy.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/HypothesisPy.h b/src/Mod/Fem/App/HypothesisPy.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/Makefile.am b/src/Mod/Fem/App/Makefile.am old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/PreCompiled.cpp b/src/Mod/Fem/App/PreCompiled.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/App/PreCompiled.h b/src/Mod/Fem/App/PreCompiled.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/FemExample.py b/src/Mod/Fem/FemExample.py old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/AppFemGuiPy.cpp b/src/Mod/Fem/Gui/AppFemGuiPy.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Makefile.am b/src/Mod/Fem/Gui/Makefile.am old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/PreCompiled.cpp b/src/Mod/Fem/Gui/PreCompiled.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/PreCompiled.h b/src/Mod/Fem/Gui/PreCompiled.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/Fem.qrc b/src/Mod/Fem/Gui/Resources/Fem.qrc old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/Makefile.am b/src/Mod/Fem/Gui/Resources/Makefile.am old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/UpdateResources.bat b/src/Mod/Fem/Gui/Resources/UpdateResources.bat old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/icons/Fem_FemMesh.svg b/src/Mod/Fem/Gui/Resources/icons/Fem_FemMesh.svg old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_af.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_af.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_af.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_af.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_de.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_de.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_de.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_de.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_es.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_es.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_es.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_es.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_fi.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_fi.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_fi.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_fi.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_fr.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_fr.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_fr.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_fr.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_hr.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_hr.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_hr.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_hr.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_hu.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_hu.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_hu.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_hu.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_it.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_it.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_it.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_it.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_ja.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_ja.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_ja.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_ja.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_nl.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_nl.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_nl.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_nl.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_no.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_no.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_no.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_no.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_pl.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_pl.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_pl.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_pl.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_pt.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_pt.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_pt.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_pt.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_ru.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_ru.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_se.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_se.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_se.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_se.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_uk.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_uk.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_uk.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_uk.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_zh.qm b/src/Mod/Fem/Gui/Resources/translations/Fem_zh.qm old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_zh.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_zh.ts old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.h b/src/Mod/Fem/Gui/ViewProviderFemMesh.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Gui/Workbench.h b/src/Mod/Fem/Gui/Workbench.h old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Init.py b/src/Mod/Fem/Init.py old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/InitGui.py b/src/Mod/Fem/InitGui.py old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/Makefile.am b/src/Mod/Fem/Makefile.am old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/convert2TetGen.py b/src/Mod/Fem/convert2TetGen.py old mode 100644 new mode 100755 diff --git a/src/Mod/Fem/fem.dox b/src/Mod/Fem/fem.dox old mode 100644 new mode 100755 diff --git a/src/Mod/Machining_Distortion/postprocess.py b/src/Mod/Machining_Distortion/postprocess.py index 79fa4a9d7..250c81414 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 f4d23a117..fdd46ed19 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 b6c6392a3..cf5d3ef19 100755 --- a/src/Mod/Machining_Distortion/postprocess_gui.py +++ b/src/Mod/Machining_Distortion/postprocess_gui.py @@ -102,34 +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 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 \"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 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 1:4:14 with pm3d title \"\"\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 = FreeCAD.getHomePath() + "bin/gnuplot/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)