+ split STEP and IGES settings into separate pages, handle Brep mode of IGES format

This commit is contained in:
wmayer 2014-10-28 19:27:23 +01:00
parent 9256de8c1a
commit c67f326174
8 changed files with 360 additions and 84 deletions

View File

@ -287,18 +287,32 @@ void PartExport initPart()
// set the user-defined units
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
int unit = hGrp->GetInt("Unit", 0);
switch (unit) {
int value = Interface_Static::IVal("write.iges.brep.mode");
bool brep = hGrp->GetBool("BrepMode", value > 0);
Interface_Static::SetIVal("write.iges.brep.mode",brep ? 1 : 0);
int unitIges = hGrp->GetInt("UnitIges", 0);
switch (unitIges) {
case 1:
Interface_Static::SetCVal("write.iges.unit","M");
Interface_Static::SetCVal("write.step.unit","M");
break;
case 2:
Interface_Static::SetCVal("write.iges.unit","IN");
Interface_Static::SetCVal("write.step.unit","IN");
break;
default:
Interface_Static::SetCVal("write.iges.unit","MM");
break;
}
int unitStep = hGrp->GetInt("UnitStep", 0);
switch (unitStep) {
case 1:
Interface_Static::SetCVal("write.step.unit","M");
break;
case 2:
Interface_Static::SetCVal("write.step.unit","IN");
break;
default:
Interface_Static::SetCVal("write.step.unit","MM");
break;
}

View File

@ -5,7 +5,7 @@
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* J<EFBFBD>rgen Riegel 2002 *
* Juergen Riegel 2002 *
* *
***************************************************************************/
@ -160,6 +160,8 @@ void PartGuiExport initPartGui()
// register preferences pages
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsGeneral> ( QT_TRANSLATE_NOOP("QObject","Part design") );
(void)new Gui::PrefPageProducer<PartGui::DlgSettings3DViewPart> ( QT_TRANSLATE_NOOP("QObject","Part design") );
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportIges> ( QT_TRANSLATE_NOOP("QObject","Import-Export") );
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportStep> ( QT_TRANSLATE_NOOP("QObject","Import-Export") );
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsObjectColor> ( QT_TRANSLATE_NOOP("QObject","Display") );
Gui::ViewProviderBuilder::add(
Part::PropertyPartShape::getClassTypeId(),

View File

@ -59,6 +59,8 @@ set(PartGui_UIC_SRCS
DlgBooleanOperation.ui
DlgExtrusion.ui
DlgFilletEdges.ui
DlgImportExportIges.ui
DlgImportExportStep.ui
DlgPartBox.ui
DlgPartCylinder.ui
DlgPartImportIges.ui
@ -99,6 +101,8 @@ SET(PartGui_SRCS
DlgFilletEdges.cpp
DlgFilletEdges.h
DlgFilletEdges.ui
DlgImportExportIges.ui
DlgImportExportStep.ui
DlgPartBox.ui
DlgPartBoxImp.cpp
DlgPartBoxImp.h

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PartGui::DlgImportExportIges</class>
<widget class="QWidget" name="PartGui::DlgImportExportIges">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>445</width>
<height>187</height>
</rect>
</property>
<property name="windowTitle">
<string>IGES</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Export</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Units for export of IGES</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxUnits">
<item>
<property name="text">
<string>Millimeter</string>
</property>
</item>
<item>
<property name="text">
<string>Meter</string>
</property>
</item>
<item>
<property name="text">
<string>Inch</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="checkBrepMode">
<property name="text">
<string>Enable B-REP mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>82</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PartGui::DlgImportExportStep</class>
<widget class="QWidget" name="PartGui::DlgImportExportStep">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>445</width>
<height>187</height>
</rect>
</property>
<property name="windowTitle">
<string>STEP</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Export</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Units for export of STEP</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxUnits">
<item>
<property name="text">
<string>Millimeter</string>
</property>
</item>
<item>
<property name="text">
<string>Meter</string>
</property>
</item>
<item>
<property name="text">
<string>Inch</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>82</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -30,6 +30,8 @@
#include "DlgSettingsGeneral.h"
#include "ui_DlgSettingsGeneral.h"
#include "ui_DlgImportExportIges.h"
#include "ui_DlgImportExportStep.h"
using namespace PartGui;
@ -51,24 +53,6 @@ DlgSettingsGeneral::~DlgSettingsGeneral()
void DlgSettingsGeneral::saveSettings()
{
int unit = ui->comboBoxUnits->currentIndex();
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
hGrp->SetInt("Unit", unit);
switch (unit) {
case 1:
Interface_Static::SetCVal("write.iges.unit","M");
Interface_Static::SetCVal("write.step.unit","M");
break;
case 2:
Interface_Static::SetCVal("write.iges.unit","IN");
Interface_Static::SetCVal("write.step.unit","IN");
break;
default:
Interface_Static::SetCVal("write.iges.unit","MM");
Interface_Static::SetCVal("write.step.unit","MM");
break;
}
ui->checkBooleanCheck->onSave();
ui->checkBooleanRefine->onSave();
ui->checkSketchBaseRefine->onSave();
@ -77,10 +61,6 @@ void DlgSettingsGeneral::saveSettings()
void DlgSettingsGeneral::loadSettings()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
int unit = hGrp->GetInt("Unit", 0);
ui->comboBoxUnits->setCurrentIndex(unit);
ui->checkBooleanCheck->onRestore();
ui->checkBooleanRefine->onRestore();
ui->checkSketchBaseRefine->onRestore();
@ -99,5 +79,128 @@ void DlgSettingsGeneral::changeEvent(QEvent *e)
QWidget::changeEvent(e);
}
}
#include "moc_DlgSettingsGeneral.cpp"
// ----------------------------------------------------------------------------
DlgImportExportIges::DlgImportExportIges(QWidget* parent)
: PreferencePage(parent)
{
ui = new Ui_DlgImportExportIges();
ui->setupUi(this);
}
/**
* Destroys the object and frees any allocated resources
*/
DlgImportExportIges::~DlgImportExportIges()
{
// no need to delete child widgets, Qt does it all for us
delete ui;
}
void DlgImportExportIges::saveSettings()
{
int unit = ui->comboBoxUnits->currentIndex();
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
hGrp->SetInt("UnitIges", unit);
switch (unit) {
case 1:
Interface_Static::SetCVal("write.iges.unit","M");
break;
case 2:
Interface_Static::SetCVal("write.iges.unit","IN");
break;
default:
Interface_Static::SetCVal("write.iges.unit","MM");
break;
}
hGrp->SetBool("BrepMode", ui->checkBrepMode->isChecked());
Interface_Static::SetIVal("write.iges.brep.mode",ui->checkBrepMode->isChecked() ? 1 : 0);
}
void DlgImportExportIges::loadSettings()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
int unit = hGrp->GetInt("UnitIges", 0);
ui->comboBoxUnits->setCurrentIndex(unit);
int value = Interface_Static::IVal("write.iges.brep.mode");
bool brep = hGrp->GetBool("BrepMode", value > 0);
ui->checkBrepMode->setChecked(brep);
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgImportExportIges::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
// ----------------------------------------------------------------------------
DlgImportExportStep::DlgImportExportStep(QWidget* parent)
: PreferencePage(parent)
{
ui = new Ui_DlgImportExportStep();
ui->setupUi(this);
}
/**
* Destroys the object and frees any allocated resources
*/
DlgImportExportStep::~DlgImportExportStep()
{
// no need to delete child widgets, Qt does it all for us
delete ui;
}
void DlgImportExportStep::saveSettings()
{
int unit = ui->comboBoxUnits->currentIndex();
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
hGrp->SetInt("UnitStep", unit);
switch (unit) {
case 1:
Interface_Static::SetCVal("write.step.unit","M");
break;
case 2:
Interface_Static::SetCVal("write.step.unit","IN");
break;
default:
Interface_Static::SetCVal("write.step.unit","MM");
break;
}
}
void DlgImportExportStep::loadSettings()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
int unit = hGrp->GetInt("UnitStep", 0);
ui->comboBoxUnits->setCurrentIndex(unit);
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgImportExportStep::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
#include "moc_DlgSettingsGeneral.cpp"

View File

@ -46,6 +46,42 @@ private:
Ui_DlgSettingsGeneral* ui;
};
class Ui_DlgImportExportIges;
class DlgImportExportIges : public Gui::Dialog::PreferencePage
{
Q_OBJECT
public:
DlgImportExportIges(QWidget* parent = 0);
~DlgImportExportIges();
protected:
void saveSettings();
void loadSettings();
void changeEvent(QEvent *e);
private:
Ui_DlgImportExportIges* ui;
};
class Ui_DlgImportExportStep;
class DlgImportExportStep : public Gui::Dialog::PreferencePage
{
Q_OBJECT
public:
DlgImportExportStep(QWidget* parent = 0);
~DlgImportExportStep();
protected:
void saveSettings();
void loadSettings();
void changeEvent(QEvent *e);
private:
Ui_DlgImportExportStep* ui;
};
} // namespace Gui
#endif // PARTGUI_DLGSETTINGSGENERAL_H

View File

@ -15,60 +15,6 @@
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Export</string>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxUnits">
<item>
<property name="text">
<string>Millimeter</string>
</property>
</item>
<item>
<property name="text">
<string>Meter</string>
</property>
</item>
<item>
<property name="text">
<string>Inch</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Units for export of STEP/IGES</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Model settings</string>
@ -116,7 +62,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Object naming</string>
@ -138,7 +84,7 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>