Make sure we have printer move speeds in loaded gcode
This commit is contained in:
parent
d8d8e78a98
commit
1bd7e525ad
4 changed files with 50 additions and 24 deletions
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
||||
|
|
@ -46,12 +47,18 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public GCodeSwitcher(string gcodeFilename, PrinterConfig printer, int startLine = 0)
|
||||
: base(printer)
|
||||
{
|
||||
var settings = this.printer.Settings;
|
||||
var maxAcceleration = settings.GetValue<double>(SettingsKey.max_acceleration);
|
||||
var maxVelocity = settings.GetValue<double>(SettingsKey.max_velocity);
|
||||
var jerkVelocity = settings.GetValue<double>(SettingsKey.jerk_velocity);
|
||||
var multiplier = settings.GetValue<double>(SettingsKey.print_time_estimate_multiplier) / 100.0;
|
||||
|
||||
var fileStreaming = GCodeFile.Load(gcodeFilename,
|
||||
new Vector4(),
|
||||
new Vector4(),
|
||||
new Vector4(),
|
||||
Vector4.One,
|
||||
CancellationToken.None);
|
||||
new Vector4(maxAcceleration, maxAcceleration, maxAcceleration, maxAcceleration),
|
||||
new Vector4(maxVelocity, maxVelocity, maxVelocity, maxVelocity),
|
||||
new Vector4(jerkVelocity, jerkVelocity, jerkVelocity, jerkVelocity),
|
||||
new Vector4(multiplier, multiplier, multiplier, multiplier),
|
||||
CancellationToken.None);
|
||||
|
||||
this.GCodeFile = fileStreaming;
|
||||
LineIndex = startLine;
|
||||
|
|
@ -151,11 +158,17 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var settings = this.printer.Settings;
|
||||
var maxAcceleration = settings.GetValue<double>(SettingsKey.max_acceleration);
|
||||
var maxVelocity = settings.GetValue<double>(SettingsKey.max_velocity);
|
||||
var jerkVelocity = settings.GetValue<double>(SettingsKey.jerk_velocity);
|
||||
var multiplier = settings.GetValue<double>(SettingsKey.print_time_estimate_multiplier) / 100.0;
|
||||
|
||||
var switchToGCode = GCodeFile.Load(gcodeFilename,
|
||||
new Vector4(),
|
||||
new Vector4(),
|
||||
new Vector4(),
|
||||
Vector4.One,
|
||||
new Vector4(maxAcceleration, maxAcceleration, maxAcceleration, maxAcceleration),
|
||||
new Vector4(maxVelocity, maxVelocity, maxVelocity, maxVelocity),
|
||||
new Vector4(jerkVelocity, jerkVelocity, jerkVelocity, jerkVelocity),
|
||||
new Vector4(multiplier, multiplier, multiplier, multiplier),
|
||||
CancellationToken.None);
|
||||
|
||||
if (switchToGCode is GCodeMemoryFile memoryFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue