Modification of SMESH_Gen interface

This commit is contained in:
vsv 2019-12-09 16:09:31 +03:00
parent b311e0ddf7
commit c7e6dcf72a
8 changed files with 103 additions and 118 deletions

View File

@ -903,9 +903,7 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
{
if ( theGeom->_is_nil() )
return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
myBelongToGeomPtr->SetGeom( aLocShape );
TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
}
@ -1001,9 +999,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
{
if ( theGeom->_is_nil() )
return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
if ( aLocShape.ShapeType() == TopAbs_FACE )
{
@ -1173,9 +1169,7 @@ void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
{
if ( theGeom->_is_nil() )
return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
myLyingOnGeomPtr->SetGeom( aLocShape );
TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
}

View File

@ -157,7 +157,7 @@ static int MYDEBUG = 0;
#endif
// Static variables definition
GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen = GEOM::GEOM_Gen::_nil();
GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen;
CORBA::ORB_var SMESH_Gen_i::myOrb;
PortableServer::POA_var SMESH_Gen_i::myPoa;
SALOME_NamingService* SMESH_Gen_i::myNS = NULL;
@ -258,14 +258,15 @@ SALOME_NamingService* SMESH_Gen_i::GetNS()
* Get SALOME_LifeCycleCORBA object
*/
//=============================================================================
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC()
{
if ( myLCC == NULL ) {
myLCC = new SALOME_LifeCycleCORBA( GetNS() );
}
return myLCC;
}
//=============================================================================
/*!
* GetGeomEngine [ static ]
@ -273,18 +274,33 @@ SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
* Get GEOM::GEOM_Gen reference
*/
//=============================================================================
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine() {
//CCRT GEOM::GEOM_Gen_var aGeomEngine =
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
//CCRT return aGeomEngine._retn();
if(CORBA::is_nil(myGeomGen))
{
Engines::EngineComponent_ptr temp=GetLCC()->FindOrLoad_Component("FactoryServer","GEOM");
myGeomGen=GEOM::GEOM_Gen::_narrow(temp);
}
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( bool isShaper )
{
Engines::EngineComponent_ptr temp =
GetLCC()->FindOrLoad_Component( isShaper ? "FactoryServerPy" : "FactoryServer",
isShaper ? "SHAPERSTUDY" : "GEOM" );
myGeomGen = GEOM::GEOM_Gen::_narrow( temp );
return myGeomGen;
}
//=============================================================================
/*!
* GetGeomEngine [ static ]
*
* Get GEOM::GEOM_Gen reference
*/
//=============================================================================
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( GEOM::GEOM_Object_ptr go )
{
GEOM::GEOM_Gen_var gen;
if ( !CORBA::is_nil( go ))
gen = go->GetGen();
return gen;
}
//=============================================================================
/*!
* SMESH_Gen_i::SMESH_Gen_i
@ -687,11 +703,18 @@ void SMESH_Gen_i::UpdateStudy()
myStudyContext = new StudyContext;
SALOMEDS::Study_var aStudy = getStudyServant();
if ( !CORBA::is_nil( aStudy ) ) {
if ( !CORBA::is_nil( aStudy ) )
{
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SComponent_wrap GEOM_var = aStudy->FindComponent( "GEOM" );
if( !GEOM_var->_is_nil() )
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/false ) );
GEOM_var = aStudy->FindComponent( "SHAPERSTUDY" );
if( !GEOM_var->_is_nil() )
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/true ) );
// NPAL16168, issue 0020210
// Let meshes update their data depending on GEOM groups that could change
CORBA::String_var compDataType = ComponentDataType();
@ -2305,7 +2328,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine( geom );
// try to find the corresponding SObject
SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() );
@ -2369,7 +2392,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine( mainShape );
// get a core mesh DS
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
@ -3052,7 +3075,7 @@ namespace // utils for CopyMeshWithGeom()
std::string newMainEntry = newEntry.in();
SALOMEDS::Study_var study = myGen_i->getStudyServant();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
mySubshapes = op->GetExistingSubObjects( mainShapeNew,
/*groupsOnly=*/false );
@ -3107,7 +3130,7 @@ namespace // utils for CopyMeshWithGeom()
return GEOM::GEOM_Object::_duplicate( oldShape ); // shape independent of the old shape
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
// try to find by entry or name
if ( myToPublish )
@ -3329,7 +3352,7 @@ namespace // utils for CopyMeshWithGeom()
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Object_var mainShapeOld = mySrcMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
try
{
@ -3351,7 +3374,7 @@ namespace // utils for CopyMeshWithGeom()
GEOM::GEOM_Object_var newShape;
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
try
{
@ -5021,23 +5044,6 @@ SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent
return anAsciiStreamFile._retn();
}
//=============================================================================
/*!
* SMESH_Gen_i::loadGeomData
*
* Load GEOM module data
*/
//=============================================================================
void SMESH_Gen_i::loadGeomData( SALOMEDS::SComponent_ptr theCompRoot )
{
if ( theCompRoot->_is_nil() )
return;
SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
}
//=============================================================================
/*!
* SMESH_Gen_i::Load
@ -5051,17 +5057,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile )
{
// localizing
UpdateStudy(); // load geom data
Kernel_Utils::Localizer loc;
//if (!myStudyContext)
UpdateStudy();
SALOMEDS::Study_var aStudy = getStudyServant();
/* if( !theComponent->_is_nil() )
{
if( !aStudy->FindComponent( "GEOM" )->_is_nil() )
loadGeomData( aStudy->FindComponent( "GEOM" ) );
}*/
// Get temporary files location
TCollection_AsciiString tmpDir =
@ -5383,11 +5382,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aDataset->CloseOnDisk();
if ( strlen( refFromFile ) > 0 ) {
SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile );
// Make sure GEOM data are loaded first
//loadGeomData( shapeSO->GetFatherComponent() );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
if ( !CORBA::is_nil( shapeObject ) ) {
aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
if ( !aShapeObject->_is_nil() )

View File

@ -109,7 +109,8 @@ public:
// Get SALOME_LifeCycleCORBA object
static SALOME_LifeCycleCORBA* GetLCC();
// Retrieve and get GEOM engine reference
static GEOM::GEOM_Gen_var GetGeomEngine();
static GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper );
static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
// Get object of the CORBA reference
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
// Get CORBA object corresponding to the SALOMEDS::SObject
@ -635,8 +636,6 @@ private:
void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus,
const char* theCommandNameForPython,

View File

@ -252,9 +252,10 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha
TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
{
TopoDS_Shape S;
if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) {
GEOM_Client* aClient = GetShapeReader();
GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine();
if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() )
{
GEOM_Client* aClient = GetShapeReader();
GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine( theGeomObject );
if ( aClient && !aGeomEngine->_is_nil () )
S = aClient->GetShape( aGeomEngine, theGeomObject );
}
@ -263,7 +264,7 @@ TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
//=======================================================================
//function : publish
//purpose :
//purpose :
//=======================================================================
static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,

View File

@ -1980,7 +1980,7 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
if ( groupSO->_is_nil() )
return;
// group indices
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( theGeomObj );
GEOM::GEOM_IGroupOperations_wrap groupOp =
geomGen->GetIGroupOperations();
GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
@ -2039,7 +2039,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
// get indices of group items
set<int> curIndices;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( geomGroup );
GEOM::GEOM_IGroupOperations_wrap groupOp =
geomGen->GetIGroupOperations();
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
@ -2227,7 +2227,7 @@ void SMESH_Mesh_i::CheckGeomModif()
GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( mainGO );
if ( geomGen->_is_nil() ) return;
CORBA::String_var ior = geomGen->GetStringFromIOR( mainGO );

View File

@ -1061,12 +1061,15 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
isHistoricalDump );
bool importGeom = false;
GEOM::GEOM_Gen_ptr geom = GetGeomEngine();
GEOM::GEOM_Gen_ptr geom[2];
for ( int isShaper = 0; isShaper < 2; ++isShaper )
{
geom[ isShaper ] = GetGeomEngine( isShaper );
if ( CORBA::is_nil( geom[ isShaper ]))
continue;
// Add names of GEOM objects to theObjectNames to exclude same names of SMESH objects
GEOM::string_array_var aGeomNames = geom->GetAllDumpNames();
int ign = 0, nbgn = aGeomNames->length();
for (; ign < nbgn; ign++) {
GEOM::string_array_var aGeomNames = geom[ isShaper ]->GetAllDumpNames();
for ( CORBA::ULong ign = 0; ign < aGeomNames->length(); ign++) {
TCollection_AsciiString aName = aGeomNames[ign].in();
theObjectNames.Bind(aName, "1");
}
@ -1100,7 +1103,11 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
anUpdatedScript += aLine.SubString( aStart, aSeq->Value(i) - 1 ); // line part before i-th entry
anEntry = aLine.SubString( aSeq->Value(i), aSeq->Value(i + 1) );
// is a GEOM object?
CORBA::String_var geomName = geom->GetDumpName( anEntry.ToCString() );
CORBA::String_var geomName;
if ( !CORBA::is_nil( geom[0] ))
geomName = geom[0]->GetDumpName( anEntry.ToCString() );
if (( !geomName.in() || !geomName.in()[0] ) && !CORBA::is_nil( geom[1] ))
geomName = geom[1]->GetDumpName( anEntry.ToCString() );
if ( !geomName.in() || !geomName.in()[0] ) {
// is a SMESH object
if ( theObjectNames.IsBound( anEntry )) {

View File

@ -318,27 +318,13 @@ def AssureGeomPublished(mesh, geom, name=''):
mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
return
def FirstVertexOnCurve(mesh, edge):
"""
Returns:
the first vertex of a geometrical edge by ignoring orientation
"""
vv = mesh.geompyD.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"])
if not vv:
raise TypeError("Given object has no vertices")
if len( vv ) == 1: return vv[0]
v0 = mesh.geompyD.MakeVertexOnCurve(edge,0.)
xyz = mesh.geompyD.PointCoordinates( v0 ) # coords of the first vertex
xyz1 = mesh.geompyD.PointCoordinates( vv[0] )
xyz2 = mesh.geompyD.PointCoordinates( vv[1] )
dist1, dist2 = 0,0
for i in range(3):
dist1 += abs( xyz[i] - xyz1[i] )
dist2 += abs( xyz[i] - xyz2[i] )
if dist1 < dist2:
return vv[0]
else:
return vv[1]
# def FirstVertexOnCurve(mesh, edge):
# """
# Returns:
# the first vertex of a geometrical edge by ignoring orientation
# """
# return mesh.geompyD.GetVertexByIndex( edge, 0, False )
smeshInst = None
"""
@ -531,8 +517,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
Returns:
:class:`SMESH.PointStruct`
"""
[x, y, z] = self.geompyD.PointCoordinates(theVertex)
geompyD = theVertex.GetGen()
[x, y, z] = geompyD.PointCoordinates(theVertex)
return PointStruct(x,y,z)
def GetDirStruct(self,theVector):
@ -545,13 +531,13 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
Returns:
:class:`SMESH.DirStruct`
"""
vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
geompyD = theVector.GetGen()
vertices = geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
if(len(vertices) != 2):
print("Error: vector object is incorrect.")
return None
p1 = self.geompyD.PointCoordinates(vertices[0])
p2 = self.geompyD.PointCoordinates(vertices[1])
p1 = geompyD.PointCoordinates(vertices[0])
p2 = geompyD.PointCoordinates(vertices[1])
pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
dirst = DirStruct(pnt)
return dirst
@ -581,28 +567,29 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
:class:`SMESH.AxisStruct`
"""
import GEOM
edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
geompyD = theObj.GetGen()
edges = geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
axis = None
if len(edges) > 1:
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex1 = self.geompyD.PointCoordinates(vertex1)
vertex2 = self.geompyD.PointCoordinates(vertex2)
vertex3 = self.geompyD.PointCoordinates(vertex3)
vertex4 = self.geompyD.PointCoordinates(vertex4)
vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex3, vertex4 = geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex1 = geompyD.PointCoordinates(vertex1)
vertex2 = geompyD.PointCoordinates(vertex2)
vertex3 = geompyD.PointCoordinates(vertex3)
vertex4 = geompyD.PointCoordinates(vertex4)
v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ]
axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
axis._mirrorType = SMESH.SMESH_MeshEditor.PLANE
elif len(edges) == 1:
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
p1 = self.geompyD.PointCoordinates( vertex1 )
p2 = self.geompyD.PointCoordinates( vertex2 )
vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
p1 = geompyD.PointCoordinates( vertex1 )
p2 = geompyD.PointCoordinates( vertex2 )
axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
axis._mirrorType = SMESH.SMESH_MeshEditor.AXIS
elif theObj.GetShapeType() == GEOM.VERTEX:
x,y,z = self.geompyD.PointCoordinates( theObj )
x,y,z = geompyD.PointCoordinates( theObj )
axis = AxisStruct( x,y,z, 1,0,0,)
axis._mirrorType = SMESH.SMESH_MeshEditor.POINT
return axis
@ -972,7 +959,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
name = aCriterion.ThresholdStr
if not name:
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
geompyD = aThreshold.GetGen()
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
# or a name of GEOM object
elif isinstance( aThreshold, str ):
aCriterion.ThresholdStr = aThreshold
@ -1023,7 +1011,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
name = aThreshold.GetName()
if not name:
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
geompyD = aThreshold.GetGen()
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
elif isinstance(aThreshold, int): # node id
aCriterion.Threshold = aThreshold
elif isinstance(aThreshold, list): # 3 point coordinates
@ -1633,14 +1622,15 @@ class Mesh(metaclass = MeshMeta):
Parameters:
theMesh: a :class:`SMESH.SMESH_Mesh` object
"""
# do not call Register() as this prevents mesh servant deletion at closing study
#if self.mesh: self.mesh.UnRegister()
self.mesh = theMesh
if self.mesh:
#self.mesh.Register()
self.geom = self.mesh.GetShapeToMesh()
if self.geom:
self.geompyD = self.geom.GetGen()
pass
pass
def GetMesh(self):

View File

@ -392,7 +392,6 @@ class Mesh_Algorithm:
into a list acceptable to SetReversedEdges() of some 1D hypotheses
"""
from salome.smesh.smeshBuilder import FirstVertexOnCurve
resList = []
geompy = self.mesh.geompyD
for i in reverseList:
@ -417,7 +416,7 @@ class Mesh_Algorithm:
if e.GetShapeType() != geomBuilder.GEOM.EDGE or \
v.GetShapeType() != geomBuilder.GEOM.VERTEX:
raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)")
vFirst = FirstVertexOnCurve( self.mesh, e )
vFirst = geompy.GetVertexByIndex( e, 0, False )
tol = geompy.Tolerance( vFirst )[-1]
if geompy.MinDistance( v, vFirst ) > 1.5*tol:
resList.append( geompy.GetSubShapeID(self.mesh.geom, e ))