Deleted Study parameter

This commit is contained in:
mpa 2017-02-03 16:22:00 +03:00
parent a1c5622601
commit 65987d083d
3 changed files with 21 additions and 26 deletions

View File

@ -4,11 +4,11 @@ import salome
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()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -767,10 +767,9 @@ void NETGENPluginGUI_HypothesisCreator::onSetSizeFile()
GeomSelectionTools* NETGENPluginGUI_HypothesisCreator::getGeomSelectionTools()
{
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (myGeomSelectionTools == NULL || myGeomSelectionTools->getMyStudy() != aStudy) {
if (myGeomSelectionTools == NULL) {
delete myGeomSelectionTools;
myGeomSelectionTools = new GeomSelectionTools(aStudy);
myGeomSelectionTools = new GeomSelectionTools();
}
return myGeomSelectionTools;
}

View File

@ -287,27 +287,23 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/Study");
SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(anObject);
if ( !myStudy->_is_nil() )
const NETGENPlugin_Hypothesis::TLocalSize localSizes = hyp->GetLocalSizesAndEntries();
NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
for ( ; it != localSizes.end() ; it++)
{
const NETGENPlugin_Hypothesis::TLocalSize localSizes = hyp->GetLocalSizesAndEntries();
NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
for ( ; it != localSizes.end() ; it++)
{
std::string entry = (*it).first;
double val = (*it).second;
// --
GEOM::GEOM_Object_var aGeomObj;
SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
if ( !aSObj->_is_nil() ) {
CORBA::Object_var obj = aSObj->GetObject();
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
aSObj->UnRegister();
}
TopoDS_Shape S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
::SetLocalSize(S, val);
std::string entry = (*it).first;
double val = (*it).second;
// --
GEOM::GEOM_Object_var aGeomObj;
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();
}
TopoDS_Shape S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
::SetLocalSize(S, val);
}
}
}
@ -1630,7 +1626,7 @@ void NETGENPlugin_Mesher::AddIntVerticesInSolids(const netgen::OCCGeometry&
ofstream py(DUMP_TRIANGLES_SCRIPT);
py << "import SMESH"<< endl
<< "from salome.smesh import smeshBuilder"<<endl
<< "smesh = smeshBuilder.New(salome.myStudy)"<<endl
<< "smesh = smeshBuilder.New()"<<endl
<< "m = smesh.Mesh(name='triangles')" << endl;
#endif
if ((int) nodeVec.size() < ngMesh.GetNP() )
@ -3483,7 +3479,7 @@ void NETGENPlugin_Mesher::toPython( const netgen::Mesh* ngMesh )
outfile << "import SMESH" << endl
<< "from salome.smesh import smeshBuilder" << endl
<< "smesh = smeshBuilder.New(salome.myStudy)" << endl
<< "smesh = smeshBuilder.New()" << endl
<< "mesh = smesh.Mesh()" << endl << endl;
using namespace netgen;