]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOM/GEOM_Gen_i.cc
Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/geom.git] / src / GEOM / GEOM_Gen_i.cc
index 4bf747c5a82175e055d0f64c8f7a9b5174a62b11..41506b1e73e2ee029b424e40eac7747507275edc 100644 (file)
@@ -31,6 +31,7 @@ using namespace std;
 
 #include "Partition_Spliter.hxx"
 #include "Archimede_VolumeSection.hxx"
+#include "Sketcher_Profile.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
@@ -159,6 +160,8 @@ using namespace std;
 
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
 
+#include "Utils_ExceptHandlers.hxx"
+
 Standard_EXPORT static Standard_Boolean IsValid(const TopoDS_Shape& S) {
 #if OCC_VERSION_MAJOR >= 5
   return BRepAlgo::IsValid(S);
@@ -209,7 +212,7 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
 {
   GEOM::GEOM_Shape_var aShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(IORString));
   if (!CORBA::is_nil(aShape)) {
-    return strdup(aShape->ShapeId());
+    return CORBA::string_dup(aShape->ShapeId());
   }
   return 0;
 }
@@ -235,6 +238,12 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
   TCollection_ExtendedString MainIOR;
   TDF_Label Lab;
   TDF_Tool::Label(aDoc->GetData(), aPersRefString, Lab );
+
+  if (Lab.IsNull()) {
+    MESSAGE("Can not find label "<<aPersRefString<<" for study "<<myStudy->StudyId());
+    THROW_SALOME_CORBA_EXCEPTION("Incorrect GEOM data loaded",SALOME::BAD_PARAM);
+    //return ""; empty IORs raise new problem: "display" in popup crashes
+  }
   
   Handle(TNaming_NamedShape) NS;
   Lab.FindAttribute( TNaming_NamedShape::GetID(), NS );
@@ -259,7 +268,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
       
       TCollection_AsciiString entry;
       TDF_Tool::Entry(mainLabel,entry);
-      CORBA::String_var ent = strdup(entry.ToCString());
+      CORBA::String_var ent = CORBA::string_dup(entry.ToCString());
       
       /* Create the main object recursively */
       MainIOR = LocalPersistentIDToIOR(theSObject, ent, isMultiFile, isASCII) ;
@@ -363,6 +372,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
                                                 CORBA::Object_ptr theObject,
                                                 const char* theName) throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   SALOMEDS::SObject_var aResultSO;
   if(CORBA::is_nil(theObject)) return aResultSO;
 
@@ -426,7 +436,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
     aShapeName = "Vertex_";
   }                                          
   if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
-  else aShapeName = TCollection_AsciiString(strdup(theName));
+  else aShapeName = TCollection_AsciiString((char*)theName);
 
   //Set a name of the added shape
   anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName");
@@ -509,7 +519,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true);
 
   SALOMEDS::Study_var Study = theComponent->GetStudy();
-  TCollection_AsciiString name( strdup(Study->Name()) );
+  TCollection_AsciiString name( Study->Name() );
 
   int StudyID = Study->StudyId();
   myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc );  
@@ -537,7 +547,7 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
 //  void GEOM_Gen_i::Save(const char *IORSComponent, const char *aUrlOfFile) 
 //  {
 
-//    TCollection_ExtendedString path(strdup(aUrlOfFile));
+//    TCollection_ExtendedString path((char*)aUrlOfFile);
 //    TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd");
 //    myOCAFApp->SaveAs(myCurrentOCAFDoc,pathWithExt);
 //  }
@@ -550,14 +560,14 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
 //  void GEOM_Gen_i::Load(const char *IORSComponent, const char *aUrlOfFile) 
 //  {
 
-//    TCollection_ExtendedString path(strdup(aUrlOfFile));
+//    TCollection_ExtendedString path((char*)aUrlOfFile);
 //    TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd");
 
 //    myOCAFApp->Open(pathWithExt,myCurrentOCAFDoc);
 
 //    SALOMEDS::SComponent_var SC = SALOMEDS::SComponent::_narrow(_orb->string_to_object(IORSComponent));
 //    SALOMEDS::Study_var Study = SC->GetStudy();
