+ customize STEP header

This commit is contained in:
wmayer 2014-10-30 11:48:33 +01:00
parent f9e6efac2e
commit 92ebfab47a
4 changed files with 66 additions and 9 deletions

View File

@ -235,10 +235,13 @@ static PyObject * exporter(PyObject *self, PyObject *args)
#else
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
#endif
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)Utf8Name.c_str()));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Author", "Author").c_str()));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Company").c_str()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::GetApplication().getExecutableName()));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
IFSelect_ReturnStatus ret = writer.Write(name8bit.c_str());
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {

View File

@ -259,10 +259,13 @@ static PyObject * exporter(PyObject *self, PyObject *args)
#else
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
#endif
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)(Utf8Name.c_str())));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Author", "Author").c_str()));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Company").c_str()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::GetApplication().getExecutableName()));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
IFSelect_ReturnStatus ret = writer.Write((const char*)name8bit.c_str());
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {

View File

@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>187</height>
<height>270</height>
</rect>
</property>
<property name="windowTitle">
<string>STEP</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
@ -63,6 +63,45 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBoxHeader">
<property name="title">
<string>Header</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Company</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditCompany"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Author</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditAuthor"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Product</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditProduct"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@ -122,8 +122,8 @@ void DlgImportExportIges::saveSettings()
// header info
hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());
hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
//hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());
Interface_Static::SetCVal("write.iges.header.company", ui->lineEditCompany->text().toLatin1());
Interface_Static::SetCVal("write.iges.header.author", ui->lineEditAuthor->text().toLatin1());
@ -171,6 +171,7 @@ DlgImportExportStep::DlgImportExportStep(QWidget* parent)
{
ui = new Ui_DlgImportExportStep();
ui->setupUi(this);
ui->lineEditProduct->setReadOnly(true);
}
/**
@ -199,6 +200,11 @@ void DlgImportExportStep::saveSettings()
Interface_Static::SetCVal("write.step.unit","MM");
break;
}
// header info
hGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
hGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
//hGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());
}
void DlgImportExportStep::loadSettings()
@ -207,6 +213,12 @@ void DlgImportExportStep::loadSettings()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
int unit = hGrp->GetInt("Unit", 0);
ui->comboBoxUnits->setCurrentIndex(unit);
// header info
ui->lineEditCompany->setText(QString::fromStdString(hGrp->GetASCII("Company")));
ui->lineEditAuthor->setText(QString::fromStdString(hGrp->GetASCII("Author")));
ui->lineEditProduct->setText(QString::fromLatin1(
Interface_Static::CVal("write.step.product.name")));
}
/**