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(200., 200., 200.)
# Retrieve and print the list of enforced vertices defines on Face_1
enfList = algo2d.GetEnforcedVertices(Face_1)
-print "List of enforced vertices for Face_1: "
-print enfList
+print("List of enforced vertices for Face_1: ")
+print(enfList)
# compute the mesh
cadsurfMesh.Compute()
# Remove an enforced vertex and print the list
algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50)
enfList = algo2d.GetEnforcedVertices(Face_1)
-print "List of enforced vertices for Face_1: "
-print enfList
+print("List of enforced vertices for Face_1: ")
+print(enfList)
# compute the mesh
cadsurfMesh.Compute()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
simple = False
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
checkProjection(gr_back, front_translated)
checkProjection(gr_top, bottom_translated)
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
if noBLSURFPlugin:
- print "Warning: BLSURFPlugin module unavailable"
+ print("Warning: BLSURFPlugin module unavailable")
if mesh.GetMesh().HasShapeToMesh():
self.Create(mesh, geom, self.algoType, LIBRARY)
else:
# <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
def SetTopology(self, way):
if way != PreCAD and way != FromCAD:
- print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
+ print("Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way)
way = FromCAD
self.Parameters().SetTopology(way)
pass
for f in faces:
ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
else:
- raise TypeError, \
- "Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face)
+ raise TypeError("Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face))
pass
hpl.append( ids )
pass
"""
Obsolete function. Use SetMinSize.
"""
- print "Warning: SetPhyMin is obsolete. Please use SetMinSize"
+ print("Warning: SetPhyMin is obsolete. Please use SetMinSize")
self.SetMinSize(theVal)
pass
"""
Obsolete function. Use SetMaxSize.
"""
- print "Warning: SetPhyMax is obsolete. Please use SetMaxSize"
+ print("Warning: SetPhyMax is obsolete. Please use SetMaxSize")
self.SetMaxSize(theVal)
pass
"""
Obsolete function. Use SetAngleMesh.
"""
- print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh"
+ print("Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh")
self.SetAngleMesh(theVal)
pass
"""
Obsolete function. Use SetAngleMesh.
"""
- print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh"
+ print("Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh")
self.SetAngleMesh(theVal)
pass
"""
Obsolete function. Use SetMinSize.
"""
- print "Warning: SetGeoMin is obsolete. Please use SetMinSize"
+ print("Warning: SetGeoMin is obsolete. Please use SetMinSize")
self.SetMinSize(theVal)
pass
"""
Obsolete function. Use SetMaxSize.
"""
- print "Warning: SetGeoMax is obsolete. Please use SetMaxSize"
+ print("Warning: SetGeoMax is obsolete. Please use SetMaxSize")
self.SetMaxSize(theVal)
pass
static PyTypeObject PyStdOut_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"PyOut", /*tp_name*/
sizeof(PyStdOut), /*tp_basicsize*/
0, /*tp_itemsize*/
//=============================================================================
BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId,
- int studyId,
SMESH_Gen* gen,
bool theHasGEOM)
- : SMESH_2D_Algo(hypId, studyId, gen)
+ : SMESH_2D_Algo(hypId, gen)
{
_name = theHasGEOM ? "MG-CADSurf" : "MG-CADSurf_NOGEOM";//"BLSURF";
_shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
_supportSubmeshes = true;
_requireShape = theHasGEOM;
- smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
-
- myStudy = NULL;
- myStudy = aStudyMgr->GetStudyByID(_studyId);
-
/* Initialize the Python interpreter */
assert(Py_IsInitialized());
PyGILState_STATE gstate;
/////////////////////////////////////////////////////////
TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
{
- TopoDS_Shape S;
- if ( !entry.empty() )
- {
- 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();
- }
- if ( !aGeomObj->_is_nil() )
- S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
- }
+ GEOM::GEOM_Object_var aGeomObj;
+ TopoDS_Shape S = TopoDS_Shape();
+ 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 = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
return S;
}
class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
public:
- BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen, bool theHasGEOM);
+ BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
virtual ~BLSURFPlugin_BLSURF();
PyObject * main_mod;
PyObject * main_dict;
SMESH_MesherHelper* myHelper;
- SALOMEDS::Study_var myStudy;
- SMESH_Gen_i* smeshGen_i;
volatile bool _compute_canceled;
};
//=============================================================================
BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl,
bool theHasGEOM )
: SALOME::GenericObj_i( thePOA ),
SMESH_2D_Algo_i( thePOA )
{
myBaseImpl = new ::BLSURFPlugin_BLSURF( theGenImpl->GetANewId(),
- theStudyId,
theGenImpl,
theHasGEOM);
}
public:
// Constructor
BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl,
bool theHasGEOM);
// Destructor
}
//=============================================================================
-BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom) :
- SMESH_Hypothesis(hypId, studyId, gen),
+BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom) :
+ SMESH_Hypothesis(hypId, gen),
_physicalMesh(GetDefaultPhysicalMesh()),
_geometricMesh(GetDefaultGeometricMesh()),
_phySize(GetDefaultPhySize()),
TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
{
GEOM::GEOM_Object_var aGeomObj;
- SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
TopoDS_Shape S = TopoDS_Shape();
- SALOMEDS::SObject_var aSObj = myStudy->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;
}
class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
{
public:
- BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom);
+ BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
enum Topology {
FromCAD,
*/
typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
- typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO Ã finir
+ typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
std::string GetClassAttractorEntry(const std::string& entry);
*/
//=============================================================================
BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl,
bool theHasGEOM) :
SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
{
myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
- theStudyId,
+
theGenImpl,
theHasGEOM);
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO Ã finir
+void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
// //=============================================================================
//
-// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
+// // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
// // A finir pour le dump
// char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
// throw (SALOME::SALOME_Exception)
theAttEntry = theAttractor->GetStudyEntry();
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFaceEntry.empty()) {
aName = "Face_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theAttractor->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theAttractor->GetEntry();
- SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
+ SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
if (!theSAtt->_is_nil())
theAttEntry = theSAtt->GetID();
}
CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
// GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
// string aName;
// if (theFaceEntry.empty()) {
// aName = "Face_";
// aName += theFace->GetEntry();
- // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
// if (!theSFace->_is_nil())
// theFaceEntry = theSFace->GetID();
// }
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
}
// GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
+ // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
// if (CORBA::is_nil(measureOp))
// return false;
//
string theVertexEntry = theVertex->GetStudyEntry();
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
string theVertexEntry = theVertex->GetStudyEntry();
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
// if (theFaceEntry.empty()) {
// GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
-// SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
// string aName;
// if (theFace->GetShapeType() == GEOM::FACE)
// aName = "Face_";
// if (theFace->GetShapeType() == GEOM::COMPOUND)
// aName = "Compound_";
// aName += theFace->GetEntry();
-// SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+// SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
// if (!theSFace->_is_nil())
// theFaceEntry = theSFace->GetID();
// }
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
}
// GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
+ // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
// if (CORBA::is_nil(measureOp))
// return false;
//
std::string theVertexEntry = theVertex->GetStudyEntry();
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
if (theVertex->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
if (theFace->GetShapeType() == GEOM::COMPOUND)
aName = "Compound_";
aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
string shapeEntry = shape->GetStudyEntry();
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
// Publish shape if needed
if (shape->GetShapeType() == theShapeType)
aName = prefix;
aName += shape->GetEntry();
- SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
+ SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
if (!theSFace1->_is_nil())
shapeEntry = theSFace1->GetID();
}
public:
// Constructor
BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl,
bool theHasGEOM);
// Destructor
{
// Create a hypothesis
virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
- int theStudyId,
::SMESH_Gen* theGenImpl)
{
- return new T (thePOA, theStudyId, theGenImpl, !NOGEOM);
+ return new T (thePOA, theGenImpl, !NOGEOM);
}
// as we have 'module BLSURFPlugin' in BLSURFPlugin_Algorithm.idl
// BLSURFPluginGUI_StdWidget
//////////////////////////////////////////
-#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
+// WARNING: include order is important, do not swap !
#include "BLSURFPluginGUI_HypothesisCreator.h"
+#include "ui_BLSURFPluginGUI_StdWidget_QTD.h"
class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_StdWidget : public QWidget,
public Ui::BLSURFPluginGUI_StdWidget_QTD
static PyTypeObject PyStdOut_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"PyOut", /*tp_name*/
sizeof(PyStdOut), /*tp_basicsize*/
0, /*tp_itemsize*/
GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const
{
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_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;
}
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_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;
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;
CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
{
- SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var myStudy = smeshGen_i->GetCurrentStudy();
CORBA::Object_var obj;
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
+ SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.toStdString().c_str() );
if (!aSObj->_is_nil()) {
obj = aSObj->GetObject();
aSObj->UnRegister();
import salome
salome.salome_init()
-theStudy = salome.myStudy
import SMESH, SALOMEDS
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Face_1)
MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
min_area_without_attractor = getMinArea(Mesh_1)
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
min_area_with_attractor = getMinArea(Mesh_1)
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
assert min_area_with_attractor < min_area_without_attractor
import salome
salome.salome_init()
-theStudy = salome.myStudy
import SMESH, SALOMEDS
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Box_1)
MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
min_area_without_attractor = getMinArea(Mesh_1)
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
min_area_with_attractor = getMinArea(Mesh_1)
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
assert min_area_with_attractor < min_area_without_attractor
import salome
salome.salome_init()
-theStudy = salome.myStudy
import SMESH, SALOMEDS
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Part_1)
MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
min_area_without_attractor = getMinArea(Mesh_1)
-print "min_area_without_attractor: ", min_area_without_attractor
+print("min_area_without_attractor: ", min_area_without_attractor)
MG_CADSurf_Parameters_1.SetAttractorGeom( face_1, edge_vert_opp_1, 1, 14.1421, 5, 5 )
# the attractor is not on the face. It is done on purpose to test this out of bounds case.
min_area_with_attractor = getMinArea(Mesh_1)
-print "min_area_with_attractor: ", min_area_with_attractor
+print("min_area_with_attractor: ", min_area_with_attractor)
assert min_area_with_attractor < min_area_without_attractor
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
r = 10
dist = 10
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
dist_coin = 10.1
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(box, "Mesh")
"%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
+
import multiprocessing
salome.salome_init()
-theStudy = salome.myStudy
cpu_count = multiprocessing.cpu_count()
divider = min(4, cpu_count)/2.
-print "Running test on workstation with %d available cores" % cpu_count
+print ("Running test on workstation with %d available cores" % cpu_count)
###
### GEOM component
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(flight_solid_brep_1)
MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
time_multithread = time1-time0
-print "Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread)
+print ("Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread))
Mesh_2 = smesh.Mesh(flight_solid_brep_1)
MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
time3 = time.time()
time_singlethread = time3-time2
-print "Time in single thread (1 proc): %.3s"%(time_singlethread)
+print ("Time in single thread (1 proc): %.3s"%(time_singlethread))
if cpu_count == 1:
- print "Warning: cannot validate test - only 1 cpu core is available"
+ print ("Warning: cannot validate test - only 1 cpu core is available")
else:
assert time_multithread < time_singlethread/divider
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
checkProjection(gr_top, bottom_translated)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
#raise Exception("Projection failed for %s"%name)
- print "Projection failed for %s"%name
+ print("Projection failed for %s"%name)
checkProjection(gr_right, bottom_rotated)
-#salome.myStudyManager.SaveAs("test.hdf", salome.myStudy, 0)
+#salome.myStudy.SaveAs("test.hdf", 0, 0)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
simple = False
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
checkProjection(gr_front, left_rotated)
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
checkProjection(gr_top, bottom_translated)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import salome
salome.salome_init()
-theStudy = salome.myStudy
###
### GEOM component
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
-geompy.init_geom(theStudy)
+geompy.init_geom()
Face_1 = geompy.MakeFaceHW(10, 10, 1)
Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Partition_1)
assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import salome
salome.salome_init()
-theStudy = salome.myStudy
###
### GEOM component
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
-geompy.init_geom(theStudy)
+geompy.init_geom()
Face_1 = geompy.MakeFaceHW(10, 10, 1)
Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Partition_1)
assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import salome
salome.salome_init()
-theStudy = salome.myStudy
###
### GEOM component
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
# Create a box
box = geompy.MakeBoxDXDYDZ(100, 100, 100)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(part, "Mesh_part")
BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
BLSURF_Parameters_1 = BLSURF.Parameters()
# Check the minimal area of the box faces to check the proximity
min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
-print "min_area: ", min_area
+print("min_area: ", min_area)
if min_area > 1.5:
raise Exception("Wrong minimal area on box. Proximity has not worked.")
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import salome
salome.salome_init()
-theStudy = salome.myStudy
###
### GEOM component
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
from salome.BLSURFPlugin import BLSURFPluginBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Partition_1)
MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
import math
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
# Test gradation with quadrangles
Mesh_1 = smesh.Mesh(part, "Mesh")
raise Exception("Number of faces of Mesh_2 incorrect")
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
import math
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh = smesh.Mesh(part, "Mesh")
min_length = min(edges_length)
x1, y1, z1 = Mesh.GetNodeXYZ(node)
-print min_length
+print(min_length)
if min_length<tiny_edge_length:
raise Exception("Small edge has not been removed")
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
import salome
salome.salome_init()
-theStudy = salome.myStudy
###
### GEOM component
import GEOM
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
-geompy.init_geom(theStudy)
+geompy.init_geom()
sphere = geompy.MakeSphereR(10)
geompy.addToStudy( sphere, 'sphere' )
import SMESH
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(sphere)
if not ok:
raise Exception("Error when computing volume mesh")
except AttributeError:
- print "Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable"
+ print("Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable")
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()