Auto-generate turning point WaypointNodes

Hey Forum!

I’m trying to implement the following:
The welder Cobot would need to go around a rectangle object, and i’m trying to auto generate the turning movement of the Robot, so that the operator only needs to set the 4 edges of the rectangle.
I think i’m able to calculate the Waypoints i need with get_actual_tcp_pose() and than alter it to get the turned point, and set them in varieable positions but i’m only able to do this after the opertor set the 4 point i need.
When in the Java program code is the correct time to do this?
I have 2 general ideas:
-Do it in generateScript() since by this point all waypoint need to be set and if i pre-set the varieable ones with some general setting and overwrite those before writing my child nodes with write children can work but i feel this is incorrect.
-With some kind of Callback, whenever the operator sets the 4 WaypointNodes i need, but i dont really know what would be a really good practice for this.

Thanks for all the help,
Andor