Optimize fill by building and sorting toolpaths