I think it's random. It slices a layer of STL triangles in to random unconnected line segments (because STL files don't say which triangles are connected). Then it tries to connect line segments together into loops. Each loop of line segments is stored in a data structure - basically a linked list. It prints in the order that they are in the structure probably. But it doesn't always print starting at the begining of the data structure. But I think it always prints in the same order. So when it creates these loops it could start off clockwise or counter clockwise.
So maybe it's controlled by the STL file and what order the triangles are found in there. The first triangle found in the STL for a given layer starts the loop and then where it finds the first adjoining triangle - that will set the direction. Most likely. You could experiment with a simple STL file - maybe a cylinder. Find the very first triangle in the STL file and it's xyz position. Find the adjoining (horizontally) triangle and swap them to see if it changes the CW versus CCW travel.
[edit: note: I was wrong. Correction in next post]
I think you will find that the walls around a hole are printed in one direction and the walls around the outline of the part are printed in the other direction. This is determined by the part of CuraEngine that constructs the polygons for each layer.
Link to post
Share on other sites