-//    TCollection_AsciiString name( strdup(Study->Name()) );
+//    TCollection_AsciiString name( Study->Name() );
 
 //    int StudyID = Study->StudyId();
 //    myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc );  
@@ -614,7 +624,7 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
 //============================================================================
 SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
   // Declare a sequence of the byte to store the copied object
-  SALOMEDS::TMPFile_var aStreamFile;
+  SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
 
   // Try to get GEOM_Shape object by given SObject
   SALOMEDS::GenericAttribute_var anAttr;
@@ -704,7 +714,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
 //============================================================================
 char* GEOM_Gen_i::ComponentDataType()
 {
-  return strdup("GEOM");
+  return CORBA::string_dup("GEOM");
 }
 
 //============================================================================
@@ -714,7 +724,7 @@ char* GEOM_Gen_i::ComponentDataType()
 void GEOM_Gen_i::register_name(char * name)
 {
   GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(POA_GEOM::GEOM_Gen::_this());
-  name_service->Register(g, strdup(name)); 
+  name_service->Register(g, name); 
 }
 
 
@@ -753,7 +763,7 @@ TopoDS_Shape GEOM_Gen_i::GetTopoShape(GEOM::GEOM_Shape_ptr shape_ptr)
 
   TDF_Label lab ;
   Handle(TDF_Data) D = myCurrentOCAFDoc->GetData() ;
-  TDF_Tool::Label( D, strdup(shape_ptr->ShapeId()), lab, true ) ;
+  TDF_Tool::Label( D, shape_ptr->ShapeId(), lab, true ) ;
   Handle(TNaming_NamedShape) NamedShape ;  
   bool res = lab.FindAttribute(TNaming_NamedShape::GetID(), NamedShape) ;
 
