commit
1930c63176
5 changed files with 59 additions and 19 deletions
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
: base(printer)
|
||||
{
|
||||
this.WindowTitle = $"{ApplicationController.Instance.ProductName} - " + "Nozzle Calibration Wizard".Localize();
|
||||
this.WindowSize = new Vector2(600 * GuiWidget.DeviceScale, 645 * GuiWidget.DeviceScale);
|
||||
this.WindowSize = new Vector2(600 * GuiWidget.DeviceScale, 700 * GuiWidget.DeviceScale);
|
||||
|
||||
pages = this.GetPages();
|
||||
pages.MoveNext();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private ThemeConfig theme;
|
||||
private IVertexSource glyph = null;
|
||||
private Stroke glyphStroke;
|
||||
private bool _isActive;
|
||||
|
||||
static CalibrationLine()
|
||||
|
|
@ -57,13 +58,13 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (parentDirection == FlowDirection.LeftToRight)
|
||||
{
|
||||
this.Width = glyphSize;
|
||||
this.Width = glyphSize + 1;
|
||||
this.HAnchor = HAnchor.Absolute;
|
||||
this.VAnchor = VAnchor.Stretch;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Height = glyphSize;
|
||||
this.Height = glyphSize + 1;
|
||||
this.HAnchor = HAnchor.Stretch;
|
||||
this.VAnchor = VAnchor.Absolute;
|
||||
}
|
||||
|
|
@ -79,6 +80,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
this.glyph = glyph;
|
||||
this.glyphStroke = new Stroke(glyph.Scale(0.8));
|
||||
}
|
||||
|
||||
this.theme = theme;
|
||||
|
|
@ -127,16 +129,16 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
Color lineColor = this.IsActive ? theme.PrimaryAccentColor : theme.TextColor;
|
||||
|
||||
var centerX = this.LocalBounds.XCenter + .5;
|
||||
var centerY = this.LocalBounds.YCenter - .5;
|
||||
var centerX = this.LocalBounds.XCenter;
|
||||
var centerY = this.LocalBounds.YCenter;
|
||||
|
||||
var start = new Vector2(centerX, (glyph == null) ? 20 : (this.IsNegative) ? 6 : 9 );
|
||||
var start = new Vector2(centerX, (glyph == null) ? 20 : (this.IsNegative) ? 6 : 12);
|
||||
var end = new Vector2(centerX, this.LocalBounds.Height);
|
||||
|
||||
if (!verticalLine)
|
||||
{
|
||||
start = new Vector2(0, centerY);
|
||||
end = new Vector2(this.LocalBounds.Width - ((glyph == null) ? 20 : (this.IsNegative) ? 6 : 9), centerY);
|
||||
end = new Vector2(this.LocalBounds.Width - ((glyph == null) ? 20 : (this.IsNegative) ? 6 : 12), centerY);
|
||||
}
|
||||
|
||||
graphics2D.Line(start, end, lineColor, 1);
|
||||
|
|
@ -144,10 +146,10 @@ namespace MatterHackers.MatterControl
|
|||
// Draw line end
|
||||
if (glyph != null)
|
||||
{
|
||||
int offset = IsNegative ? 18 : 11;
|
||||
int offset = IsNegative ? 17 : 11;
|
||||
|
||||
graphics2D.Render(
|
||||
glyph,
|
||||
glyphStroke,
|
||||
verticalLine ? new Vector2(centerX, offset) : new Vector2(this.Width - offset, centerY),
|
||||
lineColor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Transform;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
|
|
@ -43,16 +44,25 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
private StringBuilder sb;
|
||||
private StringWriter writer;
|
||||
private PrinterConfig printer;
|
||||
private double nozzleDiameter;
|
||||
private double filamentDiameterMm;
|
||||
private double printerExtrusionMultiplier;
|
||||
private double currentE = 0;
|
||||
private bool retracted = false;
|
||||
private bool penUp = false;
|
||||
private double currentSpeed = 0;
|
||||
private double layerHeight = 0.2;
|
||||
|
||||
public GCodeSketch()
|
||||
public GCodeSketch(PrinterConfig printer)
|
||||
{
|
||||
sb = new StringBuilder();
|
||||
writer = new StringWriter(sb);
|
||||
|
||||
this.printer = printer;
|
||||
nozzleDiameter = printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter);
|
||||
filamentDiameterMm = printer.Settings.GetValue<double>(SettingsKey.filament_diameter);
|
||||
printerExtrusionMultiplier = printer.Settings.GetValue<double>(SettingsKey.extrusion_multiplier);
|
||||
}
|
||||
|
||||
public double RetractLength { get; set; } = 1.2;
|
||||
|
|
@ -157,12 +167,42 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public static double ExtrudeAmount(PrinterConfig printer, double widthMm, double heightMm, double lengthMm)
|
||||
{
|
||||
var filamentDiameterMm = printer.Settings.GetValue<double>(SettingsKey.filament_diameter);
|
||||
|
||||
var volumeMm3 = widthMm * heightMm * lengthMm;
|
||||
var areaMm2 = Math.PI * Math.Pow(filamentDiameterMm / 2, 2);
|
||||
var filamentLengthMm = volumeMm3 / areaMm2;
|
||||
|
||||
return filamentLengthMm;
|
||||
}
|
||||
|
||||
public double ExtrudeAmount(double widthMm, double heightMm, double lengthMm)
|
||||
{
|
||||
var volumeMm3 = widthMm * heightMm * lengthMm;
|
||||
var areaMm2 = Math.PI * Math.Pow(filamentDiameterMm / 2, 2);
|
||||
var filamentLengthMm = volumeMm3 / areaMm2;
|
||||
|
||||
return filamentLengthMm;
|
||||
}
|
||||
|
||||
public void LineTo(double x, double y)
|
||||
{
|
||||
this.LineTo(new Vector2(x, y));
|
||||
this.LineTo(new Vector2(x, y), printerExtrusionMultiplier);
|
||||
}
|
||||
|
||||
public void LineTo(double x, double y, double extrusionMultiplier)
|
||||
{
|
||||
this.LineTo(new Vector2(x, y), extrusionMultiplier);
|
||||
}
|
||||
|
||||
public void LineTo(Vector2 position)
|
||||
{
|
||||
this.LineTo(position, printerExtrusionMultiplier);
|
||||
}
|
||||
|
||||
public void LineTo(Vector2 position, double extrusionMultiplier)
|
||||
{
|
||||
if (retracted)
|
||||
{
|
||||
|
|
@ -172,7 +212,7 @@ namespace MatterHackers.MatterControl
|
|||
position = Transform.Transform(position);
|
||||
|
||||
var delta = this.CurrentPosition - position;
|
||||
currentE += delta.Length * 0.048;
|
||||
currentE += this.ExtrudeAmount(nozzleDiameter, layerHeight, delta.Length) * extrusionMultiplier;
|
||||
|
||||
this.WriteSpeedLine(
|
||||
string.Format(
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl
|
|||
HAnchor = HAnchor.Absolute,
|
||||
VAnchor = VAnchor.Absolute,
|
||||
Height = 110,
|
||||
Width = 420
|
||||
Width = 480
|
||||
});
|
||||
|
||||
xOffsetWidget.OffsetChanged += (s, e) =>
|
||||
|
|
@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl
|
|||
Padding = new BorderDouble(bottom: 4),
|
||||
VAnchor = VAnchor.Absolute,
|
||||
HAnchor = HAnchor.Absolute,
|
||||
Height = 420,
|
||||
Height = 480,
|
||||
Width = 110
|
||||
});
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var sketch1 = new GCodeSketch()
|
||||
var sketch1 = new GCodeSketch(printer)
|
||||
{
|
||||
Speed = (int)(printer.Settings.GetValue<double>(SettingsKey.first_layer_speed) * 60),
|
||||
RetractLength = printer.Settings.GetValue<double>(SettingsKey.retract_length),
|
||||
|
|
@ -147,7 +147,7 @@ namespace MatterHackers.MatterControl
|
|||
TravelSpeed = printer.Settings.GetValue<double>(SettingsKey.travel_speed) * 60,
|
||||
};
|
||||
|
||||
var sketch2 = new GCodeSketch()
|
||||
var sketch2 = new GCodeSketch(printer)
|
||||
{
|
||||
Speed = sketch1.Speed,
|
||||
RetractLength = sketch1.RetractLength,
|
||||
|
|
@ -168,8 +168,6 @@ namespace MatterHackers.MatterControl
|
|||
templatePrinter.BuildTemplate(sketch1, sketch2, verticalLayout: true);
|
||||
templatePrinter.BuildTemplate(sketch1, sketch2, verticalLayout: false);
|
||||
|
||||
sketch1.Unretract();
|
||||
sketch2.Unretract();
|
||||
|
||||
string outputPath = Path.Combine(
|
||||
ApplicationDataStorage.Instance.GCodeOutputPath,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 9673b27546ae8c69ba849d643d2a7799797358fc
|
||||
Subproject commit 415be0f58ce3133e9e6f65c532f753d4f60dba43
|
||||
Loading…
Add table
Add a link
Reference in a new issue