Communicating progress information between the build processor and the host application
Complex input geometry and processing algorithms may cause significant waiting times for host application and user. Processing may even lock itself into an infinite loop. To communicate progress and to maintain responsiveness to cancel requests, use bsProgress objects. These objects are passed to the preprocessLayerStack and export functions. The toolpath calculation, including all layers, is managed automatically.
This example demonstrates progress and cancel request handling for the preprocessLayerStack function:
exports.preprocessLayerStack = function(modelDataSrc, modelDataTarget, progress) // progress is the bsProgress object { progress.initSteps(20); for(var index=0; index<20; index++) { if( progress.cancelled() ) break; progress.step(1); } }
Note: You do not call this function yourself. It sits on its own and is used by the build processor runtime as needed.