@@ -803,7 +813,7 @@ const char * GEOM_Gen_i::InsertInLabel(TopoDS_Shape S, const char *mystr, Handle
 {
   GEOMDS_Commands GC(OCAFDoc->Main());
   /* add attributs S and mystr in a new label */
-  TDF_Label Lab = GC.AddShape (S, strdup(mystr));
+  TDF_Label Lab = GC.AddShape (S, (char*)mystr);
 
   TCollection_AsciiString entry;
   TDF_Tool::Entry(Lab,entry);
@@ -831,7 +841,7 @@ const char * GEOM_Gen_i::InsertInLabelDependentShape( TopoDS_Shape S,
   TDF_Tool::Label(OCAFDoc->GetData(), mainshape_ptr->ShapeId(), mainRefLab);
 
   /* add attributs : S, nameIor and ref to main */
-  TDF_Label Lab = GC.AddDependentShape(S, strdup(nameIor), mainRefLab);
+  TDF_Label Lab = GC.AddDependentShape(S, (char*)nameIor, mainRefLab);
 
   TCollection_AsciiString entry;
   TDF_Tool::Entry(Lab, entry);
@@ -911,7 +921,15 @@ void GEOM_Gen_i::InsertInLabelMoreArguments(TopoDS_Shape main_topo,
 //=================================================================================
 CORBA::Short GEOM_Gen_i::NbLabels()
 {
-  return TDF_Tool::NbLabels( myCurrentOCAFDoc->Main() );
+  TDF_ChildIterator ChildIterator(myCurrentOCAFDoc->Main());
+  unsigned int i = 1;
+  
+  while (ChildIterator.More()) {
+    i++;
+    ChildIterator.Next();
+  }
+  return i;
+  //  return TDF_Tool::NbLabels( myCurrentOCAFDoc->Main() );
 }
 
 
@@ -1015,6 +1033,7 @@ int GEOM_Gen_i::SuppressFacesGlue( const TopoDS_Shape& S,
                                   TopoDS_Shape& aCompoundOfShells )
   throw (SALOME::SALOME_Exception)
 {  
+  Unexpect aCatch(SALOME_SalomeException);
   BRepTools_Quilt Glue;
   aCompoundOfShells.Nullify() ;
   
@@ -1103,6 +1122,7 @@ GEOM::GEOM_Shape::ListOfSubShapeID* GEOM_Gen_i::IndexOfFacesOfSubShell( const To
   throw (SALOME::SALOME_Exception)
 {
 
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
   ListOfID->length(0) ;
   if( subShell.IsNull() || subShell.ShapeType() != TopAbs_SHELL ) {
@@ -1219,6 +1239,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SuppressFaces( GEOM::GEOM_Shape_pt
                                                                const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Gen::ListOfGeomShapes_var listOfGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes;
   listOfGeomShapes->length(0) ;
 
@@ -1367,6 +1388,7 @@ void GEOM_Gen_i::SuppressHoleSubRoutine( const TopoDS_Shape& mainShape,
                                         TopTools_MapOfShape& MSwireEndEdges )
   throw (SALOME::SALOME_Exception)
 {  
+  Unexpect aCatch(SALOME_SalomeException);
   TopTools_MapOfShape MS ;
   TopTools_SequenceOfShape SU ;
   FreeEdgesFromMapOfFace(MSfaces, MS) ;        /* MS = free edges of MSfaces */
@@ -1467,6 +1489,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHolesInFaceOrShell( GEOM::GEOM_Shape_pt
                                                       const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdWires )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
 
   if( ListIdWires.length() < 1 )
@@ -1629,6 +1652,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
                                         const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdEndFace )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Face aFace ;
   TopoDS_Wire aWire ;  
@@ -1918,6 +1942,7 @@ bool GEOM_Gen_i::BuildShapeHoleNotTraversing( const TopoDS_Shape& aShape,
                                              TopoDS_Shape& resultTds )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   BRep_Builder B;
   TopExp_Explorer exp ;
   TopoDS_Face newFace ;
@@ -1976,6 +2001,7 @@ bool GEOM_Gen_i::BuildShapeHoleTraversing( const TopoDS_Shape& aShape,
                                           TopoDS_Shape& resultTds )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   BRep_Builder B;
   TopExp_Explorer exp ;
   TopoDS_Face newFace ;
@@ -2115,6 +2141,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShape(GEOM::GEOM_Shape_ptr shape,
                                          const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
      throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   return SubShapesOne(shape, (TopAbs_ShapeEnum) ShapeType, ListOfID);
 }
 
@@ -2128,6 +2155,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShapeSorted(GEOM::GEOM_Shape_ptr shape,
                                                const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
      throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   return SubShapesOne(shape, (TopAbs_ShapeEnum) ShapeType, ListOfID, Standard_True);
 }
 
@@ -2142,6 +2170,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShapesOne( GEOM::GEOM_Shape_ptr shape,
                                              const Standard_Boolean Sort)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape mainShape;
   TopoDS_Shape mainTopo = GetTopoShape(shape);
@@ -2222,6 +2251,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapeAll(GEOM::GEOM_Shape_ptr s
                                                          CORBA::Short ShapeType)
      throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   return SubShapesAll(shape, (TopAbs_ShapeEnum) ShapeType);
 }
 
@@ -2234,6 +2264,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapeAllSorted(GEOM::GEOM_Shape
                                                                CORBA::Short ShapeType)
      throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   return SubShapesAll(shape, (TopAbs_ShapeEnum) ShapeType, Standard_True);
 }
 
@@ -2248,6 +2279,7 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapesAll(GEOM::GEOM_Shape_ptr
   throw (SALOME::SALOME_Exception)
 {
   /* List of sub shapes returned */
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Gen::ListOfGeomShapes_var listOfGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes;
   listOfGeomShapes->length(0) ;
   
@@ -2334,21 +2366,21 @@ GEOM::GEOM_Gen::ListOfGeomShapes* GEOM_Gen_i::SubShapesAll(GEOM::GEOM_Shape_ptr
   return listOfGeomShapes._retn() ;
 }
 
-
 //=================================================================================
 // function : MakeBoolean()
 // purpose  : Boolean operation according to the type 'operation'
 //=================================================================================
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBoolean(GEOM::GEOM_Shape_ptr shape1,
-                                      GEOM::GEOM_Shape_ptr shape2,
-                                      CORBA::Long operation) 
+                                            GEOM::GEOM_Shape_ptr shape2,
+                                            CORBA::Long operation) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape shape ;
   TopoDS_Shape aShape1  ;
   TopoDS_Shape aShape2  ;
-  
+
   try {
     aShape1 = GetTopoShape(shape1) ;
     aShape2 = GetTopoShape(shape2) ;
@@ -2420,6 +2452,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFuse(GEOM::GEOM_Shape_ptr shape1,
                                    GEOM::GEOM_Shape_ptr shape2)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape aShape1 = GetTopoShape(shape1) ;
   TopoDS_Shape aShape2 = GetTopoShape(shape2) ;
@@ -2506,9 +2539,9 @@ GEOM::PointStruct GEOM_Gen_i::MakePointStruct(CORBA::Double x,
 GEOM::DirStruct GEOM_Gen_i::MakeDirection(const GEOM::PointStruct& p)
 { 
   GEOM::DirStruct d ;
-    d.PS.x = p.x ;  d.PS.y = p.y ;  d.PS.z = p.z ;
-    return d ;
-  }
+  d.PS.x = p.x ;  d.PS.y = p.y ;  d.PS.z = p.z ;
+  return d ;
+}
 
 //=================================================================================
 // function : MakeBox()
@@ -2522,6 +2555,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBox(CORBA::Double x1,
                                         CORBA::Double z2) 
      throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   gp_Pnt P1(x1,y1,z1);
   gp_Pnt P2(x2,y2,z2);
   GEOM::GEOM_Shape_var result ;
@@ -2554,6 +2588,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeCylinder(const GEOM::PointStruct& pstruct,
                                               CORBA::Double height) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
   gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ;
@@ -2586,6 +2621,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSphere(CORBA::Double x1,
                                      CORBA::Double radius) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   try {
@@ -2614,6 +2650,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeTorus( const GEOM::PointStruct& pstruct,
                                      CORBA::Double minor_radius )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
   gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ;
@@ -2648,6 +2685,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCone(const GEOM::PointStruct& pstruct,
                                    CORBA::Double height)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
   gp_Pnt p(pstruct.x, pstruct.y, pstruct.z) ;
@@ -2686,6 +2724,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCone(const GEOM::PointStruct& pstruct,
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   //VRV: OCC 4.0 migration
   IGESControl_Reader aReader;  
@@ -2696,8 +2735,11 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename)
       THROW_SALOME_CORBA_EXCEPTION("Error in reading import file", SALOME::BAD_PARAM);    }
     
     MESSAGE("ImportIGES : all Geometry Transfer" << endl ) ;
-    aReader.Clear();
-    aReader.TransferRoots(false);
+    //OCC 5.1.2 porting
+//     aReader.Clear();
+//     aReader.TransferRoots(false);
+    aReader.ClearShapes();
+    aReader.TransferRoots();
 
     MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes() << endl );    
     TopoDS_Shape shape = aReader.OneShape();
@@ -2727,6 +2769,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportIGES(const char* filename)
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportSTEP(const char* filename)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   //VRV: OCC 4.0 migration
   STEPControl_Reader aReader;
@@ -2802,6 +2845,7 @@ GEOM::GEOM_Shape_ptr
                         const CORBA::Short               Limit)
 throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var aResult;  
   TopoDS_Shape tds ;
   //MESSAGE ("In Partition");
@@ -2833,7 +2877,6 @@ throw (SALOME::SALOME_Exception)
       GEOM::GEOM_Shape_var aShape = GetIORFromString( ListTools[ind] );
       TopoDS_Shape Shape = GetTopoShape(aShape);
       if(Shape.IsNull() ) {
-        //MESSAGE ( "In Partition a tool shape is null" );
        THROW_SALOME_CORBA_EXCEPTION("In Partition a shape is null", SALOME::BAD_PARAM);
       }
       if ( !ShapesMap.Contains( Shape ) && ToolsMap.Add( Shape ))
@@ -2868,7 +2911,9 @@ throw (SALOME::SALOME_Exception)
         PS.AddShape(Shape);
     }
     
+    //MESSAGE ( "Partition::Compute() " );
     PS.Compute ((TopAbs_ShapeEnum) Limit);
+    //MESSAGE ( "Partition::Compute() - END" );
 
     // suppress result outside of shapes in KInsideMap
     for (ind = 0; ind < ListKeepInside.length(); ind++) {
@@ -2971,6 +3016,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape,
                                       CORBA::Short nbiter)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Face tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -2993,6 +3039,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape,
        THROW_SALOME_CORBA_EXCEPTION("Initial shape doesn't contain only edges !", SALOME::BAD_PARAM);
       }
       C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last);
+      if (C.IsNull()) continue;
       C = new Geom_TrimmedCurve(C, First, Last);
       Section.AddCurve(C) ;
       i++ ;
@@ -3167,6 +3214,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeGlueFaces(GEOM::GEOM_Shape_ptr myShape,
   // appliquer BRepTools_SameParameter au compshell
   // (rendre parametres 2D des edges identiques aux parametres 3D)
 
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -3305,6 +3353,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewing( const GEOM::GEOM_Gen::ListOfIOR& Li
                                       CORBA::Double precision )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   BRepOffsetAPI_Sewing aMethod ;
@@ -3343,6 +3392,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewingShape( GEOM::GEOM_Shape_ptr aShape,
                                            CORBA::Double precision )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds, S ;
   BRepOffsetAPI_Sewing aMethod ;
@@ -3386,6 +3436,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewingShape( GEOM::GEOM_Shape_ptr aShape,
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::OrientationChange(GEOM::GEOM_Shape_ptr aShape)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;  
   BRep_Builder aBuilder;  
 
@@ -3462,7 +3513,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetReferencedObjects(GEOM::GEOM_Shape_ptr
          Handle(TDataStd_Name) Att;
          L.FindAttribute(TDataStd_Name::GetID(),Att);
          TCollection_AsciiString nameIOR (Att->Get()) ;
-         aList[i] = strdup( nameIOR.ToCString() );
+         aList[i] = CORBA::string_dup( nameIOR.ToCString() );
          i++;
        }
    
@@ -3512,7 +3563,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetObjects(GEOM::GEOM_Shape_ptr shape)
 
     if (!Att->Get().IsEqual(TCollection_ExtendedString("Arguments")) ) {
       TCollection_AsciiString nameIOR (Att->Get());
-      aList[i] = strdup( nameIOR.ToCString() );
+      aList[i] = CORBA::string_dup( nameIOR.ToCString() );
       i++;
     }
     ChildIterator1.Next();
@@ -3528,12 +3579,15 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetObjects(GEOM::GEOM_Shape_ptr shape)
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportBREP(const char* filename)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   TopoDS_Shape tds ;
   GEOM::GEOM_Shape_var result ;
   
   try {
-    BRep_Builder aBuilder;  
-    BRepTools::Read(tds, strdup(filename), aBuilder) ;    
+    BRep_Builder aBuilder;
+    char* aCopyfilename = strdup(filename);
+    BRepTools::Read(tds, aCopyfilename, aBuilder) ;
+    free(aCopyfilename);
     if (tds.IsNull()) {
       THROW_SALOME_CORBA_EXCEPTION("Import BRep aborted", SALOME::BAD_PARAM);
     } 
@@ -3558,6 +3612,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePlane(const GEOM::PointStruct& pstruct,
                                     CORBA::Double trimsize) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
 
@@ -3591,13 +3646,14 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeVertex(CORBA::Double x,
                                      CORBA::Double z) 
   throw (SALOME::SALOME_Exception)
 {
-
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ; 
   gp_Pnt P(x,y,z);
   TopoDS_Shape tds = BRepBuilderAPI_MakeVertex(P).Shape();
   if (tds.IsNull()) {
     THROW_SALOME_CORBA_EXCEPTION("Make Vertex/Point aborted", SALOME::BAD_PARAM);
   }
+  tds.Infinite(true);
   result = CreateObject(tds) ;
   const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ;
   result->ShapeId(entry);
@@ -3613,6 +3669,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFace( GEOM::GEOM_Shape_ptr wire,
                                     CORBA::Boolean wantplanarface ) 
   throw (SALOME::SALOME_Exception) 
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape aShape;
   TopoDS_Shape tds;
@@ -3684,10 +3741,21 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& List
        FR.Perform();
     
        if(FR.IsDone()) {
-         for(; FR.More(); FR.Next())
-           aBuilder.Add(C, FR.Current().Oriented(OriF));
-         result = CreateObject(C);
-         InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc);
+         int k = 0;
+         TopoDS_Shape aFace;
+         for(; FR.More(); FR.Next()) {
+           aFace = FR.Current().Oriented(OriF);
+           aBuilder.Add(C, aFace);
+           k++;
+         }
+         if(k == 1) {
+           result = CreateObject(aFace);
+           InsertInLabelMoreArguments(aFace, result, ListShapes, myCurrentOCAFDoc);
+         }
+         else {
+           result = CreateObject(C);
+           InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc);
+         }
        }
       }
     }
@@ -3709,6 +3777,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& List
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   BRepTools_Quilt Glue;
   TopoDS_Shape C;
@@ -3750,6 +3819,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& Lis
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSolid( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   Standard_Integer ish = 0;
   TopoDS_Compound  Res;
@@ -3798,6 +3868,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeLine(const GEOM::PointStruct& pstruct,
                                    const GEOM::DirStruct& dstruct)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result  ;
   gp_Pnt P1(pstruct.x, pstruct.y, pstruct.z);
   gp_Pnt P2(dstruct.PS.x, dstruct.PS.y, dstruct.PS.z) ;  
@@ -3814,6 +3885,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeLine(const GEOM::PointStruct& pstruct,
     THROW_SALOME_CORBA_EXCEPTION("Make Line aborted : null shape", SALOME::BAD_PARAM);
   }
   else {
+    tds.Infinite(true);
     result = CreateObject(tds) ;
     const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ;
     result->ShapeId(entry);
@@ -3830,6 +3902,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeVector(const GEOM::PointStruct& pstruct1,
                                      const GEOM::PointStruct& pstruct2)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result  ;
   TopoDS_Shape tds ;
   
@@ -3863,6 +3936,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeCircle(const GEOM::PointStruct& pstruct,
                                       CORBA::Double radius)
   throw (SALOME::SALOME_Exception) 
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
 
@@ -3896,6 +3970,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEllipse( const GEOM::PointStruct& pstruct,
                                              CORBA::Double radius_minor )
   throw (SALOME::SALOME_Exception) 
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
   
@@ -3930,6 +4005,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeArc(const GEOM::PointStruct& pInit,
                                    const GEOM::PointStruct& pEnd)
   throw (SALOME::SALOME_Exception) 
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   try {
     gp_Pnt pI(pInit.x, pInit.y, pInit.z) ;
@@ -3957,7 +4033,34 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeArc(const GEOM::PointStruct& pInit,
   return result ;
 }
 
-
+//=================================================================================
+ // function : MakeSketcher()
+ // purpose  : Make a wire from a list containing many points
+ //=================================================================================
+ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSketcher( const char *Cmd )
+   throw (SALOME::SALOME_Exception)
+ {
+   GEOM::GEOM_Shape_var result ;
+   TopoDS_Shape tds ;
+   try {
+     Sketcher_Profile aProfile (Cmd);
+     if(aProfile.IsDone())
+       tds = aProfile.GetShape();
+   }
+   catch(Standard_Failure) {
+     THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeSketcher", SALOME::BAD_PARAM);
+   }
+   if (tds.IsNull()) {
+     THROW_SALOME_CORBA_EXCEPTION("MakeSketcher aborted : null shape", SALOME::BAD_PARAM);
+   } 
+   else {
+     result = CreateObject(tds);
+     const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ;
+     result->ShapeId(entry) ;
+   }
+   return result;
+ }
 
 //=================================================================================
 // function : MakeTranslation()
@@ -3969,6 +4072,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeTranslation( GEOM::GEOM_Shape_ptr myShape,
                                            CORBA::Double z)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
   if( aShape.IsNull() ) {
@@ -3999,6 +4103,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiTranslation1D( GEOM::GEOM_Shape_ptr my
                                                   CORBA::Short nbtimes )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
 
@@ -4054,6 +4159,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiTranslation2D( GEOM::GEOM_Shape_ptr my
                                                   CORBA::Short nbtimes2 )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   
@@ -4111,6 +4217,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation1D( GEOM::GEOM_Shape_ptr mySha
                                                CORBA::Short nbtimes)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4164,6 +4271,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation2D( GEOM::GEOM_Shape_ptr mySha
                                                CORBA::Short nbtimes2 )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4248,6 +4356,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMultiRotation2D( GEOM::GEOM_Shape_ptr mySha
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCopy( GEOM::GEOM_Shape_ptr Shape)
   throw (SALOME::SALOME_Exception) 
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(Shape) ;
@@ -4273,6 +4382,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeMirrorByPlane(GEOM::GEOM_Shape_ptr myShape,
                                             GEOM::GEOM_Shape_ptr shapePlane) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ; 
   TopoDS_Shape tds ;
   TopoDS_Shape aShape      = GetTopoShape(myShape) ;
@@ -4325,6 +4435,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeRotation( GEOM::GEOM_Shape_ptr myShape,
                                         CORBA::Double angle)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4363,6 +4474,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeScaleTransform(GEOM::GEOM_Shape_ptr myShape
                                              CORBA::Double factor)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4396,6 +4508,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeScaleTransform(GEOM::GEOM_Shape_ptr myShape
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCompound( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Compound C;
   BRep_Builder aBuilder;
@@ -4429,6 +4542,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEdge(const GEOM::PointStruct& pstruct1,
                                    const GEOM::PointStruct& pstruct2)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result  ;
   TopoDS_Shape tds ;
   
@@ -4459,6 +4573,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeEdge(const GEOM::PointStruct& pstruct1,
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeWire( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   BRepBuilderAPI_MakeWire MW ;
   TopoDS_Shape tds, Shape ; 
@@ -4502,6 +4617,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeRevolution(GEOM::GEOM_Shape_ptr myShape,
                                          double angle)
   throw (SALOME::SALOME_Exception)
 { 
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4535,6 +4651,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePipe( GEOM::GEOM_Shape_ptr pathShape,
                                     GEOM::GEOM_Shape_ptr baseShape )
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Wire aWire ;
@@ -4591,6 +4708,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePrism( GEOM::GEOM_Shape_ptr myShape,
                                           const GEOM::PointStruct& P2 )
   throw (SALOME::SALOME_Exception)
 {              
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(myShape) ;
@@ -4624,6 +4742,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePrism( GEOM::GEOM_Shape_ptr myShape,
 GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCDG(GEOM::GEOM_Shape_ptr aShape) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape shape = GetTopoShape(aShape) ;
@@ -4678,6 +4797,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::Archimede(GEOM::GEOM_Shape_ptr aShape,
                                     CORBA::Double aMeshingDeflection)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
 
   double cste = -1;
@@ -4751,6 +4871,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape,
                                              const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
 
@@ -4770,7 +4891,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape,
        fill.Add(E);
       }
       for (int i = 1;i<=fill.NbContours();i++) {
-       fill.SetRadius(radius,i);
+       fill.SetRadius(radius,i,i);
       }
       tds = fill.Shape();
       
@@ -4785,7 +4906,7 @@ GEOM::GEOM_Shape_ptr  GEOM_Gen_i::MakeFillet( GEOM::GEOM_Shape_ptr shape,
        }
       }
       for (int i = 1;i<=fill.NbContours();i++) {
-       fill.SetRadius(radius,i);
+       fill.SetRadius(radius,i,i);
       }
       tds = fill.Shape();
     }
@@ -4815,6 +4936,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamfer( GEOM::GEOM_Shape_ptr shape,
                                              const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID ) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result;
   TopoDS_Shape tds ;
 
@@ -4873,6 +4995,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamfer( GEOM::GEOM_Shape_ptr shape,
 CORBA::Boolean GEOM_Gen_i::CheckShape(GEOM::GEOM_Shape_ptr shape) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   TopoDS_Shape S = GetTopoShape(shape) ;
   if( S.IsNull() ) {
     THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM);
@@ -4893,6 +5016,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePlacedBox(CORBA::Double x1,  CORBA::Double
                                         CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
 
@@ -4932,6 +5056,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape,
                                     CORBA::Double delta)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   GEOM::GEOM_Shape_var result ;
   TopoDS_Shape tds ;
   TopoDS_Shape aShape = GetTopoShape(shape) ;
@@ -4979,10 +5104,10 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape,
     
     GEOM::GEOM_Gen::ListOfIOR_var aList = new GEOM::GEOM_Gen::ListOfIOR;
     aList->length(4);
-    aList[0]=strdup(Edge1->Name());
-    aList[1]=strdup(Edge2->Name());
-    aList[2]=strdup(Edge3->Name());
-    aList[3]=strdup(Edge4->Name());
+    aList[0]=CORBA::string_dup(Edge1->Name());
+    aList[1]=CORBA::string_dup(Edge2->Name());
+    aList[2]=CORBA::string_dup(Edge3->Name());
+    aList[3]=CORBA::string_dup(Edge4->Name());
     
     GEOM::GEOM_Shape_ptr aWire = MakeWire( aList );
     GEOM::GEOM_Shape_ptr aFace = MakeFace( aWire, true ) ;
@@ -5008,6 +5133,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape,
 void GEOM_Gen_i::ExportIGES(const char* filename,GEOM::GEOM_Shape_ptr theShape) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   if (theShape->_is_nil()) 
     {
       THROW_SALOME_CORBA_EXCEPTION("Export IGES aborted", SALOME::BAD_PARAM);
@@ -5040,6 +5166,7 @@ void GEOM_Gen_i::ExportIGES(const char* filename,GEOM::GEOM_Shape_ptr theShape)
 void GEOM_Gen_i::ExportBREP(const char* filename,GEOM::GEOM_Shape_ptr theShape)
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   if (theShape->_is_nil()) 
     {
       THROW_SALOME_CORBA_EXCEPTION("Export BRep aborted", SALOME::BAD_PARAM);
@@ -5064,6 +5191,7 @@ void GEOM_Gen_i::ExportBREP(const char* filename,GEOM::GEOM_Shape_ptr theShape)
 void GEOM_Gen_i::ExportSTEP(const char* filename,GEOM::GEOM_Shape_ptr theShape) 
   throw (SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
   if (theShape->_is_nil()) 
     {
       THROW_SALOME_CORBA_EXCEPTION("Export STEP aborted", SALOME::BAD_PARAM);