From f0ddb8c3acb8fe6ae500917a54d0480cbc64ea23 Mon Sep 17 00:00:00 2001 From: mzn Date: Mon, 17 Jan 2005 13:39:04 +0000 Subject: [PATCH] PAL7221 (DEVELOPMENT : Improve filter which find elements on Shape). Add "LyingOnGeom" filter. Add script containing BuildGroupLyingOn(...) function. --- src/SMESH_SWIG/Makefile.in | 3 ++- src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py | 25 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py diff --git a/src/SMESH_SWIG/Makefile.in b/src/SMESH_SWIG/Makefile.in index 4034f1e1e..1b40066fa 100644 --- a/src/SMESH_SWIG/Makefile.in +++ b/src/SMESH_SWIG/Makefile.in @@ -82,7 +82,8 @@ EXPORT_PYSCRIPTS = libSMESH_Swig.py \ SMESH_demo_hexa2_upd.py \ SMESH_hexaedre.py \ SMESH_Sphere.py \ - SMESH_GroupFromGeom.py + SMESH_GroupFromGeom.py \ + SMESH_GroupLyingOnGeom.py LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_Exception.idl \ diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py new file mode 100644 index 000000000..0df585ed8 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py @@ -0,0 +1,25 @@ +import SMESH + +def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): + aMeshGen = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") + + aFilterMgr = aMeshGen.CreateFilterManager() + aFilter = aFilterMgr.CreateFilter() + + aLyingOnGeom = aFilterMgr.CreateLyingOnGeom() + aLyingOnGeom.SetGeom(theShape) + aLyingOnGeom.SetElementType(theElemType) + + aFilter.SetPredicate(aLyingOnGeom) + anIds = aFilter.GetElementsId(theMesh) + + aGroup = theMesh.CreateGroup(theElemType, theName) + aGroup.Add(anIds) + +#Example +from SMESH_test1 import * + +smesh.Compute(mesh, box) +BuildGroupLyingOn(mesh, SMESH.FACE, "Group of faces lying on edge", edge ) + +salome.sg.updateObjBrowser(1); -- 2.30.2