本文整理汇总了C#中MatterHackers.Agg.RectangleDouble.ExpandToInclude方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleDouble.ExpandToInclude方法的具体用法?C# RectangleDouble.ExpandToInclude怎么用?C# RectangleDouble.ExpandToInclude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.RectangleDouble
的用法示例。
在下文中一共展示了RectangleDouble.ExpandToInclude方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadLine
public override string ReadLine()
{
// Send any commands that are queue before moving on to the internal stream.
string nextCommand = queuedCommands.ReadLine();
if (nextCommand != null)
{
return nextCommand;
}
switch (recoveryState)
{
// heat the extrude to remove it from the part
case RecoveryState.RemoveHeating:
// TODO: make sure we heat up all the extruders that we need to (all that are used)
queuedCommands.Add("G21; set units to millimeters");
queuedCommands.Add("M107; fan off");
queuedCommands.Add("T0; set the active extruder to 0");
queuedCommands.Add("G90; use absolute coordinates");
queuedCommands.Add("G92 E0; reset the expected extruder position");
queuedCommands.Add("M82; use absolute distance for extrusion");
queuedCommands.Add("M109 S{0}".FormatWith(ActiveSliceSettings.Instance.Helpers.ExtruderTemperature(0)));
recoveryState = RecoveryState.Raising;
return "";
// remove it from the part
case RecoveryState.Raising:
queuedCommands.Add("M114 ; get current position");
queuedCommands.Add("G91 ; move relative");
queuedCommands.Add("G1 Z10 F{0}".FormatWith(MovementControls.ZSpeed));
queuedCommands.Add("G90 ; move absolute");
recoveryState = RecoveryState.Homing;
return "";
// if top homing, home the extruder
case RecoveryState.Homing:
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.z_homes_to_max))
{
queuedCommands.Add("G28");
}
else
{
// home x
queuedCommands.Add("G28 X0");
// home y
queuedCommands.Add("G28 Y0");
// move to the place we can home z from
Vector2 recoveryPositionXy = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.recover_position_before_z_home);
queuedCommands.Add("G1 X{0:0.###}Y{1:0.###}F{2}".FormatWith(recoveryPositionXy.x, recoveryPositionXy.y, MovementControls.XSpeed));
// home z
queuedCommands.Add("G28 Z0");
}
recoveryState = RecoveryState.FindingRecoveryLayer;
return "";
// This is to recover printing if an out a filament occurs.
// Help the user move the extruder down to just touching the part
case RecoveryState.FindingRecoveryLayer:
if (false) // help the user get the head to the right position
{
// move to above the completed print
// move over a know good part of the model at the current top layer (extrude vertex from gcode)
// let the user move down until they like the height
// calculate that position and continue
}
else // we are resuming because of disconnect or reset, skip this
{
recoveryState = RecoveryState.SkippingGCode;
goto case RecoveryState.SkippingGCode;
}
case RecoveryState.SkippingGCode:
// run through the gcode that the device expected looking for things like temp
// and skip everything else until we get to the point we left off last time
int commandCount = 0;
boundsOfSkippedLayers = RectangleDouble.ZeroIntersection;
while (internalStream.FileStreaming.PercentComplete(internalStream.LineIndex) < percentDone)
{
string line = internalStream.ReadLine();
if(line == null)
{
break;
}
commandCount++;
// make sure we don't parse comments
if(line.Contains(";"))
{
line = line.Split(';')[0];
}
lastDestination = GetPosition(line, lastDestination);
if (commandCount > 100)
{
boundsOfSkippedLayers.ExpandToInclude(lastDestination.position.Xy);
if (boundsOfSkippedLayers.Bottom < 10)
{
int a = 0;
}
}
//.........这里部分代码省略.........