* Replacing the static_cast with a dynamic_cast in 668adaacdf is a regression because it cannot be guaranteed that the linked object is a sketch.
In fact it can also be a shape binder which is explicitly allowed.
Forum: https://forum.freecadweb.org/viewtopic.php?f=19&t=74939
* Move initialization of some variables into the if-statement