From e941da46a50f6b022654135aae373d29d97f0114 Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 15 Apr 2011 08:55:44 +0000 Subject: [PATCH] Additional fix for the issue "16219: EDF PAL 469: "RemoveFromStudy" Function": dump hideInStudy(obj) command in the python script for the unpublished objects --- src/GEOM/GEOM_Engine.cxx | 17 +++++++++++++++++ src/GEOM/GEOM_Engine.hxx | 1 + src/GEOM_I/GEOM_DumpPython.cc | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index f05ab56e9..2555e1ab9 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -727,6 +727,23 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, aScript += anEntryToCmd->second; } + //RNV: issue 16219: EDF PAL 469: "RemoveFromStudy" Function + //Add unpublish command if need + TCollection_AsciiString unpublishCmd("\n"); + if(isMultiFile) + unpublishCmd += "\t"; + unpublishCmd += "geompy.hideInStudy("; + + for (aStEntry2ObjDataPtrIt = aStEntry2ObjDataPtr.begin(); + aStEntry2ObjDataPtrIt != aStEntry2ObjDataPtr.end(); + ++aStEntry2ObjDataPtrIt) + { + TObjectData* data = aStEntry2ObjDataPtrIt->second; + if ( data->_unpublished && !data->_pyName.IsEmpty() ) { + aScript += unpublishCmd + data->_pyName + ")"; + } + } + //aScript += "\n\tpass\n"; aScript += "\n"; aValidScript = true; diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 4e8158a78..0e8a0c923 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -48,6 +48,7 @@ struct TObjectData TCollection_AsciiString _studyEntry; TCollection_AsciiString _name; TCollection_AsciiString _pyName; + bool _unpublished; }; class Handle_TDataStd_HArray1OfByte; diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc index 07c58fb70..f91628a26 100644 --- a/src/GEOM_I/GEOM_DumpPython.cc +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -92,6 +92,16 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, objData._name = aName.in(); objData._entry = anEntry.in(); objData._studyEntry = aStudyEntry.in(); + + //Find Drawable Attribute + SALOMEDS::GenericAttribute_var aGenAttr; + if(aValue->FindAttribute(aGenAttr, "AttributeDrawable") ) { + SALOMEDS::AttributeDrawable_var aDrw = SALOMEDS::AttributeDrawable::_narrow(aGenAttr); + objData._unpublished = !aDrw->IsDrawable(); + } else { + objData._unpublished = false; + } + objectDataVec.push_back( objData ); //Find attribute with list of used notebook variables -- 2.39.2