Merge branch 'development' of https://github.com/MatterHackers/MatterControl into development
This commit is contained in:
commit
01cf3003f3
24 changed files with 394 additions and 241 deletions
|
|
@ -44,6 +44,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
class TemperatureWidgetExtruder : TemperatureWidgetBase
|
||||
{
|
||||
int extruderNumber = 1;
|
||||
|
||||
public TemperatureWidgetExtruder()
|
||||
: base("150.3°")
|
||||
{
|
||||
|
|
@ -82,18 +84,18 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
void setToCurrentTemperature()
|
||||
{
|
||||
string tempDirectionIndicator = "";
|
||||
if (PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature > 0)
|
||||
if (PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber-1) > 0)
|
||||
{
|
||||
if ((int)(PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature + 0.5))
|
||||
if ((int)(PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1) + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderNumber - 1) + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↓";
|
||||
}
|
||||
else if ((int)(PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature + 0.5))
|
||||
else if ((int)(PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1) + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderNumber - 1) + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↑";
|
||||
}
|
||||
}
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature, tempDirectionIndicator);
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderNumber - 1), tempDirectionIndicator);
|
||||
}
|
||||
|
||||
void onTemperatureRead(Object sender, EventArgs e)
|
||||
|
|
@ -112,14 +114,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature)
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1))
|
||||
{
|
||||
string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
|
||||
string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1), sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(message, waitingForeExtruderToHeatTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
|
||||
PrinterConnectionAndCommunication.Instance.SetTargetExtruderTemperature(extruderNumber - 1, (int)(targetTemp + .5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl
|
|||
QueueDataView queueDataView;
|
||||
event EventHandler unregisterEvents;
|
||||
GuiWidget part3DViewContainer;
|
||||
View3DTransformPart part3DView;
|
||||
View3DWidget part3DView;
|
||||
GuiWidget partGcodeViewContainer;
|
||||
ViewGcodeBasic partGcodeView;
|
||||
SimpleTextTabWidget aboutTabWidget;
|
||||
|
|
@ -211,12 +211,12 @@ namespace MatterHackers.MatterControl
|
|||
void GeneratePartViews(object state = null)
|
||||
{
|
||||
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
|
||||
part3DView = new View3DTransformPart(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
|
||||
part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
|
||||
ActiveSliceSettings.Instance.BedCenter,
|
||||
ActiveSliceSettings.Instance.BedShape,
|
||||
View3DTransformPart.WindowType.Embeded,
|
||||
View3DTransformPart.AutoRotate.Enabled);
|
||||
View3DWidget.WindowType.Embeded,
|
||||
View3DWidget.AutoRotate.Enabled);
|
||||
part3DView.Margin = new BorderDouble(bottom: 4);
|
||||
part3DView.AnchorAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl
|
|||
double Force1PanelWidth = 990 * TextWidget.GlobalPointSizeScaleRatio;
|
||||
double Force2PanelWidth = 1590 * TextWidget.GlobalPointSizeScaleRatio;
|
||||
|
||||
View3DTransformPart part3DView;
|
||||
View3DWidget part3DView;
|
||||
ViewGcodeBasic partGcodeView;
|
||||
|
||||
PanelSeparator RightBorderLine;
|
||||
|
|
@ -191,12 +191,12 @@ namespace MatterHackers.MatterControl
|
|||
ColumnTwo.CloseAndRemoveAllChildren();
|
||||
|
||||
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
|
||||
part3DView = new View3DTransformPart(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
|
||||
part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
|
||||
ActiveSliceSettings.Instance.BedCenter,
|
||||
ActiveSliceSettings.Instance.BedShape,
|
||||
View3DTransformPart.WindowType.Embeded,
|
||||
View3DTransformPart.AutoRotate.Enabled);
|
||||
View3DWidget.WindowType.Embeded,
|
||||
View3DWidget.AutoRotate.Enabled);
|
||||
part3DView.Margin = new BorderDouble(bottom: 4);
|
||||
part3DView.AnchorAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -364,11 +364,11 @@ namespace MatterHackers.MatterControl
|
|||
bool shiftKeyDown = Keyboard.IsKeyDown(Keys.ShiftKey);
|
||||
if (shiftKeyDown)
|
||||
{
|
||||
OpenPartPreviewWindow (View3DTransformPart.AutoRotate.Disabled);
|
||||
OpenPartPreviewWindow (View3DWidget.AutoRotate.Disabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenPartPreviewWindow (View3DTransformPart.AutoRotate.Enabled);
|
||||
OpenPartPreviewWindow (View3DWidget.AutoRotate.Enabled);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl
|
|||
this.partPreviewWindow = null;
|
||||
}
|
||||
|
||||
private void OpenPartPreviewWindow(View3DTransformPart.AutoRotate autoRotate)
|
||||
private void OpenPartPreviewWindow(View3DWidget.AutoRotate autoRotate)
|
||||
{
|
||||
if (partPreviewWindow == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -151,10 +151,6 @@ namespace MatterHackers.MatterControl.CreatorPlugins
|
|||
pluginRow.Height = 38;
|
||||
pluginRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
|
||||
GuiWidget overlay = new GuiWidget();
|
||||
overlay.AnchorAll();
|
||||
overlay.Cursor = Cursors.Hand;
|
||||
|
||||
FlowLayoutWidget macroRow = new FlowLayoutWidget();
|
||||
macroRow.AnchorAll();
|
||||
macroRow.BackgroundColor = RGBA_Bytes.White;
|
||||
|
|
@ -207,8 +203,9 @@ namespace MatterHackers.MatterControl.CreatorPlugins
|
|||
UiThread.RunOnIdle(CloseOnIdle);
|
||||
};
|
||||
|
||||
pluginRow.Cursor = Cursors.Hand;
|
||||
macroRow.Selectable = false;
|
||||
pluginRow.AddChild(macroRow);
|
||||
pluginRow.AddChild(overlay);
|
||||
|
||||
pluginListingContainer.AddChild(pluginRow);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,10 +119,13 @@
|
|||
<Compile Include="DataStorage\Models.cs" />
|
||||
<Compile Include="LocalizedString.cs" />
|
||||
<Compile Include="PartPreviewWindow\BedSettings.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DCreateSelecitonData.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DAlign.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DAutoArange.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DCopyGroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DGroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DUngroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DWidget.cs" />
|
||||
<Compile Include="PartPreviewWindow\ViewControls3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\ViewControls2D.cs" />
|
||||
<Compile Include="PartPreviewWindow\BaseClasses\PartPreview3DWidget.cs" />
|
||||
|
|
@ -167,7 +170,6 @@
|
|||
<Compile Include="CustomWidgets\EditableNumberDisplay.cs" />
|
||||
<Compile Include="PartPreviewWindow\BaseClasses\PartPreviewWidget.cs" />
|
||||
<Compile Include="PartPreviewWindow\PlatingHelper.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DTransfromPart.cs" />
|
||||
<Compile Include="PrinterControls\EditTemperaturePresetsWindow.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public class PartPreview3DWidget : PartPreviewWidget
|
||||
{
|
||||
protected static readonly int DefaultScrollBarWidth = 120;
|
||||
|
||||
protected bool autoRotateEnabled = false;
|
||||
public MeshViewerWidget meshViewerWidget;
|
||||
event EventHandler unregisterEvents;
|
||||
|
|
@ -117,6 +119,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
spacingText.HAnchor = HAnchor.ParentLeft;
|
||||
wordOptionContainer.AddChild(spacingText);
|
||||
SolidSlider namedSlider = new SolidSlider(new Vector2(), scrollBarWidth, 0, 1);
|
||||
namedSlider.TotalWidthInPixels = DefaultScrollBarWidth;
|
||||
namedSlider.Minimum = min;
|
||||
namedSlider.Maximum = max;
|
||||
namedSlider.Margin = new BorderDouble(3, 5, 3, 3);
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
public class PartPreviewMainWindow : SystemWindow
|
||||
{
|
||||
View3DTransformPart partPreviewView;
|
||||
View3DWidget partPreviewView;
|
||||
ViewGcodeBasic viewGcodeBasic;
|
||||
bool OpenInEditMode;
|
||||
|
||||
public PartPreviewMainWindow(PrintItemWrapper printItem, View3DTransformPart.AutoRotate autoRotate3DView, bool openInEditMode = false)
|
||||
public PartPreviewMainWindow(PrintItemWrapper printItem, View3DWidget.AutoRotate autoRotate3DView, bool openInEditMode = false)
|
||||
: base(690, 340)
|
||||
{
|
||||
UseOpenGL = true;
|
||||
|
|
@ -68,11 +68,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
string part3DViewLabelFull = string.Format("{0} {1} ", "3D", "View".Localize());
|
||||
|
||||
partPreviewView = new View3DTransformPart(printItem,
|
||||
partPreviewView = new View3DWidget(printItem,
|
||||
new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
|
||||
ActiveSliceSettings.Instance.BedCenter,
|
||||
ActiveSliceSettings.Instance.BedShape,
|
||||
View3DTransformPart.WindowType.StandAlone,
|
||||
View3DWidget.WindowType.StandAlone,
|
||||
autoRotate3DView,
|
||||
openInEditMode);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,14 +39,37 @@ using MatterHackers.MeshVisualizer;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DTransformPart
|
||||
public partial class View3DWidget
|
||||
{
|
||||
void AlignSelectedMeshGroup()
|
||||
{
|
||||
AxisAlignedBoundingBox selectedOriginalBounds = SelectedMeshGroup.GetAxisAlignedBoundingBox();
|
||||
Vector3 selectedOriginalCenter = selectedOriginalBounds.Center;
|
||||
AxisAlignedBoundingBox selectedCurrentBounds = SelectedMeshGroup.GetAxisAlignedBoundingBox(SelectedMeshGroupTransform.TotalTransform);
|
||||
foreach (MeshGroup meshGroup in MeshGroups)
|
||||
Vector3 selctedCurrentCenter = selectedCurrentBounds.Center;
|
||||
for(int meshGroupToMoveIndex = 0; meshGroupToMoveIndex < MeshGroups.Count; meshGroupToMoveIndex++)
|
||||
{
|
||||
MeshGroup meshGroupToMove = MeshGroups[meshGroupToMoveIndex];
|
||||
if (meshGroupToMove != SelectedMeshGroup)
|
||||
{
|
||||
AxisAlignedBoundingBox groupToMoveOriginalBounds = meshGroupToMove.GetAxisAlignedBoundingBox();
|
||||
Vector3 groupToMoveOriginalCenter = groupToMoveOriginalBounds.Center;
|
||||
AxisAlignedBoundingBox groupToMoveBounds = meshGroupToMove.GetAxisAlignedBoundingBox(MeshGroupTransforms[meshGroupToMoveIndex].TotalTransform);
|
||||
Vector3 groupToMoveCenter = groupToMoveBounds.Center;
|
||||
|
||||
Vector3 originalCoordinatesDelta = groupToMoveOriginalCenter - selectedOriginalCenter;
|
||||
Vector3 currentCoordinatesDelta = groupToMoveCenter - selctedCurrentCenter;
|
||||
|
||||
Vector3 deltaRequired = originalCoordinatesDelta - currentCoordinatesDelta;
|
||||
|
||||
if (deltaRequired.Length > .0001)
|
||||
{
|
||||
ScaleRotateTranslate translated = MeshGroupTransforms[meshGroupToMoveIndex];
|
||||
translated.translation *= Matrix4X4.CreateTranslation(deltaRequired);
|
||||
MeshGroupTransforms[meshGroupToMoveIndex] = translated;
|
||||
saveButtons.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DTransformPart
|
||||
public partial class View3DWidget
|
||||
{
|
||||
private void AutoArangePartsInBackground()
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
void arrangeMeshGroupsBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DONT_COPY);
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DONT_COPY);
|
||||
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DTransformPart
|
||||
public partial class View3DWidget
|
||||
{
|
||||
private void MakeCopyOfGroup()
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DO_COPY);
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
|
||||
|
||||
MeshGroup meshGroupToCopy = asynchMeshGroups[SelectedMeshGroupIndex];
|
||||
MeshGroup copyMeshGroup = new MeshGroup();
|
||||
|
|
|
|||
121
PartPreviewWindow/View3D/View3DCreateSelecitonData.cs
Normal file
121
PartPreviewWindow/View3D/View3DCreateSelecitonData.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.PolygonMesh;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DWidget
|
||||
{
|
||||
void EnterEditAndCreateSelectionData()
|
||||
{
|
||||
if (enterEditButtonsContainer.Visible == true)
|
||||
{
|
||||
enterEditButtonsContainer.Visible = false;
|
||||
}
|
||||
|
||||
autoArrangeButton.Visible = true;
|
||||
|
||||
if (MeshGroups.Count > 0)
|
||||
{
|
||||
processingProgressControl.Visible = true;
|
||||
LockEditControls();
|
||||
viewIsInEditModePreLock = true;
|
||||
|
||||
BackgroundWorker createSelectionDataBackgroundWorker = null;
|
||||
createSelectionDataBackgroundWorker = new BackgroundWorker();
|
||||
createSelectionDataBackgroundWorker.WorkerReportsProgress = true;
|
||||
|
||||
createSelectionDataBackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorker_ProgressChanged);
|
||||
createSelectionDataBackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(createSelectionDataBackgroundWorker_RunWorkerCompleted);
|
||||
createSelectionDataBackgroundWorker.DoWork += new DoWorkEventHandler(createSelectionDataBackgroundWorker_DoWork);
|
||||
|
||||
createSelectionDataBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
void createSelectionDataBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
string makingCopyLabel = LocalizedString.Get("Creating Edit Data");
|
||||
string makingCopyLabelFull = string.Format("{0}:", makingCopyLabel);
|
||||
processingProgressControl.textWidget.Text = makingCopyLabelFull;
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DONT_COPY);
|
||||
|
||||
asynchPlatingDatas.Clear();
|
||||
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
|
||||
double currentRatioDone = 0;
|
||||
for (int i = 0; i < asynchMeshGroups.Count; i++)
|
||||
{
|
||||
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
|
||||
asynchPlatingDatas.Add(newInfo);
|
||||
|
||||
MeshGroup meshGroup = asynchMeshGroups[i];
|
||||
|
||||
// create the selection info
|
||||
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, i, (double progress0To1, string processingState) =>
|
||||
{
|
||||
int nextPercent = (int)((currentRatioDone + ratioPerMeshGroup * progress0To1) * 100);
|
||||
backgroundWorker.ReportProgress(nextPercent);
|
||||
return true;
|
||||
});
|
||||
|
||||
currentRatioDone += ratioPerMeshGroup;
|
||||
}
|
||||
}
|
||||
|
||||
void createSelectionDataBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (WidgetHasBeenClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// remove the original mesh and replace it with these new meshes
|
||||
PullMeshGroupDataFromAsynchLists();
|
||||
|
||||
UnlockEditControls();
|
||||
|
||||
if (pendingPartsToLoad.Count > 0)
|
||||
{
|
||||
LoadAndAddPartsToPlate(pendingPartsToLoad.ToArray());
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
PartPreviewWindow/View3D/View3DGroup.cs
Normal file
93
PartPreviewWindow/View3D/View3DGroup.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.PolygonMesh;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DWidget
|
||||
{
|
||||
void GroupSelectedMeshGroup()
|
||||
{
|
||||
if (MeshGroups.Count > 0)
|
||||
{
|
||||
processingProgressControl.PercentComplete = 0;
|
||||
processingProgressControl.Visible = true;
|
||||
LockEditControls();
|
||||
viewIsInEditModePreLock = true;
|
||||
|
||||
BackgroundWorker createDiscreteMeshesBackgroundWorker = null;
|
||||
createDiscreteMeshesBackgroundWorker = new BackgroundWorker();
|
||||
createDiscreteMeshesBackgroundWorker.WorkerReportsProgress = true;
|
||||
|
||||
createDiscreteMeshesBackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorker_ProgressChanged);
|
||||
createDiscreteMeshesBackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ungroupSelectedBackgroundWorker_RunWorkerCompleted);
|
||||
createDiscreteMeshesBackgroundWorker.DoWork += new DoWorkEventHandler(ungroupSelectedBackgroundWorker_DoWork);
|
||||
|
||||
createDiscreteMeshesBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
void groupSelectedBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
string makingCopyLabel = LocalizedString.Get("Grouping Meshes");
|
||||
string makingCopyLabelFull = string.Format("{0}:", makingCopyLabel);
|
||||
processingProgressControl.textWidget.Text = makingCopyLabelFull;
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
|
||||
}
|
||||
|
||||
void groupSelectedBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (WidgetHasBeenClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// remove the original mesh and replace it with these new meshes
|
||||
PullMeshGroupDataFromAsynchLists();
|
||||
|
||||
// our selection changed to the mesh we just added which is at the end
|
||||
SelectedMeshGroupIndex = MeshGroups.Count - 1;
|
||||
|
||||
UnlockEditControls();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DTransformPart
|
||||
public partial class View3DWidget
|
||||
{
|
||||
void UngroupSelectedMeshGroup()
|
||||
{
|
||||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DO_COPY);
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
|
||||
|
||||
int indexBeingReplaced = MeshGroups.IndexOf(SelectedMeshGroup);
|
||||
asynchMeshGroups[indexBeingReplaced].Transform(asynchMeshGroupTransforms[indexBeingReplaced].TotalTransform);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DTransformPart : PartPreview3DWidget
|
||||
public partial class View3DWidget : PartPreview3DWidget
|
||||
{
|
||||
public WindowType windowType { get; set; }
|
||||
public PrintItemWrapper PrintItemWrapper {
|
||||
|
|
@ -269,7 +269,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public enum WindowType { Embeded, StandAlone };
|
||||
public enum AutoRotate { Enabled, Disabled };
|
||||
|
||||
public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate, bool openInEditMode = false)
|
||||
public View3DWidget(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate, bool openInEditMode = false)
|
||||
{
|
||||
this.windowType = windowType;
|
||||
autoRotateEnabled = (autoRotate == AutoRotate.Enabled);
|
||||
|
|
@ -612,7 +612,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
processingProgressControl.PercentComplete = 0;
|
||||
LockEditControls();
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DO_COPY);
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
|
||||
|
||||
BackgroundWorker loadAndAddPartsToPlateBackgroundWorker = null;
|
||||
loadAndAddPartsToPlateBackgroundWorker = new BackgroundWorker();
|
||||
|
|
@ -626,8 +626,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
enum TranceInfoOpperation { DONT_COPY, DO_COPY };
|
||||
private void PushMeshGroupDataToAsynchLists(TranceInfoOpperation tranceInfoOpperation)
|
||||
enum TraceInfoOpperation { DONT_COPY, DO_COPY };
|
||||
private void PushMeshGroupDataToAsynchLists(TraceInfoOpperation traceInfoOpperation)
|
||||
{
|
||||
asynchMeshGroups.Clear();
|
||||
asynchMeshGroupTransforms.Clear();
|
||||
|
|
@ -652,7 +652,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
MeshGroup meshGroup = MeshGroups[meshGroupIndex];
|
||||
for (int meshIndex = 0; meshIndex < meshGroup.Meshes.Count; meshIndex++)
|
||||
{
|
||||
if (tranceInfoOpperation == TranceInfoOpperation.DO_COPY)
|
||||
if (traceInfoOpperation == TraceInfoOpperation.DO_COPY)
|
||||
{
|
||||
meshData.meshTraceableData.AddRange(MeshGroupExtraData[meshGroupIndex].meshTraceableData);
|
||||
}
|
||||
|
|
@ -819,85 +819,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
void EnterEditAndCreateSelectionData()
|
||||
{
|
||||
if (enterEditButtonsContainer.Visible == true)
|
||||
{
|
||||
enterEditButtonsContainer.Visible = false;
|
||||
}
|
||||
|
||||
autoArrangeButton.Visible = true;
|
||||
|
||||
if (MeshGroups.Count > 0)
|
||||
{
|
||||
processingProgressControl.Visible = true;
|
||||
LockEditControls();
|
||||
viewIsInEditModePreLock = true;
|
||||
|
||||
BackgroundWorker createSelectionDataBackgroundWorker = null;
|
||||
createSelectionDataBackgroundWorker = new BackgroundWorker();
|
||||
createSelectionDataBackgroundWorker.WorkerReportsProgress = true;
|
||||
|
||||
createSelectionDataBackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorker_ProgressChanged);
|
||||
createSelectionDataBackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(createSelectionDataBackgroundWorker_RunWorkerCompleted);
|
||||
createSelectionDataBackgroundWorker.DoWork += new DoWorkEventHandler(createSelectionDataBackgroundWorker_DoWork);
|
||||
|
||||
createSelectionDataBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
void createSelectionDataBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
string makingCopyLabel = LocalizedString.Get("Creating Edit Data");
|
||||
string makingCopyLabelFull = string.Format("{0}:", makingCopyLabel);
|
||||
processingProgressControl.textWidget.Text = makingCopyLabelFull;
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DONT_COPY);
|
||||
|
||||
asynchPlatingDatas.Clear();
|
||||
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
|
||||
double currentRatioDone = 0;
|
||||
for (int i = 0; i < asynchMeshGroups.Count; i++)
|
||||
{
|
||||
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
|
||||
asynchPlatingDatas.Add(newInfo);
|
||||
|
||||
MeshGroup meshGroup = asynchMeshGroups[i];
|
||||
|
||||
// create the selection info
|
||||
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, i, (double progress0To1, string processingState) =>
|
||||
{
|
||||
int nextPercent = (int)((currentRatioDone + ratioPerMeshGroup * progress0To1) * 100);
|
||||
backgroundWorker.ReportProgress(nextPercent);
|
||||
return true;
|
||||
});
|
||||
|
||||
currentRatioDone += ratioPerMeshGroup;
|
||||
}
|
||||
}
|
||||
|
||||
void createSelectionDataBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (WidgetHasBeenClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// remove the original mesh and replace it with these new meshes
|
||||
PullMeshGroupDataFromAsynchLists();
|
||||
|
||||
UnlockEditControls();
|
||||
|
||||
if (pendingPartsToLoad.Count > 0)
|
||||
{
|
||||
LoadAndAddPartsToPlate(pendingPartsToLoad.ToArray());
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
processingProgressControl.PercentComplete = e.ProgressPercentage;
|
||||
|
|
@ -1726,7 +1647,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
void mergeAndSavePartsBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
// we sent the data to the asynch lists but we will not pull it back out (only use it as a temp holder).
|
||||
PushMeshGroupDataToAsynchLists(TranceInfoOpperation.DO_COPY);
|
||||
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
BackgroundWorker backgroundWorker = (BackgroundWorker)sender;
|
||||
|
|
@ -114,8 +114,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
void Clear3DGCode(object sender, EventArgs e)
|
||||
{
|
||||
gcodeViewWidget.gCodeRenderer.Clear3DGCode();
|
||||
gcodeViewWidget.Invalidate();
|
||||
if (gcodeViewWidget != null)
|
||||
{
|
||||
gcodeViewWidget.gCodeRenderer.Clear3DGCode();
|
||||
gcodeViewWidget.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void RecreateBedAndPartPosition(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -296,11 +296,11 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
bool shiftKeyDown = Keyboard.IsKeyDown(Keys.ShiftKey);
|
||||
if (shiftKeyDown)
|
||||
{
|
||||
OpenPartPreviewWindow(printItem, View3DTransformPart.AutoRotate.Disabled);
|
||||
OpenPartPreviewWindow(printItem, View3DWidget.AutoRotate.Disabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenPartPreviewWindow(printItem, View3DTransformPart.AutoRotate.Enabled);
|
||||
OpenPartPreviewWindow(printItem, View3DWidget.AutoRotate.Enabled);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -335,7 +335,7 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
}
|
||||
|
||||
PartPreviewMainWindow partPreviewWindow;
|
||||
private void OpenPartPreviewWindow(PrintItem printItem, View3DTransformPart.AutoRotate autoRotate)
|
||||
private void OpenPartPreviewWindow(PrintItem printItem, View3DWidget.AutoRotate autoRotate)
|
||||
{
|
||||
|
||||
PrintItemWrapper itemWrapper = new PrintItemWrapper(printItem.Id);
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
if (viewWindowIsOpen == false)
|
||||
{
|
||||
viewingWindow = new PartPreviewMainWindow(this.printItemWrapper, View3DTransformPart.AutoRotate.Enabled, openInEditMode);
|
||||
viewingWindow = new PartPreviewMainWindow(this.printItemWrapper, View3DWidget.AutoRotate.Enabled, openInEditMode);
|
||||
this.viewWindowIsOpen = true;
|
||||
viewingWindow.Closed += new EventHandler(PartPreviewMainWindow_Closed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
{
|
||||
if (viewWindowIsOpen == false)
|
||||
{
|
||||
viewingWindow = new PartPreviewMainWindow(this.PrintItemWrapper, View3DTransformPart.AutoRotate.Enabled, openInEditMode);
|
||||
viewingWindow = new PartPreviewMainWindow(this.PrintItemWrapper, View3DWidget.AutoRotate.Enabled, openInEditMode);
|
||||
this.viewWindowIsOpen = true;
|
||||
viewingWindow.Closed += new EventHandler(PartPreviewWindow_Closed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,17 +58,24 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
/// </summary>
|
||||
public class TemperatureEventArgs : EventArgs
|
||||
{
|
||||
int index0Based;
|
||||
double temperature;
|
||||
|
||||
public TemperatureEventArgs(double temperature)
|
||||
public int Index0Based
|
||||
{
|
||||
this.temperature = temperature;
|
||||
get { return index0Based; }
|
||||
}
|
||||
|
||||
public double Temperature
|
||||
{
|
||||
get { return temperature; }
|
||||
}
|
||||
|
||||
public TemperatureEventArgs(int index0Based, double temperature)
|
||||
{
|
||||
this.index0Based = index0Based;
|
||||
this.temperature = temperature;
|
||||
}
|
||||
}
|
||||
|
||||
public class PrintItemWrapperEventArgs : EventArgs
|
||||
|
|
@ -246,8 +253,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
bool stopTryingToConnect = false;
|
||||
|
||||
double actualExtruderTemperature;
|
||||
double targetExtruderTemperature;
|
||||
static readonly int MAX_EXTRUDERS = 4;
|
||||
double[] actualExtruderTemperature = new double[MAX_EXTRUDERS];
|
||||
double[] targetExtruderTemperature = new double[MAX_EXTRUDERS];
|
||||
double actualBedTemperature;
|
||||
double targetBedTemperature;
|
||||
string printJobDisplayName = null;
|
||||
|
|
@ -438,6 +446,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
ReadLineStartCallBacks.AddCallBackToKey("Done saving file", PrintingCanContinue);
|
||||
|
||||
ReadLineStartCallBacks.AddCallBackToKey("ok T:", ReadTemperatures); // marlin
|
||||
ReadLineStartCallBacks.AddCallBackToKey("ok T0:", ReadTemperatures); // marlin
|
||||
ReadLineStartCallBacks.AddCallBackToKey("T:", ReadTemperatures); // repatier
|
||||
|
||||
ReadLineStartCallBacks.AddCallBackToKey("SD printing byte", ReadSdProgress); // repatier
|
||||
|
|
@ -533,7 +542,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
return "Waiting for Bed to Heat to {0}°".FormatWith(TargetBedTemperature);
|
||||
|
||||
case DetailedPrintingState.HeatingExtruder:
|
||||
return "Waiting for Extruder to Heat to {0}°".FormatWith(TargetExtruderTemperature);
|
||||
return "Waiting for Extruder to Heat to {0}°".FormatWith(GetTargetExtruderTemperature(0));
|
||||
|
||||
case DetailedPrintingState.Printing:
|
||||
return "Currently Printing:";
|
||||
|
|
@ -827,54 +836,47 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
System.Threading.Thread.Sleep(1);
|
||||
}
|
||||
|
||||
public double TargetExtruderTemperature
|
||||
public double GetTargetExtruderTemperature(int extruderIndex0Based)
|
||||
{
|
||||
get
|
||||
return targetExtruderTemperature[extruderIndex0Based];
|
||||
}
|
||||
|
||||
public void SetTargetExtruderTemperature(int extruderIndex0Based, double temperature)
|
||||
{
|
||||
if (targetExtruderTemperature[extruderIndex0Based] != temperature)
|
||||
{
|
||||
return targetExtruderTemperature;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (targetExtruderTemperature != value)
|
||||
targetExtruderTemperature[extruderIndex0Based] = temperature;
|
||||
OnExtruderTemperatureSet(new TemperatureEventArgs(extruderIndex0Based, temperature));
|
||||
if (PrinterIsConnected)
|
||||
{
|
||||
targetExtruderTemperature = value;
|
||||
OnExtruderTemperatureSet(new TemperatureEventArgs(TargetExtruderTemperature));
|
||||
if (PrinterIsConnected)
|
||||
{
|
||||
SendLineToPrinterNow("M104 S{0}".FormatWith(targetExtruderTemperature));
|
||||
}
|
||||
|
||||
SendLineToPrinterNow("M104 T{0} S{1}".FormatWith(extruderIndex0Based, targetExtruderTemperature[extruderIndex0Based]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double ActualExtruderTemperature
|
||||
public double GetActualExtruderTemperature(int extruderIndex0Based)
|
||||
{
|
||||
get
|
||||
{
|
||||
return actualExtruderTemperature;
|
||||
}
|
||||
return actualExtruderTemperature[extruderIndex0Based];
|
||||
}
|
||||
|
||||
public void ExtruderTemperatureWasWritenToPrinter(object sender, EventArgs e)
|
||||
{
|
||||
FoundStringEventArgs foundStringEventArgs = e as FoundStringEventArgs;
|
||||
|
||||
string[] splitOnS = foundStringEventArgs.LineToCheck.Split('S');
|
||||
if (splitOnS.Length == 2)
|
||||
double tempBeingSet = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("S", foundStringEventArgs.LineToCheck, ref tempBeingSet))
|
||||
{
|
||||
string temp = splitOnS[1];
|
||||
try
|
||||
double exturderIndex = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("T", foundStringEventArgs.LineToCheck, ref exturderIndex))
|
||||
{
|
||||
SetTargetExtruderTemperature((int)exturderIndex, tempBeingSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
double tempBeingSet = double.Parse(temp);
|
||||
// we set the private variable so that we don't get the callbacks called and get in a loop of setting the temp
|
||||
targetExtruderTemperature = tempBeingSet;
|
||||
OnExtruderTemperatureSet(new TemperatureEventArgs(TargetExtruderTemperature));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Unable to Parse Extruder Temperature: {0}".FormatWith(temp));
|
||||
SetTargetExtruderTemperature(0, tempBeingSet);
|
||||
}
|
||||
OnExtruderTemperatureSet(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +906,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
if (targetBedTemperature != value)
|
||||
{
|
||||
targetBedTemperature = value;
|
||||
OnBedTemperatureSet(new TemperatureEventArgs(TargetBedTemperature));
|
||||
OnBedTemperatureSet(new TemperatureEventArgs(0, TargetBedTemperature));
|
||||
if (PrinterIsConnected)
|
||||
{
|
||||
SendLineToPrinterNow("M140 S{0}".FormatWith(targetBedTemperature));
|
||||
|
|
@ -937,7 +939,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
// we set the private variable so that we don't get the callbacks called and get in a loop of setting the temp
|
||||
targetBedTemperature = tempBeingSet;
|
||||
OnBedTemperatureSet(new TemperatureEventArgs(TargetBedTemperature));
|
||||
OnBedTemperatureSet(new TemperatureEventArgs(0, TargetBedTemperature));
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
@ -1044,56 +1046,42 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
string temperatureString = foundStringEventArgs.LineToCheck;
|
||||
{
|
||||
int extruderTempLocationInString = temperatureString.IndexOf("T:");
|
||||
if (extruderTempLocationInString > -1)
|
||||
double readExtruderTemp = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("T:", temperatureString, ref readExtruderTemp))
|
||||
{
|
||||
extruderTempLocationInString += 2;
|
||||
int endOfExtruderTempInString = temperatureString.IndexOf(" ", extruderTempLocationInString);
|
||||
if (endOfExtruderTempInString < 0)
|
||||
if (actualExtruderTemperature[0] != readExtruderTemp)
|
||||
{
|
||||
endOfExtruderTempInString = temperatureString.Length;
|
||||
actualExtruderTemperature[0] = readExtruderTemp;
|
||||
OnExtruderTemperatureRead(new TemperatureEventArgs(0, GetActualExtruderTemperature(0)));
|
||||
}
|
||||
}
|
||||
else if (GCodeFile.GetFirstNumberAfter("T0:", temperatureString, ref readExtruderTemp))
|
||||
{
|
||||
if (actualExtruderTemperature[0] != readExtruderTemp)
|
||||
{
|
||||
actualExtruderTemperature[0] = readExtruderTemp;
|
||||
OnExtruderTemperatureRead(new TemperatureEventArgs(0, GetActualExtruderTemperature(0)));
|
||||
}
|
||||
|
||||
string extruderTemp = temperatureString.Substring(extruderTempLocationInString, endOfExtruderTempInString - extruderTempLocationInString);
|
||||
try
|
||||
double readExtruder2Temp = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("T1:", temperatureString, ref readExtruder2Temp))
|
||||
{
|
||||
double readExtruderTemp = double.Parse(extruderTemp);
|
||||
if (actualExtruderTemperature != readExtruderTemp)
|
||||
if (actualExtruderTemperature[1] != readExtruder2Temp)
|
||||
{
|
||||
actualExtruderTemperature = readExtruderTemp;
|
||||
OnExtruderTemperatureRead(new TemperatureEventArgs(ActualExtruderTemperature));
|
||||
actualExtruderTemperature[1] = readExtruder2Temp;
|
||||
OnExtruderTemperatureRead(new TemperatureEventArgs(1, GetActualExtruderTemperature(1)));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Unable to Parse Extruder Temperature: {0}".FormatWith(extruderTemp));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
int bedTempLocationInString = temperatureString.IndexOf("B:");
|
||||
if (bedTempLocationInString > -1)
|
||||
double readBedTemp = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("B:", temperatureString, ref readBedTemp))
|
||||
{
|
||||
bedTempLocationInString += 2;
|
||||
int endOfbedTempInString = temperatureString.IndexOf(" ", bedTempLocationInString);
|
||||
if (endOfbedTempInString < 0)
|
||||
if (actualBedTemperature != readBedTemp)
|
||||
{
|
||||
endOfbedTempInString = temperatureString.Length;
|
||||
}
|
||||
|
||||
string bedTemp = temperatureString.Substring(bedTempLocationInString, endOfbedTempInString - bedTempLocationInString);
|
||||
try
|
||||
{
|
||||
double readBedTemp = double.Parse(bedTemp);
|
||||
if (actualBedTemperature != readBedTemp)
|
||||
{
|
||||
actualBedTemperature = readBedTemp;
|
||||
OnBedTemperatureRead(new TemperatureEventArgs(ActualBedTemperature));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Unable to Parse Bed Temperature: {0}".FormatWith(bedTemp));
|
||||
actualBedTemperature = readBedTemp;
|
||||
OnBedTemperatureRead(new TemperatureEventArgs(0, ActualBedTemperature));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1779,8 +1767,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
// the motors and heaters (a good idea ane something for the future).
|
||||
ForceImmediateWrites = true;
|
||||
ReleaseMotors();
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
TurnOffBedAndExtruders();
|
||||
FanSpeed0To255 = 0;
|
||||
ForceImmediateWrites = false;
|
||||
|
||||
|
|
@ -1798,8 +1785,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
else
|
||||
{
|
||||
//Need to reset UI - even if manual disconnect
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
TurnOffBedAndExtruders();
|
||||
FanSpeed0To255 = 0;
|
||||
}
|
||||
OnEnabledChanged(null);
|
||||
|
|
@ -1897,8 +1883,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
CommunicationState = CommunicationStates.Connected;
|
||||
// never leave the extruder and the bed hot
|
||||
ReleaseMotors();
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
TurnOffBedAndExtruders();
|
||||
printWasCanceled = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -1911,8 +1896,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
// never leave the extruder and the bed hot
|
||||
ReleaseMotors();
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
TurnOffBedAndExtruders();
|
||||
}
|
||||
else if (!PrinterIsPaused)
|
||||
{
|
||||
|
|
@ -2070,8 +2054,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
SendLineToPrinterNow("M26"); // : Set SD position
|
||||
// never leave the extruder and the bed hot
|
||||
ReleaseMotors();
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
TurnOffBedAndExtruders();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2169,6 +2152,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
return true;
|
||||
}
|
||||
|
||||
void TurnOffBedAndExtruders()
|
||||
{
|
||||
SetTargetExtruderTemperature(0, 0);
|
||||
SetTargetExtruderTemperature(1, 0);
|
||||
TargetBedTemperature = 0;
|
||||
}
|
||||
|
||||
void DonePrintingSdFile(object sender, EventArgs e)
|
||||
{
|
||||
UiThread.RunOnIdle((state) =>
|
||||
|
|
@ -2180,9 +2170,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
printJobDisplayName = null;
|
||||
|
||||
// never leave the extruder and the bed hot
|
||||
TurnOffBedAndExtruders();
|
||||
|
||||
ReleaseMotors();
|
||||
TargetExtruderTemperature = 0;
|
||||
TargetBedTemperature = 0;
|
||||
}
|
||||
|
||||
public bool StartPrint(string gcodeFileContents)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
for (int i = 0; i < numberOfHeatedExtruders; i++)
|
||||
{
|
||||
DisableableWidget extruderTemperatureControlWidget = new DisableableWidget();
|
||||
extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i + 1));
|
||||
extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i));
|
||||
mainContainer.AddChild(extruderTemperatureControlWidget);
|
||||
mainContainer.AddChild(new HorizontalLine(separatorLineColor));
|
||||
ExtruderWidgetContainers.Add(extruderTemperatureControlWidget);
|
||||
|
|
|
|||
|
|
@ -51,11 +51,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
protected string label;
|
||||
protected string editWindowLabel;
|
||||
|
||||
protected int extruderIndex0Based = 0;
|
||||
|
||||
protected TemperatureControlBase(string label, string editWindowLabel)
|
||||
protected TemperatureControlBase(int extruderIndex0Based, string label, string editWindowLabel)
|
||||
: base(FlowDirection.TopToBottom)
|
||||
{
|
||||
this.extruderIndex0Based = extruderIndex0Based;
|
||||
this.label = label;
|
||||
this.editWindowLabel = editWindowLabel;
|
||||
SetDisplayAttributes();
|
||||
|
|
@ -408,7 +409,7 @@ namespace MatterHackers.MatterControl
|
|||
protected void onTemperatureRead(Object sender, EventArgs e)
|
||||
{
|
||||
TemperatureEventArgs tempArgs = e as TemperatureEventArgs;
|
||||
if (tempArgs != null)
|
||||
if (tempArgs != null && tempArgs.Index0Based == extruderIndex0Based)
|
||||
{
|
||||
actualTempIndicator.Text = string.Format("{0:0.0}°C", tempArgs.Temperature);
|
||||
}
|
||||
|
|
@ -417,7 +418,7 @@ namespace MatterHackers.MatterControl
|
|||
protected void onTemperatureSet(Object sender, EventArgs e)
|
||||
{
|
||||
TemperatureEventArgs tempArgs = e as TemperatureEventArgs;
|
||||
if (tempArgs != null)
|
||||
if (tempArgs != null && tempArgs.Index0Based == extruderIndex0Based)
|
||||
{
|
||||
SetTargetTemperature(tempArgs.Temperature);
|
||||
}
|
||||
|
|
@ -426,19 +427,16 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public class ExtruderTemperatureControlWidget : TemperatureControlBase
|
||||
{
|
||||
int extruderNumber = 1;
|
||||
|
||||
public ExtruderTemperatureControlWidget()
|
||||
: base(LocalizedString.Get("Extruder Temperature"), LocalizedString.Get("Extruder Temperature Settings"))
|
||||
: base(0, LocalizedString.Get("Extruder Temperature"), LocalizedString.Get("Extruder Temperature Settings"))
|
||||
{
|
||||
AddChildElements();
|
||||
AddHandlers();
|
||||
}
|
||||
|
||||
public ExtruderTemperatureControlWidget(int extruderNumber)
|
||||
: base(string.Format("{0} {1}", "Extruder Temperature".Localize(), extruderNumber), LocalizedString.Get("Extruder Temperature Settings"))
|
||||
{
|
||||
this.extruderNumber = extruderNumber;
|
||||
public ExtruderTemperatureControlWidget(int extruderIndex0Based)
|
||||
: base(extruderIndex0Based, string.Format("{0} {1}", "Extruder Temperature".Localize(), extruderIndex0Based + 1), LocalizedString.Get("Extruder Temperature Settings"))
|
||||
{
|
||||
AddChildElements();
|
||||
AddHandlers();
|
||||
}
|
||||
|
|
@ -476,7 +474,7 @@ namespace MatterHackers.MatterControl
|
|||
string default_presets = ",0,,0,,0,250";
|
||||
|
||||
string presets;
|
||||
string presetKey = string.Format("Extruder{0}PresetTemps", this.extruderNumber);
|
||||
string presetKey = string.Format("Extruder{0}PresetTemps", extruderIndex0Based+1);
|
||||
if (UserSettings.Instance.get(presetKey) == null)
|
||||
{
|
||||
UserSettings.Instance.set(presetKey, default_presets);
|
||||
|
|
@ -490,14 +488,14 @@ namespace MatterHackers.MatterControl
|
|||
StringEventArgs stringEvent = e as StringEventArgs;
|
||||
if (stringEvent != null && stringEvent.Data != null)
|
||||
{
|
||||
UserSettings.Instance.set(string.Format("Extruder{0}PresetTemps", extruderNumber), stringEvent.Data);
|
||||
UserSettings.Instance.set(string.Format("Extruder{0}PresetTemps", extruderIndex0Based + 1), stringEvent.Data);
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
}
|
||||
}
|
||||
|
||||
protected override double GetPreheatTemperature()
|
||||
{
|
||||
string tempValue = ActiveSliceSettings.Instance.GetMaterialValue("temperature", extruderNumber);
|
||||
string tempValue = ActiveSliceSettings.Instance.GetMaterialValue("temperature", extruderIndex0Based+1);
|
||||
if (tempValue == "Unknown")
|
||||
{
|
||||
return 0.0;
|
||||
|
|
@ -510,12 +508,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
protected override double GetTargetTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature;
|
||||
return PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based);
|
||||
}
|
||||
|
||||
protected override double GetActualTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature;
|
||||
return PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex0Based);
|
||||
}
|
||||
|
||||
protected override void SetTargetTemperature(double targetTemp)
|
||||
|
|
@ -523,16 +521,16 @@ namespace MatterHackers.MatterControl
|
|||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature)
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based))
|
||||
{
|
||||
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
|
||||
string message = string.Format("The extruder is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting extruder temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
|
||||
string message = string.Format("The extruder is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting extruder temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based), sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(message, "Waiting For Extruder To Heat");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature);
|
||||
PrinterConnectionAndCommunication.Instance.SetTargetExtruderTemperature(extruderIndex0Based, (int)(targetTemp + .5));
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based));
|
||||
targetTemperatureDisplay.SetDisplayString(displayString);
|
||||
}
|
||||
}
|
||||
|
|
@ -541,7 +539,7 @@ namespace MatterHackers.MatterControl
|
|||
public class BedTemperatureControlWidget : TemperatureControlBase
|
||||
{
|
||||
public BedTemperatureControlWidget()
|
||||
: base(LocalizedString.Get("Bed Temperature"), LocalizedString.Get("Bed Temperature Settings"))
|
||||
: base(0, LocalizedString.Get("Bed Temperature"), LocalizedString.Get("Bed Temperature Settings"))
|
||||
{
|
||||
AddChildElements();
|
||||
AddHandlers();
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
Directory.CreateDirectory(folderToSaveStlsTo);
|
||||
}
|
||||
MeshOutputSettings settings = new MeshOutputSettings();
|
||||
settings.StlOnlySaveUseMaterialIndex = extruderIndex;
|
||||
settings.OnlySaveMaterialIndex = extruderIndex;
|
||||
string extruder1StlFileToSlice = Path.Combine(folderToSaveStlsTo, fileName);
|
||||
MeshFileIo.Save(extruder1Group, extruder1StlFileToSlice, settings);
|
||||
return extruder1StlFileToSlice;
|
||||
|
|
|
|||
|
|
@ -2729,12 +2729,12 @@ Translated:Export...
|
|||
English:Temperature
|
||||
Translated:Temperature
|
||||
|
||||
English:Align
|
||||
Translated:Align
|
||||
|
||||
English:Material 1
|
||||
Translated:Material 1
|
||||
|
||||
English:Material 2
|
||||
Translated:Material 2
|
||||
|
||||
English:Material 3
|
||||
Translated:Material 3
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue