Depending on the complexity of the input geometry and the processing complexity of the buildstyle, Advanced Toolpath Utility host applications like Netfabb may have to wait a few minutes for results. During this time, application users expect to get information about the current progress and they might decide to cancel the whole operation.
Buildstyle developers have to keep that in mind and provide progress information as well as they have to check for cancel demands. As a worst case scenario, the buildstyle operation is stuck in an infinite loop without providing any progress information. In this case, the host application would wait for forever for the builstyle calculation to finish.
Progress information as well as cancel demands are provided with bsProgress objects. These objects are passed to the preprocessLayerStack and export functions. The toolpath calculation, including all layers, is managed automatically.
Have a look at the following example, that demonstrates progress and cancel request handling for the preprocessLayerStack function:
exports.preprocessLayerStack = function(modelDataSrc, modelDataTarget, progress)
{
progress.initSteps(20);
for(var index=0; index<20; index++)
{
if( progress.cancelled() )
break;
progress.step(1);
}
}