private bool LineIsNewFeatureType(GCodeLine line, FillTypeFlags fillType, out FillTypeFlags newFillType) { newFillType = fillType; if (GCodeLineUtil.ExtractFillType(line, ref newFillType)) { if (newFillType != fillType) { return(true); } } return(false); }
public virtual void ProcessGCodeLine(GCodeLine line) { if (line == null || line.type == GCodeLine.LType.Blank) { return; } pointCount++; if (line.comment != null && line.comment.Contains("layer") && !line.comment.Contains("feature")) { if (toolpath != null) { Emit(toolpath, layerIndex, pointCount - toolpath.Count); toolpath = null; } layerIndex++; return; } ExtractPositionFeedrateAndExtrusion(line, ref position, ref feedrate, ref extrusion); ExtractDimensions(line, ref dimensions); GCodeLineUtil.ExtractFillType(line, ref fillType); if (line.comment?.Contains("Plane Change") ?? false) { OnNewPlane(position.z, layerIndex); } PrintVertex vertex = new PrintVertex(position, feedrate, dimensions) { Extrusion = new Vector3d(extrusion, 0, 0), Source = fillType, }; if (line.type == GCodeLine.LType.GCode) { if (toolpath == null) { if (extrusion > lastVertex.Extrusion.x) { lastVertex.Source = fillType; lastVertex.Dimensions = vertex.Dimensions; lastVertex.FeedRate = vertex.FeedRate; lastVertex.ExtendedData = vertex.ExtendedData; toolpath = new List <PrintVertex> { lastVertex, vertex }; } else { RaiseLineGenerated(new List <Vector3d>() { lastVertex.Position, vertex.Position }, layerIndex); } } else { toolpath.Add(vertex); if (extrusion <= lastVertex.Extrusion.x) { Emit(toolpath, layerIndex, pointCount - toolpath.Count); toolpath = null; } } } lastVertex = vertex; }