Dump Python: gives for SMESH access to all dump names to avoid same names of different objects.

This commit is contained in:
jfa 2005-04-04 06:35:09 +00:00
parent cc14acdac2
commit fcadb99dda
4 changed files with 37 additions and 4 deletions

View File

@ -1985,12 +1985,18 @@ module GEOM
*/
string GetStringFromIOR (in GEOM_Object theObject);
/*!
/*!
* Returns a name with which a GEOM object was dumped into python script
* \param theStudyEntry is an entry of the GEOM object in the study
*/
string GetDumpName (in string theStudyEntry);
};
/*!
* Returns all names with which a GEOM objects was dumped
* into python script to avoid the same names in SMESH script
*/
string_array GetAllDumpNames();
};
};
#endif

View File

@ -6,6 +6,11 @@ using namespace std;
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
//=======================================================================
//function : DumpPython
//purpose :
//=======================================================================
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript)
@ -68,3 +73,22 @@ char* GEOM_Gen_i::GetDumpName (const char* theStudyEntry)
return NULL;
}
//=======================================================================
//function : GetAllDumpNames
//purpose :
//=======================================================================
GEOM::string_array* GEOM_Gen_i::GetAllDumpNames()
{
Handle(TColStd_HSequenceOfAsciiString) aHSeq = _impl->GetAllDumpNames();
int i = 0, aLen = aHSeq->Length();
GEOM::string_array_var seq = new GEOM::string_array();
seq->length(aLen);
for (; i < aLen; i++) {
seq[i] = CORBA::string_dup(aHSeq->Value(i + 1).ToCString());
}
return seq._retn();
}

View File

@ -760,7 +760,8 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS
* AddSubShape
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices)
GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfLong& theIndices)
{
if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil();
Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry());
@ -769,7 +770,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray);
Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray, true);
if(anObject.IsNull()) return GEOM::GEOM_Object::_nil();
TCollection_AsciiString anEntry;

View File

@ -181,6 +181,8 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, public Engines_Component_i
char* GetDumpName (const char* theStudyEntry);
GEOM::string_array* GetAllDumpNames();
//********************************************************************************************************//
// Internal methods
//********************************************************************************************************//