import SALOME_FILTER
import libSALOME_LifeCycleCORBA
lcc=libSALOME_LifeCycleCORBA.SALOME_LifeCycleCORBA()
-filter=lcc.FindOrLoad_Component("FactoryServer","FILTER")
+# load FILTER module
+filter=lcc.FindOrLoad_Component("","FILTER")
inputFile=os.getenv("FILTER_ROOT_DIR")+"/share/salome/resources/filter/xx.aa.med"
-inputMesh="MeshFromEnsight"
-inputField="FieldFromEnsight"
-inputTS=0
-nbth=1
-fth=2.2
-sth=0.0
-flag=True
-rf=SALOME_FILTER.F_FIELD
outputFile="filtered.med"
+# load input MED file
filter.loadMED(inputFile)
-filter.readReferenceField(inputMesh,inputField,inputTS)
-filter.generateCriteria(nbth,fth,sth,flag,rf)
+# read reference field for filtering
+filter.readReferenceField("MeshFromEnsight","FieldFromEnsight",0)
+# generate filtering criteria from thersholds on reference filed
+filter.generateCriteria(1,2.2,0.,True,SALOME_FILTER.F_FIELD)
+# create ensight input files for DISTENE filtoo tool
filter.createEnsightInputFiles()
+# call DISTENNE filtoo tool
filter.filtering()
+# project input fileds on new mesh
filter.projectFieldsOnDecimateMesh()
+# create output MED file
filter.createMedOutputFile(outputFile)
+# unload MED object
filter.unloadMED()