this, SLOT( onWindowClosed(SUIT_ViewWindow *) ), Qt::UniqueConnection );
}
- /* ************************************ TODO Hexa6
- _hexaEngine->SetCurrentStudy(SALOMEDS::Study::_nil());
- if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( theStudy ))
- if ( _PTR(Study) aStudy = s->studyDS()) {
- _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
- updateObjBrowser(); // objects can be removed
- }
- ************************************ */
-
if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL)
currentOccGView->getViewWindow()->installEventFilter(this);
return bOk;
}
-SALOMEDS::Study_var HEXABLOCKGUI::ClientStudy()
+SALOMEDS::Study_var HEXABLOCKGUI::getStudyServant()
{
SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
CORBA::Object_var aSMObject = aNamingService->Resolve("/Study");
SalomeApp_Study* appStudy = HEXABLOCKGUI::activeStudy();
if(!appStudy) return;
- SALOMEDS::Study_var aDSStudy = ClientStudy();
+ SALOMEDS::Study_var aDSStudy = getStudyServant();
SALOMEDS::StudyBuilder_var aBuilder (aDSStudy->NewBuilder());
QString entry = currentDocGView->getDocumentModel()->documentEntry();
SALOMEDS::SObject_var aFatherSO = aDSStudy->FindObjectID( qPrintable(entry) );
if (dgview == NULL || dgview->getDocumentModel() == NULL)
return result;
- SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication());
- SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
-
- if(!appStudy)
- return result;
-
- _PTR(Study) aStudy = appStudy->studyDS();
-
- if(!aStudy)
- return result;;
-
- _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) );
+ _PTR(SObject) obj ( SalomeApp_Application::getStudy()->FindObjectID(qPrintable(entry)) );
_PTR(GenericAttribute) anAttr;
if ( obj ){
- if ( obj->FindAttribute(anAttr, "AttributeName") ){
- _PTR(AttributeName) aName (anAttr);
- DocumentModel* docModel = dgview->getDocumentModel();
- docModel->setName( name );
- aName->SetValue( name.toLatin1().data() );
- getApp()->updateObjectBrowser();
-// _dwPattern->setWindowTitle( name );
- result = true;
- }
+ if ( obj->FindAttribute(anAttr, "AttributeName") ) {
+ _PTR(AttributeName) aName (anAttr);
+ DocumentModel* docModel = dgview->getDocumentModel();
+ docModel->setName( name );
+ aName->SetValue( name.toLatin1().data() );
+ getApp()->updateObjectBrowser();
+// _dwPattern->setWindowTitle( name );
+ result = true;
+ }
}
return result;
}
DEBTRACE("HEXABLOCKGUI::createSComponent");
// --- Find or create (if not done yet) "HEXABLOCK" SComponent in the study
- _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS();
+ _PTR(Study) aStudy = SalomeApp_Application::getStudy();
_PTR(StudyBuilder) aBuilder (aStudy->NewBuilder());
_PTR(GenericAttribute) anAttr;
_PTR(AttributeName) aName;
if (app_study == NULL)
return docEntry;
- SALOMEDS::Study_var ds_study = ClientStudy();
+ SALOMEDS::Study_var ds_study = getStudyServant();
SALOMEDS::StudyBuilder_var aBuilder (ds_study->NewBuilder());
QString entry = app_study->centry("HEXABLOCK");
SALOMEDS::SObject_var aFatherSO = ds_study->FindObjectID( qPrintable(entry) );
salome.salome_init()
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
component = hexablock_swig.hex_instance ()
geompy.addToStudy(shape, name)
comp_smesh = salome.lcc.FindOrLoadComponent(container, "SMESH")
- comp_smesh.init_smesh(study, geomBuilder.geom)
+ comp_smesh.init_smesh(geomBuilder.geom)
meshexa = comp_smesh.Mesh(shape)
so = "libHexaBlockPluginEngine.so"
# ==================================================== findOrCreateComponent
# Find or create HexaBlock Study Component
-def findOrCreateComponent( study, builder ):
- father = study.FindComponent( moduleName() )
+def findOrCreateComponent( builder ):
+ father = salome.myStudy.FindComponent( moduleName() )
if father is None:
father = builder.NewComponent( moduleName() )
attr = builder.FindOrCreateAttribute( father, "AttributeName" )
study = salome.myStudy
builder = study.NewBuilder()
- father = findOrCreateComponent( study, builder )
+ father = findOrCreateComponent( builder )
name = doc.getName ()
present = study.FindObjectByName(name, moduleName())