1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "guibrlcadimportdialogue.h"
22 #include "ui_guibrlcadimportdialogue.h"
27 GuiBrlCadImportDialogue::GuiBrlCadImportDialogue(QWidget
*parent
) :
29 ui(new Ui::GuiBrlCadImportDialogue
)
34 GuiBrlCadImportDialogue::~GuiBrlCadImportDialogue()
39 void GuiBrlCadImportDialogue::prepare(QString file_name
)
41 QString program
= "mged";
42 QStringList arguments
;
44 arguments
<< "-c" << file_name
<< "ls";
45 proc
.start(program
, arguments
);
46 proc
.waitForFinished();
47 QString output
= proc
.readAllStandardOutput() + proc
.readAllStandardError();
48 QStringList objects
= output
.split(QRegExp("\\s+"));
49 ui
->listWidget
->clear();
50 foreach (QString obj
, objects
) {
51 ui
->listWidget
->addItem(obj
);
53 m_StlFileName
= file_name
+ ".stl";
54 if (QFileInfo(m_StlFileName
).exists()) {
55 ui
->checkBoxSTL
->setEnabled(true);
56 ui
->checkBoxSTL
->setChecked(true);
60 bool GuiBrlCadImportDialogue::hasSelectedObject()
62 if (ui
->listWidget
->selectedItems().size() == 1) {
68 QString
GuiBrlCadImportDialogue::selectedObject()
70 if (hasSelectedObject()) {
71 QString object_txt
= ui
->listWidget
->selectedItems().first()->text();
72 QString object
= object_txt
.split("/").first();
79 double GuiBrlCadImportDialogue::scanMemory()
83 mem
*= ui
->doubleSpinBoxMemory
->value();
87 int GuiBrlCadImportDialogue::smoothingIterations()
89 return ui
->spinBoxSmoothing
->value();
92 int GuiBrlCadImportDialogue::preservationType()
94 if (ui
->radioButtonNoPreservation
->isChecked()) return 0;
95 if (ui
->radioButtonSolidPreservation
->isChecked()) return 1;
99 double GuiBrlCadImportDialogue::smallestFeatureSize()
101 return ui
->lineEditSmallestFeature
->text().toDouble();
104 double GuiBrlCadImportDialogue::smallestResolution()
106 return ui
->lineEditMinResolution
->text().toDouble();
109 bool GuiBrlCadImportDialogue::useStlFile()
111 return ui
->checkBoxSTL
->isChecked();
114 QString
GuiBrlCadImportDialogue::stlFileName()
116 return m_StlFileName
;
119 double GuiBrlCadImportDialogue::reduction()
121 return 0.01*double(ui
->horizontalSliderReduction
->value());