Merge remote-tracking branch 'origin/master'

This commit is contained in:
Paul RASCLE 2018-07-26 19:36:06 +02:00
commit c600d3a4e7
12 changed files with 128 additions and 69 deletions

View File

@ -127,7 +127,7 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py", for
if hasattr( algo, "docHelper" ): docHelper = getattr( algo, "docHelper" ) if hasattr( algo, "docHelper" ): docHelper = getattr( algo, "docHelper" )
if docHelper: break if docHelper: break
pass pass
if not docHelper: docHelper = "Creates new algorithm." if not docHelper: docHelper = "Create new algorithm."
if format == "doxygen": if format == "doxygen":
output.append( " ## %s" % docHelper ) output.append( " ## %s" % docHelper )
output.append( " #" ) output.append( " #" )

View File

@ -48,6 +48,7 @@ Constructing meshes
Mesh.Clear Mesh.Clear
Mesh.GetMesh Mesh.GetMesh
Mesh.GetShape Mesh.GetShape
Mesh.HasShapeToMesh
Mesh.GetComputeErrors Mesh.GetComputeErrors
Mesh.GetAlgoState Mesh.GetAlgoState
Mesh.GetFailedShapes Mesh.GetFailedShapes

View File

@ -800,8 +800,9 @@ module SMESH
/*! /*!
* Fill with 2D elements a hole defined by a FreeBorder. * Fill with 2D elements a hole defined by a FreeBorder.
* Optionally add new faces to a given group, which is returned.
*/ */
void FillHole(in FreeBorder hole) SMESH_Group FillHole(in FreeBorder hole, in string groupName)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!

View File

