Skip to content

Commit

Permalink
Part: offer all supported STEP schemes by OCC in a combo box
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Feb 2, 2021
1 parent 078160e commit 7a83853
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 43 deletions.
9 changes: 4 additions & 5 deletions src/Mod/Import/Gui/AppImportGuiPy.cpp
Expand Up @@ -642,11 +642,10 @@ class Module : public Py::ExtensionModule<Module>
Base::FileInfo file(Utf8Name.c_str());
if (file.hasExtension("stp") || file.hasExtension("step")) {
ParameterGrp::handle hGrp_stp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part/STEP");
std::string scheme = hGrp_stp->GetASCII("Scheme", "AP214IS");
if (scheme == "AP203")
Interface_Static::SetCVal("write.step.schema", "AP203");
else if (scheme == "AP214IS")
Interface_Static::SetCVal("write.step.schema", "AP214IS");
std::string scheme = hGrp_stp->GetASCII("Scheme", Interface_Static::CVal("write.step.schema"));
std::list<std::string> supported = Part::supportedSTEPSchemes();
if (std::find(supported.begin(), supported.end(), scheme) != supported.end())
Interface_Static::SetCVal("write.step.schema", scheme.c_str());

STEPCAFControl_Writer writer;
Interface_Static::SetIVal("write.step.assembly",1);
Expand Down
10 changes: 9 additions & 1 deletion src/Mod/Part/App/ImportStep.h
Expand Up @@ -41,7 +41,15 @@ namespace Part
*/
PartExport int ImportStepParts(App::Document *pcDoc, const char* Name);


inline std::list<std::string> supportedSTEPSchemes() {
std::list<std::string> schemes;
schemes.emplace_back("AP203");
schemes.emplace_back("AP214CD");
schemes.emplace_back("AP214DIS");
schemes.emplace_back("AP214IS");
schemes.emplace_back("AP242DIS");
return schemes;
}

} //namespace Part

Expand Down
50 changes: 30 additions & 20 deletions src/Mod/Part/Gui/DlgImportExportStep.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>637</height>
<height>699</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -27,20 +27,32 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButtonAP203">
<property name="text">
<string notr="true">AP 203</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="radioButtonAP214">
<property name="text">
<string notr="true">AP 214</string>
</property>
<widget class="QComboBox" name="comboBoxSchema">
<item>
<property name="text">
<string notr="true">AP203</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">AP214 Committee Draft</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">AP214 Draft International Standard</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">AP214 International Standard</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">AP242 Draft International Standard</string>
</property>
</item>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -113,12 +125,12 @@
<property name="text">
<string>Use legacy exporter</string>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Import</cstring>
</property>
<property name="prefEntry" stdset="0">
<cstring>ExportLegacy</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Import</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
Expand Down Expand Up @@ -393,8 +405,6 @@ during file reading (slower but higher details).</string>
<tabstop>comboBoxUnits</tabstop>
<tabstop>checkBoxPcurves</tabstop>
<tabstop>checkBoxExportHiddenObj</tabstop>
<tabstop>radioButtonAP203</tabstop>
<tabstop>radioButtonAP214</tabstop>
<tabstop>checkBoxMergeCompound</tabstop>
<tabstop>checkBoxUseLinkGroup</tabstop>
<tabstop>checkBoxImportHiddenObj</tabstop>
Expand Down
34 changes: 17 additions & 17 deletions src/Mod/Part/Gui/DlgSettingsGeneral.cpp
Expand Up @@ -197,9 +197,16 @@ DlgImportExportStep::DlgImportExportStep(QWidget* parent)
{
ui = new Ui_DlgImportExportStep();
ui->setupUi(this);

ui->comboBoxSchema->setItemData(0, QByteArray("AP203"));
ui->comboBoxSchema->setItemData(1, QByteArray("AP214CD"));
ui->comboBoxSchema->setItemData(2, QByteArray("AP214DIS"));
ui->comboBoxSchema->setItemData(3, QByteArray("AP214IS"));
ui->comboBoxSchema->setItemData(4, QByteArray("AP242DIS"));

ui->lineEditProduct->setReadOnly(true);
ui->radioButtonAP203->setToolTip(tr("Configuration controlled 3D designs of mechanical parts and assemblies"));
ui->radioButtonAP214->setToolTip(tr("Core data for automotive mechanical design processes"));
//ui->radioButtonAP203->setToolTip(tr("Configuration controlled 3D designs of mechanical parts and assemblies"));
//ui->radioButtonAP214->setToolTip(tr("Core data for automotive mechanical design processes"));

// https://tracker.dev.opencascade.org/view.php?id=25654
ui->checkBoxPcurves->setToolTip(tr("This parameter indicates whether parametric curves (curves in parametric space of surface)\n"
Expand Down Expand Up @@ -253,15 +260,10 @@ void DlgImportExportStep::saveSettings()
}

// scheme
if (ui->radioButtonAP203->isChecked()) {
Interface_Static::SetCVal("write.step.schema","AP203");
hStepGrp->SetASCII("Scheme", "AP203");
}
else {
// possible values: AP214CD (1996), AP214DIS (1998), AP214IS (2002)
Interface_Static::SetCVal("write.step.schema","AP214IS");
hStepGrp->SetASCII("Scheme", "AP214IS");
}
// possible values: AP214CD (1996), AP214DIS (1998), AP214IS (2002), AP242DIS
QByteArray schema = ui->comboBoxSchema->itemData(ui->comboBoxSchema->currentIndex()).toByteArray();
Interface_Static::SetCVal("write.step.schema",schema);
hStepGrp->SetASCII("Scheme", schema);

// header info
hStepGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
Expand Down Expand Up @@ -299,12 +301,10 @@ void DlgImportExportStep::loadSettings()
ui->comboBoxUnits->setCurrentIndex(unit);

// scheme
QString ap = QString::fromStdString(hStepGrp->GetASCII("Scheme",
Interface_Static::CVal("write.step.schema")));
if (ap.startsWith(QLatin1String("AP203")))
ui->radioButtonAP203->setChecked(true);
else
ui->radioButtonAP214->setChecked(true);
QByteArray ap(hStepGrp->GetASCII("Scheme", Interface_Static::CVal("write.step.schema")).c_str());
int index = ui->comboBoxSchema->findData(QVariant(ap));
if (index >= 0)
ui->comboBoxSchema->setCurrentIndex(index);

// header info
ui->lineEditCompany->setText(QString::fromStdString(hStepGrp->GetASCII("Company")));
Expand Down

0 comments on commit 7a83853

Please sign in to comment.