diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index aca225538..8b1accbab 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -39,6 +39,8 @@ # include # include # include +# include +# include # include # include # include @@ -247,6 +249,11 @@ static PyObject * exporter(PyObject *self, PyObject *args) else if (file.hasExtension("igs") || file.hasExtension("iges")) { IGESControl_Controller::Init(); IGESCAFControl_Writer writer; + IGESData_GlobalSection header = writer.Model()->GlobalSection(); + header.SetAuthorName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.author"))); + header.SetCompanyName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.company"))); + //header.SetSendName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product"))); + writer.Model()->SetGlobalSection(header); writer.Transfer(hDoc); Standard_Boolean ret = writer.Write(name8bit.c_str()); if (!ret) { diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index ee75390d6..402c4de0f 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -50,6 +50,8 @@ # include # include # include +# include +# include # include # include # include @@ -271,6 +273,11 @@ static PyObject * exporter(PyObject *self, PyObject *args) else if (file.hasExtension("igs") || file.hasExtension("iges")) { IGESControl_Controller::Init(); IGESCAFControl_Writer writer; + IGESData_GlobalSection header = writer.Model()->GlobalSection(); + header.SetAuthorName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.author"))); + header.SetCompanyName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.company"))); + //header.SetSendName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product"))); + writer.Model()->SetGlobalSection(header); writer.Transfer(hDoc); Standard_Boolean ret = writer.Write((const char*)name8bit.c_str()); if (!ret) { diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index 596cceb24..52ac22129 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -284,14 +284,20 @@ void PartExport initPart() IGESControl_Controller::Init(); STEPControl_Controller::Init(); - // set the user-defined units + // set the user-defined settings Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - 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); + //IGES handling + Base::Reference hIgesGrp = hGrp->GetGroup("IGES"); + int value = Interface_Static::IVal("write.iges.brep.mode"); + bool brep = hIgesGrp->GetBool("BrepMode", value > 0); + Interface_Static::SetIVal("write.iges.brep.mode",brep ? 1 : 0); + Interface_Static::SetCVal("write.iges.header.company", hIgesGrp->GetASCII("Company").c_str()); + Interface_Static::SetCVal("write.iges.header.author", hIgesGrp->GetASCII("Author").c_str()); + //Interface_Static::SetCVal("write.iges.header.product", hIgesGrp->GetASCII("Product").c_str()); + + int unitIges = hIgesGrp->GetInt("Unit", 0); switch (unitIges) { case 1: Interface_Static::SetCVal("write.iges.unit","M"); @@ -304,7 +310,9 @@ void PartExport initPart() break; } - int unitStep = hGrp->GetInt("UnitStep", 0); + //STEP handling + Base::Reference hStepGrp = hGrp->GetGroup("STEP"); + int unitStep = hStepGrp->GetInt("Unit", 0); switch (unitStep) { case 1: Interface_Static::SetCVal("write.step.unit","M"); diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index a7ca52187..a425cab2f 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -98,6 +98,8 @@ # include # include # include +# include +# include # include # include # include @@ -695,6 +697,11 @@ void TopoShape::exportIges(const char *filename) const // write iges file IGESControl_Controller::Init(); IGESControl_Writer aWriter; + IGESData_GlobalSection header = aWriter.Model()->GlobalSection(); + header.SetAuthorName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.author"))); + header.SetCompanyName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.company"))); + //header.SetSendName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product"))); + aWriter.Model()->SetGlobalSection(header); aWriter.AddShape(this->_Shape); aWriter.ComputeModel(); if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone) diff --git a/src/Mod/Part/Gui/DlgImportExportIges.ui b/src/Mod/Part/Gui/DlgImportExportIges.ui index 7d19d6a31..07cbfa859 100644 --- a/src/Mod/Part/Gui/DlgImportExportIges.ui +++ b/src/Mod/Part/Gui/DlgImportExportIges.ui @@ -85,26 +85,26 @@ - + Product - + - + + + + Author - - - @@ -123,6 +123,13 @@ + + comboBoxUnits + checkBrepMode + lineEditCompany + lineEditAuthor + lineEditProduct + diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp index 000b6d95a..93c68bdc8 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp @@ -87,7 +87,7 @@ DlgImportExportIges::DlgImportExportIges(QWidget* parent) { ui = new Ui_DlgImportExportIges(); ui->setupUi(this); - ui->groupBoxHeader->hide(); + ui->lineEditProduct->setReadOnly(true); } /** @@ -103,8 +103,8 @@ void DlgImportExportIges::saveSettings() { int unit = ui->comboBoxUnits->currentIndex(); Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - hGrp->SetInt("UnitIges", unit); + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES"); + hGrp->SetInt("Unit", unit); switch (unit) { case 1: Interface_Static::SetCVal("write.iges.unit","M"); @@ -121,20 +121,20 @@ void DlgImportExportIges::saveSettings() Interface_Static::SetIVal("write.iges.brep.mode",ui->checkBrepMode->isChecked() ? 1 : 0); // header info - //hGrp->SetASCII("CompanyIges", ui->lineEditCompany->text().toLatin1()); - //hGrp->SetASCII("ProductIges", ui->lineEditProduct->text().toLatin1()); - //hGrp->SetASCII("AuthorIges", ui->lineEditAuthor->text().toLatin1()); + hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1()); + hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1()); + hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1()); - //Interface_Static::SetCVal("write.iges.header.company", ui->lineEditCompany->text().toLatin1()); - //Interface_Static::SetCVal("write.iges.header.product", ui->lineEditProduct->text().toLatin1()); - //Interface_Static::SetCVal("write.iges.header.author", ui->lineEditAuthor->text().toLatin1()); + Interface_Static::SetCVal("write.iges.header.company", ui->lineEditCompany->text().toLatin1()); + Interface_Static::SetCVal("write.iges.header.author", ui->lineEditAuthor->text().toLatin1()); + //Interface_Static::SetCVal("write.iges.header.product", ui->lineEditProduct->text().toLatin1()); } void DlgImportExportIges::loadSettings() { Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - int unit = hGrp->GetInt("UnitIges", 0); + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES"); + int unit = hGrp->GetInt("Unit", 0); ui->comboBoxUnits->setCurrentIndex(unit); int value = Interface_Static::IVal("write.iges.brep.mode"); @@ -142,9 +142,13 @@ void DlgImportExportIges::loadSettings() ui->checkBrepMode->setChecked(brep); // header info - //ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("CompanyIges"))); - //ui->lineEditProduct->setText(QString::fromStdString(hGrp->GetASCII("ProductIges"))); - //ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("AuthorIges"))); + ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("Company", + Interface_Static::CVal("write.iges.header.company")))); + ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("Author", + Interface_Static::CVal("write.iges.header.author")))); + //ui->lineEditProduct->setText(QString::fromStdString(hGrp->GetASCII("Product"))); + ui->lineEditProduct->setText(QString::fromLatin1( + Interface_Static::CVal("write.iges.header.product"))); } /** @@ -182,8 +186,8 @@ void DlgImportExportStep::saveSettings() { int unit = ui->comboBoxUnits->currentIndex(); Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - hGrp->SetInt("UnitStep", unit); + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP"); + hGrp->SetInt("Unit", unit); switch (unit) { case 1: Interface_Static::SetCVal("write.step.unit","M"); @@ -200,8 +204,8 @@ void DlgImportExportStep::saveSettings() void DlgImportExportStep::loadSettings() { Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part"); - int unit = hGrp->GetInt("UnitStep", 0); + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP"); + int unit = hGrp->GetInt("Unit", 0); ui->comboBoxUnits->setCurrentIndex(unit); }