@ -3043,7 +3043,7 @@ bool ConnectedElements::IsSatisfy( long theElementId )
{ {
// keep elements of myType // keep elements of myType
const SMDS_MeshElement* element = eIt->next(); const SMDS_MeshElement* element = eIt->next();
if ( element->GetType() == myType ) if ( myType == SMDSAbs_All || element->GetType() == myType )
myOkIDs.insert( myOkIDs.end(), element->GetID() ); myOkIDs.insert( myOkIDs.end(), element->GetID() );
// enqueue nodes of the element // enqueue nodes of the element
@ -4869,7 +4869,7 @@ bool BelongToGeom::IsSatisfy (long theId)
{ {
if ( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId )) if ( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ))
{ {
if ( anElem->GetType() == myType ) if ( myType == SMDSAbs_All || anElem->GetType() == myType )
{ {
if ( anElem->getshapeId() < 1 ) if ( anElem->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId); return myElementsOnShapePtr->IsSatisfy(theId);
@ -5009,7 +5009,8 @@ bool LyingOnGeom::IsSatisfy( long theId )
if ( mySubShapesIDs.Contains( elem->getshapeId() )) if ( mySubShapesIDs.Contains( elem->getshapeId() ))
return true; return true;
if ( elem->GetType() != SMDSAbs_Node && elem->GetType() == myType ) if (( elem->GetType() != SMDSAbs_Node ) &&
( myType == SMDSAbs_All || elem->GetType() == myType ))
{ {
SMDS_ElemIteratorPtr nodeItr = elem->nodesIterator(); SMDS_ElemIteratorPtr nodeItr = elem->nodesIterator();
while ( nodeItr->more() ) while ( nodeItr->more() )

View File

@ -1347,8 +1347,8 @@ bool SMESH_Mesh::IsComputedOK()
if ( NbNodes() == 0 ) if ( NbNodes() == 0 )
return false; return false;
if ( !HasShapeToMesh() ) // if ( !HasShapeToMesh() )
return true; // return true;
if ( SMESH_subMesh* mainSM = GetSubMeshContaining( 1 )) if ( SMESH_subMesh* mainSM = GetSubMeshContaining( 1 ))
{ {

View File

@ -891,8 +891,10 @@ void SMESH_Gen_i::UpdateIcons( SMESH::SMESH_Mesh_ptr theMesh )
SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN" ); SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN" );
else if ( mesh_i->IsComputedOK() ) else if ( mesh_i->IsComputedOK() )
SetPixMap( so, "ICON_SMESH_TREE_MESH" ); SetPixMap( so, "ICON_SMESH_TREE_MESH" );
else else if ( mesh_i->HasShapeToMesh() )
SetPixMap( so, "ICON_SMESH_TREE_MESH_PARTIAL" ); SetPixMap( so, "ICON_SMESH_TREE_MESH_PARTIAL" );
else
SetPixMap( so, "ICON_SMESH_TREE_MESH_IMPORTED" );
// set icons of sub-objects // set icons of sub-objects
SALOMEDS::Study_var study = getStudyServant(); SALOMEDS::Study_var study = getStudyServant();

View File

@ -4751,7 +4751,9 @@ SMESH::ListOfFreeBorders* SMESH_MeshEditor_i::FindFreeBorders(CORBA::Boolean clo
//purpose : Fill with 2D elements a hole defined by a FreeBorder. //purpose : Fill with 2D elements a hole defined by a FreeBorder.
//======================================================================= //=======================================================================
void SMESH_MeshEditor_i::FillHole(const SMESH::FreeBorder& theHole) SMESH::SMESH_Group_ptr
SMESH_MeshEditor_i::FillHole(const SMESH::FreeBorder& theHole,
const char* theGroupName)
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
initData(); initData();
@ -4774,6 +4776,7 @@ void SMESH_MeshEditor_i::FillHole(const SMESH::FreeBorder& theHole)
SMESH_TRY; SMESH_TRY;
// prepare a preview mesh
MeshEditor_I::TPreviewMesh* previewMesh = 0; MeshEditor_I::TPreviewMesh* previewMesh = 0;
SMDS_Mesh* meshDS = getMeshDS(); SMDS_Mesh* meshDS = getMeshDS();
if ( myIsPreviewMode ) if ( myIsPreviewMode )
@ -4796,26 +4799,66 @@ void SMESH_MeshEditor_i::FillHole(const SMESH::FreeBorder& theHole)
meshDS = previewMesh->GetMeshDS(); meshDS = previewMesh->GetMeshDS();
} }
// fill the hole
std::vector<const SMDS_MeshElement*> newFaces; std::vector<const SMDS_MeshElement*> newFaces;
SMESH_MeshAlgos::FillHole( bordNodes, *meshDS, newFaces ); SMESH_MeshAlgos::FillHole( bordNodes, *meshDS, newFaces );
if ( myIsPreviewMode ) if ( myIsPreviewMode )
{ {
// show new faces
previewMesh->Clear(); previewMesh->Clear();
for ( size_t i = 0; i < newFaces.size(); ++i ) for ( size_t i = 0; i < newFaces.size(); ++i )
previewMesh->Copy( newFaces[i] ); previewMesh->Copy( newFaces[i] );
} }
else else
{ {
// return new faces via a group
SMESH::SMESH_Group_var group;
if ( theGroupName && theGroupName[0] && !newFaces.empty() )
{
SMESH::ListOfGroups_var groups = myMesh_i->GetGroups();
for ( CORBA::ULong i = 0; i < groups->length(); ++i )
{
SMESH::SMESH_GroupBase_var g = groups[ i ];
if ( g->GetType() != SMESH::FACE ) continue;
SMESH::SMESH_Group_var standalone = SMESH::SMESH_Group::_narrow( g );
if ( standalone->_is_nil() ) continue;
CORBA::String_var name = g->GetName();
if ( strcmp( theGroupName, name.in() ) == 0 )
{
group = standalone;
break;
}
}
if ( group->_is_nil() )
group = myMesh_i->CreateGroup( SMESH::FACE, theGroupName );
if ( !group->_is_nil() )
{
SMESH_GroupBase_i * grpI = SMESH::DownCast< SMESH_GroupBase_i* >( group );
SMESHDS_Group* grpDS = static_cast< SMESHDS_Group* >( grpI->GetGroupDS() );
for ( size_t i = 0; i < newFaces.size(); ++i )
grpDS->Add( newFaces[ i ]);
}
}
// fill LastCreated
getEditor().ClearLastCreated(); getEditor().ClearLastCreated();
SMESH_SequenceOfElemPtr& aSeq = SMESH_SequenceOfElemPtr& aSeq =
const_cast<SMESH_SequenceOfElemPtr&>( getEditor().GetLastCreatedElems() ); const_cast<SMESH_SequenceOfElemPtr&>( getEditor().GetLastCreatedElems() );
aSeq.swap( newFaces ); aSeq.swap( newFaces );
TPythonDump() << this << ".FillHole( SMESH.FreeBorder(" << theHole.nodeIDs << " ))"; TPythonDump pyDump;
if ( group->_is_nil() ) pyDump << "_group = ";
else pyDump << group << " = ";
pyDump << this << ".FillHole( SMESH.FreeBorder(" << theHole.nodeIDs << " ))";
return group._retn();
} }
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
return SMESH::SMESH_Group::_nil();
} }
//======================================================================= //=======================================================================

View File

@ -573,8 +573,10 @@ public:
/*! /*!
* Fill with 2D elements a hole defined by a FreeBorder. * Fill with 2D elements a hole defined by a FreeBorder.
* Optionally add new faces to a given group, which is returned
*/ */
void FillHole(const SMESH::FreeBorder& hole) SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
const char* groupName)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance); SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);

View File

@ -38,7 +38,7 @@ import math
def MakeFace(lstEdges) : def MakeFace(lstEdges) :
""" """
Creates a planar face from 4 edges Create a planar face from 4 edges
""" """
wire = geompy.MakeWire(lstEdges) wire = geompy.MakeWire(lstEdges)
face = geompy.MakeFace(wire, 1) face = geompy.MakeFace(wire, 1)

View File

@ -107,7 +107,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates segment 1D algorithm for edges" docHelper = "Create segment 1D algorithm for edges"
""" """
doc string of the method doc string of the method
""" """
@ -131,7 +131,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
Parameters: Parameters:
l : for the length of segments that cut an edge l : for the length of segments that cut an edge
UseExisting : if == true - searches for an existing hypothesis created with UseExisting : if == true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
p : precision, used for calculation of the number of segments. p : precision, used for calculation of the number of segments.
The precision should be a positive, meaningful value within the range [0,1]. The precision should be a positive, meaningful value within the range [0,1].
In general, the number of segments is calculated with the formula: In general, the number of segments is calculated with the formula:
@ -161,7 +161,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
length : is optional maximal allowed length of segment, if it is omitted length : is optional maximal allowed length of segment, if it is omitted
the preestimated length is used that depends on geometry size the preestimated length is used that depends on geometry size
UseExisting : if ==true - searches for an existing hypothesis created with UseExisting : if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_MaxLength hypothesis an instance of StdMeshers_MaxLength hypothesis
@ -252,7 +252,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
maxSize: defines the maximal allowed segment length maxSize: defines the maximal allowed segment length
deflection: defines the maximal allowed distance from a segment to an edge deflection: defines the maximal allowed distance from a segment to an edge
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_Adaptive1D hypothesis an instance of StdMeshers_Adaptive1D hypothesis
@ -280,7 +280,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
reversedEdges: is a list of edges to mesh using reversed orientation. reversedEdges: is a list of edges to mesh using reversed orientation.
A list item can also be a tuple (edge, 1st_vertex_of_edge) A list item can also be a tuple (edge, 1st_vertex_of_edge)
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_Arithmetic1D hypothesis an instance of StdMeshers_Arithmetic1D hypothesis
@ -314,7 +314,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
reversedEdges: is a list of edges to mesh using reversed orientation. reversedEdges: is a list of edges to mesh using reversed orientation.
A list item can also be a tuple (edge, 1st_vertex_of_edge) A list item can also be a tuple (edge, 1st_vertex_of_edge)
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_Geometric1D hypothesis an instance of StdMeshers_Geometric1D hypothesis
@ -349,7 +349,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
reversedEdges: is a list of edges to mesh using reversed orientation. reversedEdges: is a list of edges to mesh using reversed orientation.
A list item can also be a tuple (edge, 1st_vertex_of_edge) A list item can also be a tuple (edge, 1st_vertex_of_edge)
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_FixedPoints1D hypothesis an instance of StdMeshers_FixedPoints1D hypothesis
@ -381,7 +381,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
reversedEdges: is a list of edges to mesh using reversed orientation. reversedEdges: is a list of edges to mesh using reversed orientation.
A list item can also be a tuple (edge, 1st_vertex_of_edge) A list item can also be a tuple (edge, 1st_vertex_of_edge)
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Returns: Returns:
an instance of StdMeshers_StartEndLength hypothesis an instance of StdMeshers_StartEndLength hypothesis
@ -468,7 +468,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
Any other integer value means that the hypothesis will be set on the Any other integer value means that the hypothesis will be set on the
whole 1D shape, where Mesh_Segment algorithm is assigned. whole 1D shape, where Mesh_Segment algorithm is assigned.
UseExisting: if ==true - searches for an existing hypothesis created with UseExisting: if ==true - searches for an existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
import types import types
@ -545,7 +545,7 @@ class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates segment 1D algorithm for edges" docHelper = "Create segment 1D algorithm for edges"
""" """
doc string of the method doc string of the method
""" """
@ -579,7 +579,7 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates segment 1D algorithm for edges" docHelper = "Create segment 1D algorithm for edges"
""" """
doc string of the method doc string of the method
""" """
@ -605,7 +605,7 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
n: for the number of segments that cut an edge n: for the number of segments that cut an edge
func: for the python function that calculates the length of all segments func: for the python function that calculates the length of all segments
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
compFun = lambda hyp, args: False compFun = lambda hyp, args: False
@ -637,7 +637,7 @@ class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates triangle 2D algorithm for faces" docHelper = "Create triangle 2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -662,7 +662,7 @@ class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
Parameters: Parameters:
area: for the maximum area of each triangle area: for the maximum area of each triangle
UseExisting: if ==true - searches for an existing hypothesis created with the UseExisting: if ==true - searches for an existing hypothesis created with the
same parameters, else (default) - creates a new one same parameters, else (default) - Create a new one
""" """
from salome.smesh.smeshBuilder import IsEqual from salome.smesh.smeshBuilder import IsEqual
@ -703,7 +703,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates quadrangle 2D algorithm for faces" docHelper = "Create quadrangle 2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -763,7 +763,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
In the case if the defined QuadrangleParameters() refer to a sole face, In the case if the defined QuadrangleParameters() refer to a sole face,
all given points must lie on this face, else the mesher fails. all given points must lie on this face, else the mesher fails.
UseExisting: if *True* - searches for the existing hypothesis created with UseExisting: if *True* - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
@ -810,7 +810,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
Parameters: Parameters:
reversed: if True, transition area is located along the coarser meshed sides. reversed: if True, transition area is located along the coarser meshed sides.
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
if reversed: if reversed:
@ -824,7 +824,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
Parameters: Parameters:
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
return self.QuadrangleParameters(QUAD_TRIANGLE_PREF,UseExisting=UseExisting) return self.QuadrangleParameters(QUAD_TRIANGLE_PREF,UseExisting=UseExisting)
@ -839,7 +839,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
Parameters: Parameters:
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
return self.QuadrangleParameters(QUAD_REDUCED,UseExisting=UseExisting) return self.QuadrangleParameters(QUAD_REDUCED,UseExisting=UseExisting)
@ -854,7 +854,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
Vertex can be either a GEOM_Object or a vertex ID within the Vertex can be either a GEOM_Object or a vertex ID within the
shape to mesh shape to mesh
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting) return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting)
@ -881,7 +881,7 @@ class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates hexahedron 3D algorithm for volumes" docHelper = "Create hexahedron 3D algorithm for volumes"
""" """
doc string of the method doc string of the method
""" """
@ -921,7 +921,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates projection 1D algorithm for edges" docHelper = "Create projection 1D algorithm for edges"
""" """
doc string of the method doc string of the method
""" """
@ -950,7 +950,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
srcV: a vertex of *edge* to associate with *tgtV* (optional) srcV: a vertex of *edge* to associate with *tgtV* (optional)
tgtV: a vertex of *the edge* to which the algorithm is assigned, to associate with *srcV* (optional) tgtV: a vertex of *the edge* to which the algorithm is assigned, to associate with *srcV* (optional)
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
from salome.smesh.smeshBuilder import AssureGeomPublished, Mesh from salome.smesh.smeshBuilder import AssureGeomPublished, Mesh
AssureGeomPublished( self.mesh, edge ) AssureGeomPublished( self.mesh, edge )
@ -989,7 +989,7 @@ class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates projection 2D algorithm for faces" docHelper = "Create projection 2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -1061,7 +1061,7 @@ class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates projection 1D-2D algorithm for faces" docHelper = "Create projection 1D-2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -1095,7 +1095,7 @@ class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates projection 3D algorithm for volumes" docHelper = "Create projection 3D algorithm for volumes"
""" """
doc string of the method doc string of the method
""" """
@ -1128,7 +1128,7 @@ class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
srcV2: a vertex of *solid* to associate with *tgtV1* (optional) srcV2: a vertex of *solid* to associate with *tgtV1* (optional)
tgtV2: a vertex of *the solid* to which the algorithm is assigned,to associate with *srcV2* (optional) tgtV2: a vertex of *the solid* to which the algorithm is assigned,to associate with *srcV2* (optional)
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
Note: Note:
association vertices must belong to one edge of a solid association vertices must belong to one edge of a solid
@ -1169,7 +1169,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates prism 3D algorithm for volumes" docHelper = "Create prism 3D algorithm for volumes"
""" """
doc string of the method doc string of the method
""" """
@ -1245,7 +1245,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
Parameters: Parameters:
n: number of layers n: number of layers
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
if self.algoType != "RadialPrism_3D": if self.algoType != "RadialPrism_3D":
print("Prism_3D algorithm doesn't support any hypothesis") print("Prism_3D algorithm doesn't support any hypothesis")
@ -1381,7 +1381,7 @@ class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates Raial Prism 3D algorithm for volumes" docHelper = "Create Raial Prism 3D algorithm for volumes"
""" """
doc string of the method doc string of the method
""" """
@ -1453,7 +1453,7 @@ class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
Parameters: Parameters:
n: number of layers n: number of layers
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
if self.distribHyp: if self.distribHyp:
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp ) self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
@ -1563,7 +1563,7 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment" docHelper = "Create quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
""" """
doc string of the method doc string of the method
""" """
@ -1599,7 +1599,7 @@ class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates quadrangle 1D-2D algorithm for faces" docHelper = "Create quadrangle 1D-2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -1637,7 +1637,7 @@ class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates polygon 2D algorithm for faces" docHelper = "Create polygon 2D algorithm for faces"
""" """
doc string of the method doc string of the method
""" """
@ -1677,7 +1677,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates 1D algorithm for edges with reusing of existing mesh elements" docHelper = "Create 1D algorithm for edges with reusing of existing mesh elements"
""" """
doc string of the method doc string of the method
""" """
@ -1704,7 +1704,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
toCopyMesh: if True, the whole mesh *groups* belong to is imported toCopyMesh: if True, the whole mesh *groups* belong to is imported
toCopyGroups: if True, all groups of the mesh *groups* belong to are imported toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
for group in groups: for group in groups:
from salome.smesh.smeshBuilder import AssureGeomPublished from salome.smesh.smeshBuilder import AssureGeomPublished
@ -1739,7 +1739,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates 1D-2D algorithm for faces with reusing of existing mesh elements" docHelper = "Create 1D-2D algorithm for faces with reusing of existing mesh elements"
""" """
doc string of the method doc string of the method
""" """
@ -1766,7 +1766,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
toCopyMesh: if True, the whole mesh *groups* belong to is imported toCopyMesh: if True, the whole mesh *groups* belong to is imported
toCopyGroups: if True, all groups of the mesh *groups* belong to are imported toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
UseExisting: if ==true - searches for the existing hypothesis created with UseExisting: if ==true - searches for the existing hypothesis created with
the same parameters, else (default) - creates a new one the same parameters, else (default) - Create a new one
""" """
import SMESH import SMESH
compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \ compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \
@ -1802,7 +1802,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
flag pointing whether this algorithm should be used by default in dynamic method flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class of smeshBuilder.Mesh class
""" """
docHelper = "Creates Body Fitting 3D algorithm for volumes" docHelper = "Create Body Fitting 3D algorithm for volumes"
""" """
doc string of the method doc string of the method
""" """
@ -1959,7 +1959,7 @@ class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates 1D algorithm allowing batch meshing of edges" docHelper = "Create 1D algorithm allowing batch meshing of edges"
""" """
doc string of the method doc string of the method
""" """
@ -1994,7 +1994,7 @@ class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
""" """
type of algorithm used with helper function in smeshBuilder.Mesh class type of algorithm used with helper function in smeshBuilder.Mesh class
""" """
docHelper = "Creates 2D algorithm allowing batch meshing of faces" docHelper = "Create 2D algorithm allowing batch meshing of faces"
""" """
doc string of the method doc string of the method
""" """

