From: eap Date: Thu, 17 Mar 2016 16:21:24 +0000 (+0300) Subject: 52977: Find Element by Point does not find supporting node of Ball element at group... X-Git-Tag: V7_8_0a2~4^2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=1a82677a356073e12ab45362dcc473b4ddcdc278 52977: Find Element by Point does not find supporting node of Ball element at group of balls selection + minor changes in sample scripts --- diff --git a/doc/salome/examples/creating_meshes_ex06.py b/doc/salome/examples/creating_meshes_ex06.py index 8e52da6be..90fe2765e 100644 --- a/doc/salome/examples/creating_meshes_ex06.py +++ b/doc/salome/examples/creating_meshes_ex06.py @@ -25,7 +25,7 @@ height = 200 # Build a cylinder # ---------------- -base = geompy.MakeVertex(0, 0, 0) +base = geompy.MakeVertex(0, 0, 0) direction = geompy.MakeVectorDXDYDZ(0, 0, 1) cylinder = geompy.MakeCylinder(base, direction, radius, height) @@ -37,9 +37,9 @@ geompy.addToStudy(cylinder, "cylinder") size = radius/2.0 -box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height) +box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height) box_axis = geompy.MakeLine(base, direction) -box = geompy.MakeRotation(box_rot, box_axis, math.pi/4) +box = geompy.MakeRotation(box_rot, box_axis, math.pi/4) hole = geompy.MakeCut(cylinder, box) @@ -50,8 +50,8 @@ plane_b = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(0, 1, 0), plane_trim) blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"]) blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"]) -blocks_all = geompy.MakeCompound(blocks_list) -blocks = geompy.MakeGlueFaces(blocks_all, 0.0001) +blocks_all = geompy.MakeCompound(blocks_list) +blocks = geompy.MakeGlueFaces(blocks_all, 0.0001) geompy.addToStudy(blocks, "cylinder:blocks") @@ -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) @@ -76,7 +75,7 @@ group_a = group("baseA", blocks, "FACE", base, direction) base_b = geompy.MakeVertex(0, 0, height) group_b = group("baseB", blocks, "FACE", base_b, direction) -group_1 = group("limit", blocks, "SOLID") +group_1 = group("limit", blocks, "SOLID") group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"]) geompy.UnionIDs(group_1, group_1_all) group_1_box = geompy.GetBlockNearPoint(blocks, base) @@ -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) diff --git a/doc/salome/examples/creating_meshes_ex08.py b/doc/salome/examples/creating_meshes_ex08.py index e8f43eee6..0cb4b229f 100644 --- a/doc/salome/examples/creating_meshes_ex08.py +++ b/doc/salome/examples/creating_meshes_ex08.py @@ -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" ) diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 76a5d6d16..52cb45765 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -4480,13 +4480,15 @@ SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementID { SMESH_TRY; SMESH::long_array_var res = new SMESH::long_array; - - 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 ( 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( 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( 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 TIter;