Merge branch 'dvdjimmy/MachDist'

This commit is contained in:
Joachim Zettler 2012-08-20 21:56:42 +02:00
commit 72ddca1579
75 changed files with 378 additions and 242 deletions

0
src/Mod/Fem/App/AppFem.cpp Normal file → Executable file
View File

81
src/Mod/Fem/App/AppFemPy.cpp Normal file → Executable file
View File

@ -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_x<angle_range_max_x;alpha_x=alpha_x+step_size)
// {
// rotatex.setValue(rotate_axis_x,alpha_x);
// for(alpha_y=angle_range_min_y;alpha_y<angle_range_max_y;alpha_y=alpha_y+step_size)
// {
// rotatey.setValue(rotate_axis_y,alpha_y);
// for(alpha_z=angle_range_min_z;alpha_z<angle_range_max_z;alpha_z=alpha_z+step_size)
// {
// rotatez.setValue(rotate_axis_z,alpha_z);
// (rotatex*rotatey*rotatez).getValue(final_trafo);
// atempkernel = aMesh;
} PY_CATCH;
Py_Return;
@ -317,7 +392,7 @@ static PyObject * checkBB(PyObject *self, PyObject *args)
const SMDS_MeshNode* aNode = aNodeIter->next();
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;

0
src/Mod/Fem/App/CMakeLists.txt Normal file → Executable file
View File

65
src/Mod/Fem/App/FemMesh.cpp Normal file → Executable file
View File

@ -58,9 +58,13 @@
#include <StdMeshers_Quadrangle_2D.hxx>
#include <StdMeshers_QuadraticMesh.hxx>
//to simplify parsing input files we use the boost lib
#include <boost/tokenizer.hpp>
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<string> token_results;
token_results.clear();
Base::Vector3d current_node;
std::vector<Base::Vector3d> vertices;
vertices.clear();
std::vector<unsigned int> nodal_id;
nodal_id.clear();
std::vector<unsigned int> tetra_element;
std::vector<std::vector<unsigned int> > all_elements;
std::vector<unsigned int> 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<char> sep(",");
tokenizer<char_separator<char> > 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<char> sep(",");
tokenizer<char_separator<char> > 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<Base::Vector3d>::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);

0
src/Mod/Fem/App/FemMesh.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshObject.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshObject.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshProperty.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshProperty.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshPy.xml Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshPyImp.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/HypothesisPy.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/HypothesisPy.h Normal file → Executable file
View File

0
src/Mod/Fem/App/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/App/PreCompiled.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/PreCompiled.h Normal file → Executable file
View File

0
src/Mod/Fem/CMakeLists.txt Normal file → Executable file
View File

0
src/Mod/Fem/FemExample.py Normal file → Executable file
View File

0
src/Mod/Fem/Gui/AppFemGui.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/AppFemGuiPy.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/CMakeLists.txt Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Command.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/Gui/PreCompiled.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/PreCompiled.h Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/Fem.qrc Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/UpdateResources.bat Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/icons/Fem_FemMesh.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

0
src/Mod/Fem/Gui/Resources/translations/Fem_af.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_af.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_de.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_de.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_es.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_es.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fi.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fi.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fr.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fr.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hr.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hr.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hu.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hu.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_it.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_it.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ja.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ja.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_nl.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_nl.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_no.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_no.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pl.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pl.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pt.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pt.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ru.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_se.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_se.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_uk.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_uk.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_zh.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_zh.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/ViewProviderFemMesh.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/ViewProviderFemMesh.h Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Workbench.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Workbench.h Normal file → Executable file
View File

0
src/Mod/Fem/Init.py Normal file → Executable file
View File

0
src/Mod/Fem/InitGui.py Normal file → Executable file
View File

0
src/Mod/Fem/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/convert2TetGen.py Normal file → Executable file
View File

0
src/Mod/Fem/fem.dox Normal file → Executable file
View File

View File

@ -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))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<height>170</height>
<width>425</width>
<height>240</height>
</rect>
</property>
<property name="sizePolicy">
@ -26,164 +26,7 @@
<string>Machining Distortion Prediction</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Output Elements</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="check_fly_to_buy_7">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Max Displacement X</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="check_fly_to_buy_4">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Min Displacement X</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="check_fly_to_buy_8">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Max Displacement Y</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="check_fly_to_buy_2">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Min Displacement Y</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="check_fly_to_buy_5">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Max Displacement Z</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="check_fly_to_buy_3">
<property name="minimumSize">
<size>
<width>148</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Min Displacement Z</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -193,14 +36,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QPushButton" name="button_select_results_folder">
<property name="text">
<string>Select Results Folder</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QPushButton" name="button_start_postprocessing">
<property name="enabled">
<bool>false</bool>
@ -216,6 +59,118 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Select Z-Axis</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="check_abs_disp_x">
<property name="text">
<string>Absolute Displacement X</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="check_abs_disp_y">
<property name="text">
<string>Absolute Displacement Y</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="check_abs_disp_z">
<property name="text">
<string>Absolute Displacement Z</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Select Y-Axis</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="check_rot_x">
<property name="text">
<string>Rotation around X-Axis</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>33</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="check_rot_y">
<property name="text">
<string>Rotation around Y-Axis</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>34</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="check_rot_z">
<property name="text">
<string>Rotation around Z-Axis</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -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)