I wish to implement a filtering procedure for the vertices of each polyline. The goal is to retain only the vertices where the elevation difference between consecutive points exceeds a specified threshold, for example, 10 cm.
I have developed a script that extracts all the vertices and identifies them based on the polyline to which they belong, as well as their specific index. The process involves testing the elevation difference between each pair of consecutive points. If this difference is below the threshold, the point should be eliminated, and the process moves on to the next point.
Example of the process:
- If Z_PL1_1 − Z_PL1_2<0.1, then point PL1_2 should be eliminated. Next test:
- If Z_PL1_1 − Z_PL1_3>0.1, then the point PL1_3 is retained. Next we test PL1_3 with the other points of the polyline excluding PL1_2, and so on.
This principle is applied iteratively to all polylines.
Problem encountered:
I am facing difficulty with the implementation of iterations to apply this logic to all points automatically. I am unsure how to structure the iterations so that the script can efficiently and consistently filter each pair of consecutive points.

Actually, I am not very skilled with iterations. If there is another way to achieve this without using loops, that would be great.