+//=======================================================================
+//function : GeomObjectToEntry
+//purpose : Return study entry of GEOM Object
+//=======================================================================
+
+std::string StdMeshers_ObjRefUlils::GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject)
+{
+ if ( CORBA::is_nil( theGeomObject ))
+ return "NULL_OBJECT";
+
+ CORBA::String_var entry = theGeomObject->GetStudyEntry();
+ return entry.in();
+}
+
+//=======================================================================
+//function : EntryOrShapeToGeomObject
+//purpose : Return GEOM Object by its sytudy entry or TopoDS_Shape
+//=======================================================================
+
+GEOM::GEOM_Object_ptr
+StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject (const std::string& theEntry,
+ const TopoDS_Shape& theShape)
+{
+ GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_nil();
+
+ // try by entry
+ if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
+ SALOMEDS::Study_var study = gen->GetCurrentStudy();
+ if ( ! theEntry.empty() && ! study->_is_nil() ) {
+ SALOMEDS::SObject_wrap sobj = study->FindObjectID( theEntry.c_str() );
+ CORBA::Object_var obj = gen->SObjectToObject( sobj );
+ geom = GEOM::GEOM_Object::_narrow( obj );
+ }
+ }
+ // try by TopoDS_Shape
+ if ( geom->_is_nil() )
+ geom = ShapeToGeomObject( theShape );
+
+ return geom._retn();
+}
+