From b69b6ff11bf88de03cad0d892b621aec88fe31ee Mon Sep 17 00:00:00 2001
From: acrovato <a.crovato@uliege.be>
Date: Fri, 8 Mar 2024 10:27:40 +0100
Subject: [PATCH] Update threshold deprecated function for VTK9

---
 tboxVtk/cutter.py | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/tboxVtk/cutter.py b/tboxVtk/cutter.py
index f0dc226..917f4f2 100644
--- a/tboxVtk/cutter.py
+++ b/tboxVtk/cutter.py
@@ -2,13 +2,13 @@
 # -*- coding: utf-8 -*-
 
 # Copyright 2020 University of Liège
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,13 +29,12 @@ class Cutter:
         self.grid = _grid
 
     def cut(self, tag, cutO, cutN, tag_name="tag"):
-        '''
-        Cut the physical group ided "tag" with a plane defined by point "cutO" and normal "cutN"
-        '''
-        import numpy as np
+        """Cut the physical group ided "tag" with a plane defined by point "cutO" and normal "cutN"
+        """
         # create a threshold containing the physical group (tag) to cut
         thresh = vtk.vtkThreshold()
-        thresh.ThresholdBetween(tag,tag)
+        thresh.SetLowerThreshold(tag)
+        thresh.SetUpperThreshold(tag)
         thresh.SetInputConnection(self.grid)
         thresh.SetInputArrayToProcess(0, 0, 0, vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS, tag_name) # "tag" is the default name set in tboxVtk::VtkExport::save
         thresh.Update()
@@ -51,10 +50,9 @@ class Cutter:
         return cutter.GetOutput()
 
     def extract(self, cutData, tagDim, vname, atPoint = True):
-        '''
-        Extract points "pts", connectivity list "elems" and data "vals" named "vname" from cutting plane data "cutData".
+        """Extract points "pts", connectivity list "elems" and data "vals" named "vname" from cutting plane data "cutData".
         The physical group dimension is given by "tagDim" and "atPoint" is True if vname is defined at points.
-        '''
+        """
         import numpy as np
         # transfer point coordinates
         _pts = cutData.GetPoints()
-- 
GitLab