0000832: Original color STEP model lost in import

This commit is contained in:
wmayer
2012-09-29 15:50:17 +02:00
parent bcddb1e950
commit f403295ca7
5 changed files with 30 additions and 21 deletions

View File

@@ -125,7 +125,7 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
//Handle_XSControl_TransferReader tr = ws->TransferReader();
std::map<int, Quantity_Color> hash_col;
ReadColors(aReader.WS(), hash_col);
//ReadColors(aReader.WS(), hash_col);
//ReadNames(aReader.WS());
for (Standard_Integer i=1; i<=nbs; i++) {

View File

@@ -446,11 +446,9 @@ CmdPartImport::CmdPartImport()
void CmdPartImport::activated(int iMsg)
{
QStringList filter;
filter << QObject::tr("All CAD Files (*.stp *.step *.igs *.iges *.brp *.brep)");
filter << QObject::tr("STEP (*.stp *.step)");
filter << QObject::tr("STEP AP203 (*.stp *.step)");
filter << QObject::tr("IGES (*.igs *.iges)");
filter << QObject::tr("BREP (*.brp *.brep)");
filter << QObject::tr("All Files (*.*)");
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")));
if (!fn.isEmpty()) {
@@ -459,9 +457,7 @@ void CmdPartImport::activated(int iMsg)
if (!pDoc) return; // no document
openCommand("Import Part");
QString ext = QFileInfo(fn).suffix().toLower();
if (ext == QLatin1String("step") ||
ext == QLatin1String("stp") ||
ext == QLatin1String("iges") ||
if (ext == QLatin1String("iges") ||
ext == QLatin1String("igs")) {
doCommand(Doc, "import ImportGui");
doCommand(Doc, "ImportGui.insert(\"%s\",\"%s\")", (const char*)fn.toUtf8(), pDoc->getName());
@@ -507,20 +503,16 @@ CmdPartExport::CmdPartExport()
void CmdPartExport::activated(int iMsg)
{
QStringList filter;
filter << QObject::tr("All CAD Files (*.stp *.step *.igs *.iges *.brp *.brep)");
filter << QObject::tr("STEP (*.stp *.step)");
filter << QObject::tr("STEP AP203 (*.stp *.step)");
filter << QObject::tr("IGES (*.igs *.iges)");
filter << QObject::tr("BREP (*.brp *.brep)");
filter << QObject::tr("All Files (*.*)");
QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")));
if (!fn.isEmpty()) {
App::Document* pDoc = getDocument();
if (!pDoc) return; // no document
QString ext = QFileInfo(fn).suffix().toLower();
if (ext == QLatin1String("step") ||
ext == QLatin1String("stp") ||
ext == QLatin1String("iges") ||
if (ext == QLatin1String("iges") ||
ext == QLatin1String("igs")) {
Gui::Application::Instance->exportTo((const char*)fn.toUtf8(),pDoc->getName(),"ImportGui");
}

View File

@@ -43,6 +43,12 @@ ParGrp.SetString("WorkBenchName", "Part Design")
ParGrp.SetString("WorkBenchModule", "PartWorkbench.py")
FreeCAD.addImportType("CAD formats (*.igs *.iges *.step *.stp *.brep *.brp)","Part")
FreeCAD.addExportType("CAD formats (*.igs *.iges *.step *.stp *.brep *.brp)","Part")
#FreeCAD.addImportType("CAD formats (*.igs *.iges *.step *.stp *.brep *.brp)","Part")
#FreeCAD.addExportType("CAD formats (*.igs *.iges *.step *.stp *.brep *.brp)","Part")
FreeCAD.addImportType("BREP format (*.brep *.brp)","Part")
FreeCAD.addExportType("BREP format (*.brep *.brp)","Part")
FreeCAD.addImportType("IGES format (*.iges *.igs)","Part")
FreeCAD.addExportType("IGES format (*.iges *.igs)","Part")
FreeCAD.addImportType("STEP AP214 format (*.step *.stp)","ImportGui")
FreeCAD.addExportType("STEP AP214 format (*.step *.stp)","ImportGui")