52977: Find Element by Point does not find supporting node of Ball element at group of balls selection

+ minor changes in sample scripts
This commit is contained in:
eap 2016-03-17 19:21:24 +03:00
parent a6bce4daba
commit 1a82677a35
3 changed files with 25 additions and 23 deletions

View File

@ -62,8 +62,7 @@ def group(name, shape, type, base=None, direction=None):
t = geompy.ShapeType[type]
g = geompy.CreateGroup(shape, t)
geompy.addToStudy(g, name)
g.SetName(name)
geompy.addToStudyInFather(shape, g, name)
if base!=None:
l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
@ -87,12 +86,12 @@ geompy.DifferenceList(group_1, [group_1_box])
smesh.SetCurrentStudy(salome.myStudy)
def discretize(x, y, z, n, s=blocks):
p = geompy.MakeVertex(x, y, z)
e = geompy.GetEdgeNearPoint(s, p)
a = hexa.Segment(e)
a.NumberOfSegments(n)
a.Propagation()
def discretize(x, y, z, nbSeg, shape=blocks):
vert = geompy.MakeVertex( x, y, z )
edge = geompy.GetEdgeNearPoint( shape, vert )
algo = hexa.Segment( edge )
algo.NumberOfSegments( nbSeg )
algo.Propagation()
hexa = smesh.Mesh(blocks)

View File

@ -14,7 +14,7 @@ smesh = smeshBuilder.New(salome.myStudy)
box = geompy.MakeBoxDXDYDZ(100,100,100)
face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
# generate 3D mesh
# generate a prismatic 3D mesh
mesh = smesh.Mesh(box)
localAlgo = mesh.Triangle(face)
mesh.AutomaticHexahedralization()
@ -44,4 +44,4 @@ nodeIds = nGroup.GetIDs()[-10:]
newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
# 6. copy a sub-mesh
newMesh = smesh.CopyMesh( subMesh, "submesh copy" )
newMesh = smesh.CopyMesh( subMesh, "sub-mesh copy" )

View File

@ -4481,12 +4481,14 @@ SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementID
SMESH_TRY;
SMESH::long_array_var res = new SMESH::long_array;
if ( type != SMESH::NODE )
{
SMESH::array_of_ElementType_var types = elementIDs->GetTypes();
if ( types->length() == 1 && // a part contains only nodes or 0D elements
( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D || types[0] == SMESH::BALL) &&
type != types[0] ) // but search of elements of dim > 0
return res._retn();
}
if ( SMESH::DownCast<SMESH_Mesh_i*>( elementIDs )) // elementIDs is the whole mesh
return FindElementsByPoint( x,y,z, type );
@ -4500,7 +4502,8 @@ SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementID
SMESHDS_Mesh* meshDS = SMESH::DownCast<SMESH_Mesh_i*>( mesh )->GetImpl().GetMeshDS();
if ( !idSourceToSet( elementIDs, meshDS, elements,
SMDSAbs_ElementType(type), /*emptyIfIsMesh=*/true))
( type == SMESH::NODE ? SMDSAbs_All : (SMDSAbs_ElementType) type ),
/*emptyIfIsMesh=*/true))
return res._retn();
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;