Salome HOME
0022468: [CEA 1048] IMP GEOM: creating groups on materials at STEP import V7_4_0a1
authorvsr <vsr@opencascade.com>
Fri, 4 Apr 2014 06:57:53 +0000 (10:57 +0400)
committervsr <vsr@opencascade.com>
Fri, 4 Apr 2014 06:57:53 +0000 (10:57 +0400)
Additional fix to make correct Python dump when material groups are created

src/GEOM/GEOM_PythonDump.cxx
src/GEOM/GEOM_PythonDump.hxx
src/GEOMImpl/GEOMImpl_IInsertOperations.cxx

index 732501961fab18e1c32ced372a226d5f8f6e2529..395a3ab72458fcdea316a3336269a0dd843d2dff 100644 (file)
@@ -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 ) {
index a2676bef34f6cd94412f30a0089ebcdaf4f524fa..66b87506e9c6e47a9e9351f8e0e0682be08999e2 100644 (file)
@@ -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);
   };
 
index c9275139c30d0cd057465894a6172b364864661b..86e7566d50672fccdf85c14bd8009b8741a30bc0 100755 (executable)
@@ -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() << "\")";
     }
   }