I never came to the point where I inserted code - what in the end worked for me was to place the prime tower far away enough so that the heating did safely happen outside the object. Some details can be found here: Tabletop miniature with 0.2 mm nozzle and PVA support (Dual Extruder)
That said, the answer illuster gave sounds about right