Select Objects by Z location

I have an stl file that I have sliced into polylines with different z levels all placed on the default layer. I would like to select one z level at a time through scripting and move to different layer and hatch. Is there a select method I can use to do this?

Thanks

Chris

Here are a couple of scripts that might help -

This one picks up the Z level of each selected curve and puts it on a separate layer according to Z height - the layer name is the Z level rounded to two decimal places. It was originally designed for topographic curves, but it should work.
LevelsToLayers.py (1.8 KB)

This one selects by Z level - you can give it a range of Z values to select or just one Z value and Enter to select just that level
SelectCrvsByZLevel.py (1.6 KB)

And this one that selects all curves on the same Z level as a selected curve
SelectCrvsSameZLevel.py (1.8 KB)

Thank you. Script is doing some strange things but will be a good basis to work from.

What strange things? Can you post an example?