salome.salome_init()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
box = geompy.MakeBoxDXDYDZ(200, 200, 200)
geompy.addToStudy( box, "box" )
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()
# create a box
box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
salome.salome_init()
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
*/
//=============================================================================
-GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen)
- : SMESH_3D_Algo(hypId, studyId, gen), _isLibUsed( false )
+GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen)
+ : SMESH_3D_Algo(hypId, gen), _isLibUsed( false )
{
_name = Name();
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
_compatibleHypothesis.push_back( GHS3DPlugin_Hypothesis::GetHypType());
_compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
_requireShape = false; // can work without shape
-
- _smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- CORBA::Object_var anObject = _smeshGen_i->GetNS()->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
-
- _study = NULL;
- _study = aStudyMgr->GetStudyByID(_studyId);
-
+
_computeCanceled = false;
_progressAdvance = 1e-4;
}
TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry)
{
- if ( _study->_is_nil() )
+ if ( SMESH_Gen_i::getStudyServant()->_is_nil() )
throw SALOME_Exception("MG-Tetra plugin can't work w/o publishing in the study");
+
GEOM::GEOM_Object_var aGeomObj;
TopoDS_Shape S = TopoDS_Shape();
- SALOMEDS::SObject_var aSObj = _study->FindObjectID( entry.c_str() );
+ SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
if (!aSObj->_is_nil() ) {
CORBA::Object_var obj = aSObj->GetObject();
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
aSObj->UnRegister();
}
if ( !aGeomObj->_is_nil() )
- S = _smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+ S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
return S;
}
{
public:
- GHS3DPlugin_GHS3D(int hypId, int studyId, SMESH_Gen* gen);
+ GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen);
virtual ~GHS3DPlugin_GHS3D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
bool _keepFiles;
bool _removeLogOnSuccess;
bool _logInStandardOutput;
- SALOMEDS::Study_var _study;
- SMESH_Gen_i* _smeshGen_i;
bool _isLibUsed;
double _progressAdvance;
//=============================================================================
GHS3DPlugin_GHS3D_i::GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_3D_Algo_i( thePOA )
{
myBaseImpl = new ::GHS3DPlugin_GHS3D (theGenImpl->GetANewId(),
- theStudyId,
theGenImpl );
}
{
SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh();
- smeshGen->RemoveLastFromPythonScript(smeshGen->GetCurrentStudy()->StudyId());
- SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(), theMesh);
+ smeshGen->RemoveLastFromPythonScript();
+ SALOMEDS::SObject_ptr theSMesh = smeshGen->ObjectToSObject(theMesh);
#ifdef WINNT
#define SEP '\\'
#else
//=============================================================================
GHS3DPlugin_Optimizer_i::GHS3DPlugin_Optimizer_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_3D_Algo_i( thePOA )
{
myBaseImpl = new ::GHS3DPlugin_Optimizer (theGenImpl->GetANewId(),
- theStudyId,
theGenImpl );
}
public:
// Constructor
GHS3DPlugin_GHS3D_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~GHS3DPlugin_GHS3D_i();
public:
// Constructor
GHS3DPlugin_Optimizer_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl );
};
//function : GHS3DPlugin_Hypothesis
//=======================================================================
-GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
- : SMESH_Hypothesis(hypId, studyId, gen),
+GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
+ : SMESH_Hypothesis(hypId, gen),
myToMeshHoles(DefaultMeshHoles()),
myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
myMaximumMemory(-1),
{
public:
- GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
+ GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
typedef std::map<std::vector<double>,double> TGHS3DEnforcedVertexCoordsValues;
typedef std::map<std::string,double> TGHS3DEnforcedVertexEntryValues;
//=======================================================================
GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA )
{
myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
- theStudyId,
theGenImpl);
}
CORBA::Double x = 0, y = 0, z = 0;
CORBA::Boolean isCompound = false;
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
if (theVertexEntry.empty()) {
string aName;
if (theVertex->GetShapeType() == GEOM::VERTEX) {
isCompound = true;
}
aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
if (theVertex->GetShapeType() == GEOM::VERTEX) {
- GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
if (CORBA::is_nil(measureOp))
return false;
CORBA::Double x = 0, y = 0, z = 0;
CORBA::Boolean isCompound = false;
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
if (theVertexEntry.empty()) {
string aName;
if (theVertex->GetShapeType() == GEOM::VERTEX) {
isCompound = true;
}
aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
if (theVertex->GetShapeType() == GEOM::VERTEX) {
- GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
if (CORBA::is_nil(measureOp))
return false;
string theVertexEntry = theVertex->GetStudyEntry();
if (theVertexEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theVertex->GetShapeType() == GEOM::VERTEX)
aName = "Vertex_";
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
string theVertexEntry = theVertex->GetStudyEntry();
if (theVertexEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theVertex->GetShapeType() == GEOM::VERTEX)
aName = "Vertex_";
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
}
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+ SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
public:
// Constructor
GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl);
// Destructor
virtual ~GHS3DPlugin_Hypothesis_i();
*/
//================================================================================
-GHS3DPlugin_Optimizer::GHS3DPlugin_Optimizer(int hypId, int studyId, SMESH_Gen* gen)
- : SMESH_3D_Algo(hypId, studyId, gen)
+GHS3DPlugin_Optimizer::GHS3DPlugin_Optimizer(int hypId, SMESH_Gen* gen)
+ : SMESH_3D_Algo(hypId, gen)
{
_name = Name();
_compatibleHypothesis.push_back( GHS3DPlugin_OptimizerHypothesis::GetHypType());
class GHS3DPlugin_Optimizer: public SMESH_3D_Algo
{
public:
- GHS3DPlugin_Optimizer(int hypId, int studyId, SMESH_Gen* gen);
+ GHS3DPlugin_Optimizer(int hypId, SMESH_Gen* gen);
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
#include <SMESH_Gen.hxx>
GHS3DPlugin_OptimizerHypothesis::GHS3DPlugin_OptimizerHypothesis(int hypId,
- int studyId,
SMESH_Gen * gen)
- :GHS3DPlugin_Hypothesis( hypId, studyId, gen ),
+ :GHS3DPlugin_Hypothesis( hypId, gen ),
myOptimization( YES ),
mySplitOverConstrained( NO ),
mySmoothOffSlivers( false ),
class GHS3DPlugin_OptimizerHypothesis : public GHS3DPlugin_Hypothesis
{
public:
- GHS3DPlugin_OptimizerHypothesis(int hypId, int studyId, SMESH_Gen * gen);
+ GHS3DPlugin_OptimizerHypothesis(int hypId, SMESH_Gen * gen);
// inherited params:
// 1 - create new nodes
GHS3DPlugin_OptimizerHypothesis_i::
GHS3DPlugin_OptimizerHypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl)
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
- GHS3DPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl )
+ GHS3DPlugin_Hypothesis_i( thePOA, theGenImpl )
{
int id = myBaseImpl ? myBaseImpl->GetID() : theGenImpl->GetANewId();
if ( myBaseImpl )
delete myBaseImpl;
- myBaseImpl = new ::GHS3DPlugin_OptimizerHypothesis( id, theStudyId, theGenImpl );
+ myBaseImpl = new ::GHS3DPlugin_OptimizerHypothesis( id, theGenImpl );
}
namespace
{
public:
GHS3DPlugin_OptimizerHypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl);
// inherited params:
// 1 - create new nodes
}
/**
- * \brief {Get or create the geom selection tool for active study}
+ * \brief {Get or create the geom selection tool for study}
* */
GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
{
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
- that->GeomToolSelected = new GeomSelectionTools(aStudy);
+ if (that->GeomToolSelected == NULL) {
+ that->GeomToolSelected = new GeomSelectionTools();
}
return that->GeomToolSelected;
}
return;
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
int elementType = myEnfMeshConstraint->currentIndex();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
_PTR(SObject) aSObj;
QString meshEntry = myEnfMeshWdg->GetValue();
if (selEnfMeshes == 1)
{
aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
- if (!CORBA::is_nil(anObj))
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
+ if (!CORBA::is_nil(anObj)) {
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
+ }
}
else
{
QStringListIterator meshEntriesIt (meshEntries);
while (meshEntriesIt.hasNext()) {
aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
if (!CORBA::is_nil(anObj)) {
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
}
if ( CORBA::is_nil(getGeomEngine()))
return;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
TEnfMeshList::const_iterator itEnfMesh;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
TEnfMesh* enfMesh = (*itEnfMesh);