View File

@ -1598,7 +1598,7 @@ class Mesh(metaclass = MeshMeta):
algo1D = mesh.Segment(geom=Edge_1) algo1D = mesh.Segment(geom=Edge_1)
creates a sub-mesh on *Edge_1* and assign Wire Discretization algorithm to it. create a sub-mesh on *Edge_1* and assign Wire Discretization algorithm to it.
The created sub-mesh can be retrieved from the algorithm:: The created sub-mesh can be retrieved from the algorithm::
submesh = algo1D.GetSubMesh() submesh = algo1D.GetSubMesh()
@ -1628,6 +1628,12 @@ class Mesh(metaclass = MeshMeta):
self.mesh = self.smeshpyD.CreateMesh(geom) self.mesh = self.smeshpyD.CreateMesh(geom)
def HasShapeToMesh(self):
"""
Return ``True`` if this mesh is based on geometry
"""
return self.mesh.HasShapeToMesh()
def Load(self): def Load(self):
""" """
Load mesh from the study after opening the study Load mesh from the study after opening the study
@ -2404,7 +2410,7 @@ class Mesh(metaclass = MeshMeta):
# ---------------------- # ----------------------
def CreateEmptyGroup(self, elementType, name): def CreateEmptyGroup(self, elementType, name):
""" """
Create an empty mesh group Create an empty standalone mesh group
Parameters: Parameters:
elementType: the :class:`type <SMESH.ElementType>` of elements in the group; elementType: the :class:`type <SMESH.ElementType>` of elements in the group;
@ -2439,7 +2445,7 @@ class Mesh(metaclass = MeshMeta):
def GroupOnGeom(self, grp, name="", typ=None): def GroupOnGeom(self, grp, name="", typ=None):
""" """
Create a mesh group based on the geometrical object *grp* Create a mesh group based on the geometrical object *grp*
and gives a *name*. and give it a *name*.
if *name* is not defined the name of the geometric group is used if *name* is not defined the name of the geometric group is used
Parameters: Parameters:
@ -2484,8 +2490,8 @@ class Mesh(metaclass = MeshMeta):
def GroupOnFilter(self, typ, name, filter): def GroupOnFilter(self, typ, name, filter):
""" """
Create a mesh group with given *name* based on the *filter* which Create a mesh group with given *name* based on the *filter*.
is a special type of group dynamically updating it's contents during It is a special type of group dynamically updating it's contents during
mesh modification mesh modification
Parameters: Parameters:
@ -2635,15 +2641,15 @@ class Mesh(metaclass = MeshMeta):
def GetGroups(self, elemType = SMESH.ALL): def GetGroups(self, elemType = SMESH.ALL):
""" """
Get the list of groups existing in the mesh in the order Get the list of groups existing in the mesh in the order of creation
of creation (starting from the oldest one) (starting from the oldest one)
Parameters: Parameters:
elemType (SMESH.ElementType): type of elements the groups contain; elemType (SMESH.ElementType): type of elements the groups contain;
by default groups of elements of all types are returned by default groups of elements of all types are returned
Returns: Returns:
a sequence of :class:`SMESH.SMESH_GroupBase` a list of :class:`SMESH.SMESH_GroupBase`
""" """
groups = self.mesh.GetGroups() groups = self.mesh.GetGroups()
@ -3997,7 +4003,7 @@ class Mesh(metaclass = MeshMeta):
def SetNodeOnVertex(self, NodeID, Vertex): def SetNodeOnVertex(self, NodeID, Vertex):
""" """
Binds a node to a vertex Bind a node to a vertex
Parameters: Parameters:
NodeID: a node ID NodeID: a node ID
@ -4020,7 +4026,7 @@ class Mesh(metaclass = MeshMeta):
def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge): def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge):
""" """
Stores the node position on an edge Store the node position on an edge
Parameters: Parameters:
NodeID: a node ID NodeID: a node ID
@ -4043,7 +4049,7 @@ class Mesh(metaclass = MeshMeta):
def SetNodeOnFace(self, NodeID, Face, u, v): def SetNodeOnFace(self, NodeID, Face, u, v):
""" """
Stores node position on a face Store node position on a face
Parameters: Parameters:
NodeID: a node ID NodeID: a node ID
@ -4067,7 +4073,7 @@ class Mesh(metaclass = MeshMeta):
def SetNodeInVolume(self, NodeID, Solid): def SetNodeInVolume(self, NodeID, Solid):
""" """
Binds a node to a solid Bind a node to a solid
Parameters: Parameters:
NodeID: a node ID NodeID: a node ID
@ -6140,7 +6146,7 @@ class Mesh(metaclass = MeshMeta):
return self.editor.FindFreeBorders( ClosedOnly ) return self.editor.FindFreeBorders( ClosedOnly )
def FillHole(self, holeNodes): def FillHole(self, holeNodes, groupName=""):
""" """
Fill with 2D elements a hole defined by a SMESH.FreeBorder. Fill with 2D elements a hole defined by a SMESH.FreeBorder.
@ -6148,6 +6154,9 @@ class Mesh(metaclass = MeshMeta):
FreeBorder: either a SMESH.FreeBorder or a list on node IDs. These nodes FreeBorder: either a SMESH.FreeBorder or a list on node IDs. These nodes
must describe all sequential nodes of the hole border. The first and the last must describe all sequential nodes of the hole border. The first and the last
nodes must be the same. Use :meth:`FindFreeBorders` to get nodes of holes. nodes must be the same. Use :meth:`FindFreeBorders` to get nodes of holes.
groupName (string): name of a group to add new faces
Returns:
a :class:`group <SMESH.SMESH_GroupBase>` containing the new faces; or :code:`None` if :option:`groupName` == ""
""" """
@ -6155,7 +6164,7 @@ class Mesh(metaclass = MeshMeta):
holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes) holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
if not isinstance( holeNodes, SMESH.FreeBorder ): if not isinstance( holeNodes, SMESH.FreeBorder ):
raise TypeError("holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes) raise TypeError("holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes)
self.editor.FillHole( holeNodes ) self.editor.FillHole( holeNodes, groupName )
def FindCoincidentFreeBorders (self, tolerance=0.): def FindCoincidentFreeBorders (self, tolerance=0.):
""" """

