added a hotend temperature stream

In the gcode line view show time to next extruder switch
refactored gcode memory file
gcode render features keep track of their gcode line index

issue: MatterHackers/MCCentral#4679
Turn off hot end temp if not used for remainder of print
This commit is contained in:
Lars Brubaker 2019-03-05 17:55:44 -08:00
parent 78b01b4d21
commit 394325db97
11 changed files with 718 additions and 541 deletions

View file

@ -128,15 +128,15 @@ namespace MatterHackers.GCodeVisualizer
if (Math.Abs(eMovement) > 0)
{
// this is a retraction
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, eMovement, currentInstruction.ToolIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(instructionIndex, currentInstruction.Position, eMovement, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
if (currentInstruction.Line.StartsWith("G10"))
{
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, -1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(instructionIndex, currentInstruction.Position, -1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
else if (currentInstruction.Line.StartsWith("G11"))
{
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, 1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(instructionIndex, currentInstruction.Position, 1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
}
else
@ -148,6 +148,7 @@ namespace MatterHackers.GCodeVisualizer
Color extrusionColor = ExtrusionColors.GetColorForSpeed((float)currentInstruction.FeedRate);
renderFeaturesForLayer.Add(
new RenderFeatureExtrusion(
instructionIndex,
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ToolIndex,
@ -162,6 +163,7 @@ namespace MatterHackers.GCodeVisualizer
{
renderFeaturesForLayer.Add(
new RenderFeatureTravel(
instructionIndex,
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ToolIndex,

View file

@ -36,6 +36,10 @@ namespace MatterHackers.GCodeVisualizer
{
protected int toolIndex;
/// <summary>
/// The actual gcode line in the sourc gcode file
/// </summary>
public int InstructionIndex { get; private set; }
public static Color HighlightColor { get; set; } = new Color("#D0F476");
public static Color StartColor { get; set; } = Color.Red;
@ -46,9 +50,10 @@ namespace MatterHackers.GCodeVisualizer
public abstract void CreateRender3DData(VectorPOD<ColorVertexData> colorVertexData, VectorPOD<int> indexData, GCodeRenderInfo renderInfo);
public RenderFeatureBase(int extruderIndex)
public RenderFeatureBase(int instructionIndex, int toolIndex)
{
this.toolIndex = extruderIndex;
this.toolIndex = toolIndex;
this.InstructionIndex = instructionIndex;
}
static public void CreateCylinder(VectorPOD<ColorVertexData> colorVertexData, VectorPOD<int> indexData, Vector3 startPos, Vector3 endPos, double radius, int steps, Color color, double layerHeight)

View file

@ -42,8 +42,8 @@ namespace MatterHackers.GCodeVisualizer
private Color color;
private Color gray;
public RenderFeatureExtrusion(Vector3 start, Vector3 end, int toolIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color, Color gray)
: base(start, end, toolIndex, travelSpeed)
public RenderFeatureExtrusion(int instructionIndex, Vector3 start, Vector3 end, int toolIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color, Color gray)
: base(instructionIndex, start, end, toolIndex, travelSpeed)
{
this.color = color;
this.gray = gray;

View file

@ -43,8 +43,8 @@ namespace MatterHackers.GCodeVisualizer
private float mmPerSecond;
private Vector3Float position;
public RenderFeatureRetract(Vector3 position, double extrusionAmount, int extruderIndex, double mmPerSecond)
: base(extruderIndex)
public RenderFeatureRetract(int instructionIndex, Vector3 position, double extrusionAmount, int extruderIndex, double mmPerSecond)
: base(instructionIndex, extruderIndex)
{
this.extrusionAmount = (float)extrusionAmount;
this.mmPerSecond = (float)mmPerSecond;

View file

@ -45,8 +45,8 @@ namespace MatterHackers.GCodeVisualizer
public Vector3Float End => end;
public RenderFeatureTravel(Vector3 start, Vector3 end, int toolIndex, double travelSpeed)
: base(toolIndex)
public RenderFeatureTravel(int instructionIndex, Vector3 start, Vector3 end, int toolIndex, double travelSpeed)
: base(instructionIndex, toolIndex)
{
this.toolIndex = toolIndex;
this.start = new Vector3Float(start);