From 2df46277e97c9573598470185c938e0c4ae419d6 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 4 Apr 2014 10:57:53 +0400 Subject: [PATCH] 0022468: [CEA 1048] IMP GEOM: creating groups on materials at STEP import Additional fix to make correct Python dump when material groups are created --- src/GEOM/GEOM_PythonDump.cxx | 16 ++++++++++++++++ src/GEOM/GEOM_PythonDump.hxx | 1 + src/GEOMImpl/GEOMImpl_IInsertOperations.cxx | 12 ++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index 732501961..395a3ab72 100644 --- a/src/GEOM/GEOM_PythonDump.cxx +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -125,6 +125,22 @@ namespace GEOM return *this; } + TPythonDump& TPythonDump::operator<< (const Handle(TColStd_HSequenceOfTransient)& theObjects) + { + Standard_Integer aLength = theObjects->Length(); + if ( aLength > 1 ) { + myStream << "["; + } + for ( Standard_Integer i = 1; i <= aLength; i++ ) { + *this << Handle(GEOM_Object)::DownCast(theObjects->Value(i)); + if ( i < aLength ) myStream << ", "; + } + if ( aLength > 1 ) { + myStream << "]"; + } + return *this; + } + TPythonDump& TPythonDump::operator<< (const GEOM_BaseObject* theObject) { if ( !theObject ) { diff --git a/src/GEOM/GEOM_PythonDump.hxx b/src/GEOM/GEOM_PythonDump.hxx index a2676bef3..66b87506e 100644 --- a/src/GEOM/GEOM_PythonDump.hxx +++ b/src/GEOM/GEOM_PythonDump.hxx @@ -56,6 +56,7 @@ namespace GEOM Standard_EXPORT TPythonDump& operator<< (const TCollection_AsciiString theArg); Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg); Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_BaseObject)& theObject); + Standard_EXPORT TPythonDump& operator<< (const Handle(TColStd_HSequenceOfTransient)& theObjects); Standard_EXPORT TPythonDump& operator<< (const GEOM_BaseObject* theObject); }; diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index c9275139c..86e7566d5 100755 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -303,17 +303,17 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IInsertOperations::Import if (theFormatName != "IGES_UNIT") { GEOM::TPythonDump pd (aFunction); if (theFormatName == "BREP") - pd << anImported << " = geompy.ImportBREP(\"" << theFileName.ToCString() << "\")"; + pd << aSeq << " = geompy.ImportBREP(\"" << theFileName.ToCString() << "\")"; else if (theFormatName == "IGES") - pd << anImported << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")"; + pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")"; else if (theFormatName == "IGES_SCALE") - pd << anImported << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)"; + pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)"; else if (theFormatName == "STEP") - pd << anImported << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\")"; + pd << aSeq << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\")"; else if (theFormatName == "STEP_SCALE") - pd << anImported << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\", True)"; + pd << aSeq << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\", True)"; else { - pd << anImported << " = geompy.ImportFile(\"" + pd << aSeq << " = geompy.ImportFile(\"" << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; } } -- 2.39.2