本文整理汇总了C#中RepetierHost.model.GCode.getHostCommand方法的典型用法代码示例。如果您正苦于以下问题:C# GCode.getHostCommand方法的具体用法?C# GCode.getHostCommand怎么用?C# GCode.getHostCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepetierHost.model.GCode
的用法示例。
在下文中一共展示了GCode.getHostCommand方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
public void Analyze(GCode code)
{
if (code.hostCommand)
{
string cmd = code.getHostCommand();
if (cmd.Equals("@hide"))
drawing = false;
else if (cmd.Equals("@show"))
drawing = true;
else if (cmd.Equals("@isathome"))
{
hasXHome = hasYHome = hasZHome = true;
x = Main.printerSettings.XHomePos;
y = Main.printerSettings.YHomePos;
z = Main.printerSettings.ZHomePos;
xOffset = yOffset = zOffset = 0;
}
return;
}
//if (code.forceAscii) return; // Don't analyse host commands and unknown commands
if (code.hasN)
lastline = code.N;
if (uploading && !code.hasM && code.M != 29) return; // ignore upload commands
if (code.hasG)
{
switch (code.G)
{
case 0:
case 1:
eChanged = false;
if (code.hasF) f = code.F;
if (relative)
{
if (code.hasX) x += code.X;
if (code.hasY) y += code.Y;
if (code.hasZ) z += code.Z;
if (code.hasE)
{
if (eChanged = code.E != 0)
{
if (code.E < 0) activeExtruder.retracted = true;
else if (activeExtruder.retracted)
{
activeExtruder.retracted = false;
activeExtruder.e = activeExtruder.emax;
}
else
activeExtruder.e += code.E;
}
}
}
else
{
if (code.hasX) x = xOffset + code.X;
if (code.hasY) y = yOffset + code.Y;
if (code.hasZ)
{
z = zOffset + code.Z;
}
if (code.hasE)
{
if (eRelative)
{
if (eChanged = code.E != 0)
{
if (code.E < 0) activeExtruder.retracted = true;
else if (activeExtruder.retracted)
{
activeExtruder.retracted = false;
activeExtruder.e = activeExtruder.emax;
}
else
activeExtruder.e += code.E;
}
}
else
{
if (eChanged = activeExtruder.e != (activeExtruder.eOffset + code.E))
{
activeExtruder.e = activeExtruder.eOffset + code.E;
if (activeExtruder.e < activeExtruder.lastE)
activeExtruder.retracted = true;
else if (activeExtruder.retracted)
{
activeExtruder.retracted = false;
activeExtruder.e = activeExtruder.emax;
activeExtruder.eOffset = activeExtruder.e - code.E;
}
}
}
}
}
if (x < Main.printerSettings.XMin) { x = Main.printerSettings.XMin; hasXHome = false; }
if (y < Main.printerSettings.YMin) { y = Main.printerSettings.YMin; hasYHome = false; }
if (z < 0 && FormPrinterSettings.ps.printerType!=3) { z = 0; hasZHome = false; }
if (x > Main.printerSettings.XMax) { hasXHome = false; }
if (y > Main.printerSettings.YMax) { hasYHome = false; }
if (z > printerHeight) { hasZHome = false; }
if (activeExtruder.e > activeExtruder.emax)
{
//.........这里部分代码省略.........
示例2: executeHostCommand
public void executeHostCommand(GCode code)
{
string com = code.getHostCommand();
string param = code.getHostParameter();
if (com.Equals("@info"))
{
conn.log(param, false, 3);
}
else if (com.Equals("@pause"))
{
conn.pause(param);
}
}
示例3: executeHostCommand
public void executeHostCommand(GCode code)
{
string com = code.getHostCommand();
string param = code.getHostParameter();
if (com.Equals("@info"))
{
conn.log(param, false, 3);
}
else if (com.Equals("@pause"))
{
SoundConfig.PlayPrintPaused(false);
conn.pause(param);
}
else if (com.Equals("@sound"))
{
SoundConfig.PlaySoundCommand(false);
}
}
示例4: Analyze
public void Analyze(GCode code)
{
if (code.hostCommand)
{
string cmd = code.getHostCommand();
if (cmd.Equals("@hide"))
drawing = false;
else if (cmd.Equals("@show"))
drawing = true;
else if (cmd.Equals("@isathome"))
{
hasXHome = hasYHome = hasZHome = true;
x = xOffset = 0;
y = yOffset = 0;
z = zOffset = 0;
}
return;
}
if (code.forceAscii) return; // Don't analyse host commands and unknown commands
if (code.hasN)
lastline = code.N;
if (uploading && !code.hasM && code.M != 29) return; // ignore upload commands
if (code.hasG)
{
switch (code.G)
{
case 0:
case 1:
if (code.hasF) f = code.F;
if (relative)
{
if (code.hasX) x += code.X;
if (code.hasY) y += code.Y;
if (code.hasZ) z += code.Z;
if (code.hasE) e += code.E;
}
else
{
if (code.hasX) x = xOffset + code.X;
if (code.hasY) y = yOffset + code.Y;
if (code.hasZ)
{
z = zOffset + code.Z;
}
if (code.hasE)
{
if (eRelative)
e += code.E;
else
e = eOffset + code.E;
}
}
if (x < 0) { x = 0; hasXHome = false; }
if (y < 0) { y = 0; hasYHome = false; }
if (z < 0) { z = 0; hasZHome = false; }
if (x > printerWidth) { hasXHome = false; }
if (y > printerDepth) { hasYHome = false; }
if (z > printerHeight) { hasZHome = false; }
if (e > emax)
{
emax = e;
if (z > lastZPrint)
{
layer++;
lastZPrint = z;
if (!privateAnalyzer && Main.conn.job.hasData() && Main.conn.job.maxLayer >= 0)
{
PrinterConnection.logInfo("Printing layer " + layer.ToString() + " of " + Main.conn.job.maxLayer.ToString());
}
}
}
if (eventPosChanged != null)
if (privateAnalyzer)
eventPosChanged(code, x, y, z);
else
Main.main.Invoke(eventPosChanged, code, x, y, z);
float dx = Math.Abs(x - lastX);
float dy = Math.Abs(y - lastY);
float dz = Math.Abs(z - lastZ);
float de = Math.Abs(e - lastE);
if (dx + dy + dz > 0.001)
{
printingTime += Math.Sqrt(dx * dx + dy * dy + dz * dz) * 60.0f / f;
}
else printingTime += de * 60.0f / f;
lastX = x;
lastY = y;
lastZ = z;
lastE = e;
break;
case 28:
case 161:
{
bool homeAll = !(code.hasX || code.hasY || code.hasZ);
if (code.hasX || homeAll) { xOffset = 0; x = 0; hasXHome = true; }
if (code.hasY || homeAll) { yOffset = 0; y = 0; hasYHome = true; }
if (code.hasZ || homeAll) { zOffset = 0; z = 0; hasZHome = true; }
if (code.hasE) { eOffset = 0; e = 0; emax = 0; }
if (eventPosChanged != null)
if (privateAnalyzer)
//.........这里部分代码省略.........
示例5: Analyze
public void Analyze(GCode code)
{
if (code.hostCommand)
{
if (code.getHostCommand().Equals("@hide"))
drawing = false;
else if (code.getHostCommand().Equals("@show"))
drawing = true;
return;
}
if (code.forceAscii) return; // Don't analyse host commands and unknown commands
if (code.hasN)
lastline = code.N;
if (uploading && !code.hasM && code.M != 29) return; // ignore upload commands
if (code.hasG)
{
switch (code.G)
{
case 0:
case 1:
if (relative)
{
if(code.hasX) x += code.X;
if(code.hasY) y += code.Y;
if(code.hasZ) z += code.Z;
if(code.hasE) e += code.E;
}
else
{
if (code.hasX) x = xOffset+code.X;
if (code.hasY) y = yOffset+code.Y;
if (code.hasZ) z = zOffset+code.Z;
if (code.hasE)
{
if (eRelative)
e += code.E;
else
e = eOffset + code.E;
}
}
if (x < 0) { x = 0; hasXHome = false; }
if (y < 0) { y = 0; hasYHome = false; }
if (z < 0) { z = 0; hasZHome = false; }
if (x > printerWidth) { hasXHome = false; }
if (y > printerDepth) { hasYHome = false; }
if (z > printerHeight) { hasZHome = false; }
if (e > emax) emax = e;
if (eventPosChanged != null)
if (privateAnalyzer)
eventPosChanged(code, x, y, z);
else
Main.main.Invoke(eventPosChanged,code, x, y, z);
break;
case 28:
case 161:
{
bool homeAll = !(code.hasX || code.hasY || code.hasZ);
if (code.hasX || homeAll) { xOffset = 0; x = 0; hasXHome = true; }
if (code.hasY || homeAll) { yOffset = 0; y = 0; hasYHome = true; }
if (code.hasZ || homeAll) { zOffset = 0; z = 0; hasZHome = true; }
if (code.hasE) { eOffset = 0; e = 0; emax = 0; }
if (eventPosChanged != null)
if (privateAnalyzer)
eventPosChanged(code, x, y, z);
else
Main.main.Invoke(eventPosChanged, code, x, y, z);
}
break;
case 162:
{
bool homeAll = !(code.hasX || code.hasY || code.hasZ);
if (code.hasX || homeAll) { xOffset = 0; x = Main.printerSettings.PrintAreaWidth; hasXHome = true; }
if (code.hasY || homeAll) { yOffset = 0; y = Main.printerSettings.PrintAreaDepth; hasYHome = true; }
if (code.hasZ || homeAll) { zOffset = 0; z = Main.printerSettings.PrintAreaHeight; hasZHome = true; }
if (eventPosChanged != null)
if (privateAnalyzer)
eventPosChanged(code, x, y, z);
else
Main.main.Invoke(eventPosChanged, code, x, y, z);
}
break;
case 90:
relative = false;
break;
case 91:
relative = true;
break;
case 92:
if (code.hasX) { xOffset = x-code.X; x = xOffset; }
if (code.hasY) { yOffset = y-code.Y; y = zOffset; }
if (code.hasZ) { zOffset = z-code.Z; z = zOffset; }
if (code.hasE) { eOffset = e-code.E; e = eOffset; }
if (eventPosChanged != null)
if (privateAnalyzer)
eventPosChanged(code, x, y, z);
else
Main.main.Invoke(eventPosChanged, code, x, y, z);
break;
}
}
//.........这里部分代码省略.........
示例6: Analyze
public void Analyze(GCode code)
{
if (code.hostCommand)
{
string cmd = code.getHostCommand();
if (cmd.Equals("@hide"))
drawing = false;
else if (cmd.Equals("@show"))
drawing = true;
else if (cmd.Equals("@isathome"))
{
hasXHome = hasYHome = hasZHome = true;
x = Main.printerSettings.XHomePos;
y = Main.printerSettings.YHomePos;
zr = Main.printerSettings.ZHomePos;
xOffset = yOffset = zOffset = 0;
}
return;
}
//if (code.forceAscii) return; // Don't analyse host commands and unknown commands
if (code.hasN)
lastline = code.N;
if (uploading && !code.hasM && code.M != 29) return; // ignore upload commands
if (code.hasG)
{
switch (code.G)
{
case 0:
case 1:
eChanged = false;
if (code.hasF) f = code.F;
if (relative)
{
if (code.hasX) x += code.X;
if (code.hasY) y += code.Y;
if (code.hasZ)
{
zr += code.Z;
zl += code.Z;
}
if (code.hasR) zr += code.R;
if (code.hasL) zl += code.L;
}
else
{
if (code.hasX) x = xOffset + code.X;
if (code.hasY) y = yOffset + code.Y;
if (code.hasZ)
{
zr = zOffset + code.Z;
zl = zl + code.Z;
}
if (code.hasR)
{
zr = zOffset + code.R;
}
if (code.hasL)
{
zl += code.L;
}
if (code.hasE)
{
if (eRelative)
{
if (eChanged = code.E != 0)
{
if (code.E < 0) activeExtruder.retracted = true;
else if (activeExtruder.retracted)
{
activeExtruder.retracted = false;
activeExtruder.e = activeExtruder.emax;
}
else
activeExtruder.e += code.E;
}
}
else
{
if (eChanged = activeExtruder.e != (activeExtruder.eOffset + code.E))
{
activeExtruder.e = activeExtruder.eOffset + code.E;
if (activeExtruder.e < activeExtruder.lastE)
activeExtruder.retracted = true;
else if (activeExtruder.retracted)
{
activeExtruder.retracted = false;
activeExtruder.e = activeExtruder.emax;
activeExtruder.eOffset = activeExtruder.e - code.E;
}
}
}
}
}
if (x < Main.printerSettings.XMin) { x = Main.printerSettings.XMin; hasXHome = false; }
if (y < Main.printerSettings.YMin) { y = Main.printerSettings.YMin; hasYHome = false; }
if (zr < 0 && FormPrinterSettings.ps.printerType!=3) { zr = 0; hasZHome = false; }
if (x > Main.printerSettings.XMax) { hasXHome = false; }
if (y > Main.printerSettings.YMax) { hasYHome = false; }
if (zr > printerHeight) { hasZHome = false; }
if (activeExtruder.e > activeExtruder.emax)
//.........这里部分代码省略.........