-
Notifications
You must be signed in to change notification settings - Fork 70
LayerPartsGeneration
An important concept to grasp is the LayerParts. LayerParts are separate parts inside a single layer. For example, if you have a cube. Then each layer has a single LayerPart. However, if you have a table, then the layers which build the legs have a LayerPart per leg, and thus there will be 4 LayerParts. A LayerPart is a separated area inside a single layer which does not touch any other LayerParts. Most operations run on LayerParts as it reduces the amount of data to process. During GCode generation handling each LayerPart as an own step makes sure you never travel between LayerParts and thus reducing the amount of external travel. LayerParts are generated after the Slicer step.
To generate the LayerParts Clipper is used. A Clipper union with extended results gives a list of Polygons with holes in them. Each polygon is a LayerPart, and the holes are added to this LayerPart.
The layer parts are created per volume. The layer parts are stored in the SliceDataStorage as a SliceVolumeStorage for each volume. In a volume the layers are processed in order and produce a SliceLayer from the SliceLayers of the slicer.
The method createLayersWithParts takes the result of the Slice step, which is an unordered list of polygons, and makes groups of polygons, each of these groups is called a "part", which sometimes are also known as "islands". These parts represent isolated areas in the 2D layer with possible holes.
The algorithm can first reverse the orientation of all polygons having a 'positive' area according to Clipper rules (option REVERSE_ORIENTATION). Then UNION_ALL_TOGETHER TBD The parts are found by SplitIntoParts and added to the storage, with all their polygons and their bounding box. SplitIntoParts() makes an union of all polygons, requesting a PolyTree, which in facts establishes the container ordering of the polygons. TBD Note on UnionAll. The resulting PolyTree is recursively transforms the PolyTree to a list of Polygons (themselves list of list of points), TBD Rules for polygons. This method is used to transform polygons to ??? in ???
TBD Note on adding offset of raft.
Exit from prepareModel, enter processSliceData generateMultipleVolumesOverlap(): Expand each layer a bit and then keep the extra overlapping parts that overlap with other volumes. This generates some overlap in dual extrusion, for better bonding in touching parts.
The polygons resulting of the preparation can be dumped.