Putting in info for tool change timing

refactoring extruder index to tool index
This commit is contained in:
LarsBrubaker 2019-03-04 08:04:29 -08:00
parent 0c6a0fe4be
commit 457e31ef10
8 changed files with 41 additions and 24 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.ExtruderIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, eMovement, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
if (currentInstruction.Line.StartsWith("G10"))
{
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, -1, currentInstruction.ExtruderIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, -1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
else if (currentInstruction.Line.StartsWith("G11"))
{
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, 1, currentInstruction.ExtruderIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(new RenderFeatureRetract(currentInstruction.Position, 1, currentInstruction.ToolIndex, currentInstruction.FeedRate));
}
}
else
@ -150,7 +150,7 @@ namespace MatterHackers.GCodeVisualizer
new RenderFeatureExtrusion(
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ExtruderIndex,
currentInstruction.ToolIndex,
currentInstruction.FeedRate,
currentInstruction.EPosition - previousInstruction.EPosition,
gCodeFileToDraw.GetFilamentDiameter(),
@ -164,7 +164,7 @@ namespace MatterHackers.GCodeVisualizer
new RenderFeatureTravel(
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ExtruderIndex,
currentInstruction.ToolIndex,
currentInstruction.FeedRate));
}
}

View file

@ -34,7 +34,7 @@ namespace MatterHackers.GCodeVisualizer
{
public abstract class RenderFeatureBase
{
protected int extruderIndex;
protected int toolIndex;
public static Color HighlightColor { get; set; } = new Color("#D0F476");
@ -48,7 +48,7 @@ namespace MatterHackers.GCodeVisualizer
public RenderFeatureBase(int extruderIndex)
{
this.extruderIndex = extruderIndex;
this.toolIndex = extruderIndex;
}
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 extruderIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color, Color gray)
: base(start, end, extruderIndex, travelSpeed)
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)
{
this.color = color;
this.gray = gray;
@ -101,7 +101,7 @@ namespace MatterHackers.GCodeVisualizer
}
else
{
lineColor = renderInfo.GetMaterialColor(extruderIndex);
lineColor = renderInfo.GetMaterialColor(toolIndex);
}
CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), radius, 6, lineColor, layerHeight);
@ -130,7 +130,7 @@ namespace MatterHackers.GCodeVisualizer
}
else
{
extrusionColor = renderInfo.GetMaterialColor(extruderIndex);
extrusionColor = renderInfo.GetMaterialColor(toolIndex);
}
if (renderInfo.CurrentRenderType.HasFlag(RenderType.TransparentExtrusion))

View file

@ -68,9 +68,9 @@ namespace MatterHackers.GCodeVisualizer
var position = new Vector3(this.position);
// retract and unretract are the extruder color
Color color = renderInfo.GetMaterialColor(extruderIndex);
Color color = renderInfo.GetMaterialColor(toolIndex);
// except for extruder 0 where they are the red and blue we are familiar with
if (extruderIndex == 0)
if (toolIndex == 0)
{
if (extrusionAmount > 0)
{

View file

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