Part: offer all supported STEP schemes by OCC in a combo box

This commit is contained in:
wmayer
2021-02-02 21:51:11 +01:00
parent e947b9bb3b
commit d3e4da9f51
4 changed files with 60 additions and 43 deletions

View File

@@ -642,11 +642,10 @@ private:
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);

View File

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

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>637</height>
<height>699</height>
</rect>
</property>
<property name="windowTitle">
@@ -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>
@@ -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">
@@ -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>

View File

@@ -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"
@@ -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());
@@ -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")));