Salome HOME
projects
/
modules
/
geom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Increment version: 9.1.0
[modules/geom.git]
/
src
/
GEOM_I
/
GEOM_DumpPython.cc
diff --git
a/src/GEOM_I/GEOM_DumpPython.cc
b/src/GEOM_I/GEOM_DumpPython.cc
index 4e982647a4fe42268b8eedf22217dc675e6c5a59..1006b30b509f11efac76816658b5ee294ec38091 100644
(file)
--- a/
src/GEOM_I/GEOM_DumpPython.cc
+++ b/
src/GEOM_I/GEOM_DumpPython.cc
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
3
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-6,7
+6,7
@@
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License
, or (at your option) any later version
.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-20,7
+20,7
@@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifdef W
NT
+#ifdef W
IN32
#pragma warning( disable:4786 )
#endif
#pragma warning( disable:4786 )
#endif
@@
-83,12
+83,11
@@
void ConvertV6toV7( TCollection_AsciiString& theScript )
//purpose :
//=======================================================================
//purpose :
//=======================================================================
-Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean isMultiFile,
+Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript)
{
CORBA::Boolean& isValidScript)
{
- SALOMEDS::Study_var aStudy =
SALOMEDS::Study::_narrow(theStudy
);
+ SALOMEDS::Study_var aStudy =
getStudyServant(
);
if(CORBA::is_nil(aStudy))
return new Engines::TMPFile(0);
if(CORBA::is_nil(aStudy))
return new Engines::TMPFile(0);
@@
-107,7
+106,7
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::String_var IOR = aValue->GetIOR();
if(strlen(IOR.in()) > 0) {
CORBA::Object_var obj = _orb->string_to_object(IOR);
CORBA::String_var IOR = aValue->GetIOR();
if(strlen(IOR.in()) > 0) {
CORBA::Object_var obj = _orb->string_to_object(IOR);
- GEOM::GEOM_
Object_var GO = GEOM::GEOM_
Object::_narrow(obj);
+ GEOM::GEOM_
BaseObject_var GO = GEOM::GEOM_Base
Object::_narrow(obj);
if(!CORBA::is_nil(GO)) {
CORBA::String_var aName = aValue->GetName();
CORBA::String_var anEntry = GO->GetEntry();
if(!CORBA::is_nil(GO)) {
CORBA::String_var aName = aValue->GetName();
CORBA::String_var anEntry = GO->GetEntry();
@@
-134,10
+133,10
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
anAttrStr = SALOMEDS::AttributeString::_narrow(anAttr);
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(anAttrStr->Value());
ObjectStates* aStates = new ObjectStates();
anAttrStr = SALOMEDS::AttributeString::_narrow(anAttr);
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(anAttrStr->Value());
ObjectStates* aStates = new ObjectStates();
- for(
int
i = 0; i < aSections->length(); i++) {
+ for(
CORBA::ULong
i = 0; i < aSections->length(); i++) {
TState aState;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
TState aState;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
- for(
int
j = 0; j < aListOfVars.length(); j++) {
+ for(
CORBA::ULong
j = 0; j < aListOfVars.length(); j++) {
bool isVar = aStudy->IsVariable(aListOfVars[j].in());
TVariable aVar = TVariable( (char*)aListOfVars[j].in(), isVar );
aState.push_back(aVar);
bool isVar = aStudy->IsVariable(aListOfVars[j].in());
TVariable aVar = TVariable( (char*)aListOfVars[j].in(), isVar );
aState.push_back(aVar);
@@
-151,7
+150,7
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
}
TCollection_AsciiString aScript;
}
TCollection_AsciiString aScript;
- aScript += _impl->DumpPython(
aStudy->StudyId(),
objectDataVec, aVariableMap, isPublished, isMultiFile, isValidScript);
+ aScript += _impl->DumpPython(objectDataVec, aVariableMap, isPublished, isMultiFile, isValidScript);
if (isPublished)
{
if (isPublished)
{
@@
-173,6
+172,8
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::String_var anEntry = CORBA::string_dup(newEntry.c_str());
if( ap->IsSet(anEntry, 6) ) { //6 Means string array, see SALOMEDS_Attributes.idl AttributeParameter interface
CORBA::String_var anEntry = CORBA::string_dup(newEntry.c_str());
if( ap->IsSet(anEntry, 6) ) { //6 Means string array, see SALOMEDS_Attributes.idl AttributeParameter interface
+ if ( GetDumpName((*it)._studyEntry.ToCString()) == NULL )
+ continue;
std::string idCommand = std::string("geompy.getObjectID(") + GetDumpName((*it)._studyEntry.ToCString()) + std::string(")");
SALOMEDS::StringSeq_var aSeq= ap->GetStrArray(anEntry);
int oldLenght = aSeq->length();
std::string idCommand = std::string("geompy.getObjectID(") + GetDumpName((*it)._studyEntry.ToCString()) + std::string(")");
SALOMEDS::StringSeq_var aSeq= ap->GetStrArray(anEntry);
int oldLenght = aSeq->length();
@@
-185,7
+186,6
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
}
TCollection_AsciiString aDirScript, aNodeName, aNodeEntry, aFatherName, aFatherEntry;
}
TCollection_AsciiString aDirScript, aNodeName, aNodeEntry, aFatherName, aFatherEntry;
- aDirScript += "\n\t### Folders and it's content\n";
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::UseCaseIterator_var Itr = useCaseBuilder->GetUseCaseIterator(aSO);
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
SALOMEDS::UseCaseBuilder_var useCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::UseCaseIterator_var Itr = useCaseBuilder->GetUseCaseIterator(aSO);
@@
-231,14
+231,19
@@
Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
} else if ( !aFatherName.IsEmpty() && !aFatherEntry.IsEmpty() ) {
// the node is Geom object under folder
aDirScript += "geompy.PutToFolder(";
} else if ( !aFatherName.IsEmpty() && !aFatherEntry.IsEmpty() ) {
// the node is Geom object under folder
aDirScript += "geompy.PutToFolder(";
+ if ( GetDumpName( aNodeSO->GetID() ) == NULL )
+ continue;
aDirScript += GetDumpName( aNodeSO->GetID() );
aDirScript += ", ";
aDirScript += aFatherName;
aDirScript += ")\n";
}
}
aDirScript += GetDumpName( aNodeSO->GetID() );
aDirScript += ", ";
aDirScript += aFatherName;
aDirScript += ")\n";
}
}
- aScript += aDirScript;
-
+ if ( !aDirScript.IsEmpty() )
+ {
+ aScript += "\n\t### Folders and it's content\n";
+ aScript += aDirScript;
+ }
//Output the script that sets up the visual parameters.
char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t");
if (script && strlen(script) > 0) {
//Output the script that sets up the visual parameters.
char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t");
if (script && strlen(script) > 0) {
@@
-276,7
+281,7
@@
char* GEOM_Gen_i::GetDumpName (const char* theStudyEntry)
{
const char* name = _impl->GetDumpName( theStudyEntry );
if ( name && strlen( name ) > 0 )
{
const char* name = _impl->GetDumpName( theStudyEntry );
if ( name && strlen( name ) > 0 )
- return
str
dup( name );
+ return
CORBA::string_
dup( name );
return NULL;
}
return NULL;
}