View File

@ -69,7 +69,7 @@ class MacObject:
self.MeshGroups = [] self.MeshGroups = []
self.CheckInterfaces() self.CheckInterfaces()
if 'auto' in MeshParameters : self.AutoParam() if 'auto' in MeshParameters : self.AutoParam()
if not(self.MeshPar[0]<0): self.Generate() if isinstance(self.MeshPar[0], list) or not(self.MeshPar[0]<0): self.Generate()
else : else :
Config.ListObj.append(self) Config.ListObj.append(self)
print("Aborting object creation\n ") print("Aborting object creation\n ")
@ -186,7 +186,7 @@ class MacObject:
self.MeshPar[0] = GenFunctions.CompatibilityTest(self) self.MeshPar[0] = GenFunctions.CompatibilityTest(self)
if isinstance( self.MeshPar[0], list ): if isinstance( self.MeshPar[0], list ):
return # workaround, as CompatibilityTest() can return a list return # OK
if self.MeshPar[0] < 0 : if self.MeshPar[0] < 0 :
Alarms.Message(4) Alarms.Message(4)
if self.MeshPar[0] == -1 : print(("Problem encountered with object(s) no. "+str(ObjectsInvolved))) if self.MeshPar[0] == -1 : print(("Problem encountered with object(s) no. "+str(ObjectsInvolved)))