Finish sorting polyline commands by material.