Edit crop region

Dears,
the script is not working for me. Please see script and photo for information.
What might be reason for that? Curve is closed.

Thanks
Section.dyn (11.0 KB)