WOW Olivier. Sweet work as usual! I can see where you are going with those objects. How do you code that fast?!?
I also couldn't find a quick solution for the Z coord, at least not one that could be implemented and confined within that block and only with the available parameters.
I can see that Petri's code works as expected, albeit a tad complex, and I noticed the coords numbering problem. I thought modifying it to add a last hotspot (to add points, instead of breaking the last segment) would solve your issues, but I guess the numbering problem wouldn't be addressed and a good part would need to be rewritten or reorganized for this. Didn't take the full plunge into the code, but I can see that my approach is more direct (to adding and removing points) and Petri's is more indirect - by first checking what point or coords are moved/edited and then taking action accordingly. I think the two approaches would need to be combined to solve all issues.
As soon as I find time, I will review Petri's code to see how it works and try to solve (or rewrite) my code and publish a step by step on what to change if objects have been developed using this; but not being as proficient in GDL as you I'm afraid you'll beat me to the answer
Attached are some of the options I kept when looking for a solution. The part being tested -for removing points in master script- is not well formatted (I try to give code a good format so I can return to it later and pick it up as fast as possible), but I guess you won't have major issues with that.
They DON'T WORK entirely (to test them you would need to comment out some of the calculations), but might give you an idea on the approaches I took. Hell... the solution might be there and I made a mistake or just didn't see it.
I'm still amazed at how you write GDL.