implementing part of export as x3g
This commit is contained in:
parent
c8530bc699
commit
a9bfdf9fd3
5 changed files with 91 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
@ -121,6 +122,20 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
middleRowContainer.AddChild(exportToSdCard);
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor() && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
{
|
||||
string exportAsX3GText = "Export as X3G".Localize();
|
||||
Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText);
|
||||
exportAsX3G.HAnchor = HAnchor.ParentLeft;
|
||||
exportAsX3G.Cursor = Cursors.Hand;
|
||||
exportAsX3G.Click += new ButtonBase.ButtonEventHandler((object sender, MouseEventArgs e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(ExportX3G_Click);
|
||||
|
||||
});
|
||||
middleRowContainer.AddChild(exportAsX3G);
|
||||
}
|
||||
}
|
||||
|
||||
middleRowContainer.AddChild(new VerticalSpacer());
|
||||
|
|
@ -312,6 +327,45 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ExportX3G_Click(object state)
|
||||
{
|
||||
SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", title: "Export GCode");
|
||||
saveParams.Title = "MatterControl: Export File";
|
||||
saveParams.ActionButtonLabel = "Export";
|
||||
|
||||
System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams);
|
||||
if (streamToSaveTo != null)
|
||||
{
|
||||
streamToSaveTo.Close ();
|
||||
|
||||
pathAndFilenameToSave = saveParams.FileName;
|
||||
string extension = Path.GetExtension(pathAndFilenameToSave);
|
||||
if(extension == "")
|
||||
{
|
||||
File.Delete(pathAndFilenameToSave);
|
||||
pathAndFilenameToSave += ".gcode";
|
||||
}
|
||||
|
||||
if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == ".STL")
|
||||
{
|
||||
Close();
|
||||
SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
|
||||
printItemWrapper.SlicingDone.RegisterEvent(sliceItem_Done, ref unregisterEvents);
|
||||
|
||||
/*ProcessStartInfo exportX3GProcess = new ProcessStartInfo(printItemWrapper.PrintItem.Name);
|
||||
exportX3GProcess.UseShellExecute = true;
|
||||
exportX3GProcess.FileName = "C:\\Users\\Matter Hackers 1\\GPX\\gpx-win32-1.3\\gpx-win32-1.3\\gpx.exe";
|
||||
Process.Start(exportX3GProcess);*/
|
||||
}
|
||||
else if (partIsGCode)
|
||||
{
|
||||
Close();
|
||||
SaveGCodeToNewLocation(printItemWrapper.FileLocation, pathAndFilenameToSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveGCodeToNewLocation(string source, string dest)
|
||||
{
|
||||
if (ActivePrinterProfile.Instance.DoPrintLeveling)
|
||||
|
|
@ -430,6 +484,10 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
printItemWrapper.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
|
||||
SaveGCodeToNewLocation(sliceItem.GetGCodePathAndFileName(), pathAndFilenameToSave);
|
||||
ProcessStartInfo exportX3GProcess = new ProcessStartInfo(printItemWrapper.PrintItem.Name);
|
||||
exportX3GProcess.UseShellExecute = true;
|
||||
exportX3GProcess.FileName = "C:\\Users\\Matter Hackers 1\\GPX\\gpx-win32-1.3\\gpx-win32-1.3\\gpx.exe";
|
||||
Process.Start(exportX3GProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ReleaseVersion>0.8.2</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
|
|
@ -48,7 +47,6 @@
|
|||
<DefineConstants>TRACE;DEBUG;USE_OPENGL;IS_WINDOWS;IS_WINDOWS_FORMS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
|
|
@ -244,6 +242,11 @@
|
|||
<Compile Include="EeProm\EePromRepetierStorage.cs" />
|
||||
<Compile Include="PartPreviewWindow\SaveAsWindow.cs" />
|
||||
<Compile Include="DataStorage\SQLiteAndroid.cs" />
|
||||
<Compile Include="ExportX3GToFolderProcess.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicerMapping\SliceEngineInfo.cs" />
|
||||
<Compile Include="SlicerConfiguration\CuraEngineInfo.cs" />
|
||||
<Compile Include="SlicerConfiguration\MatterSliceInfo.cs" />
|
||||
<Compile Include="SlicerConfiguration\Slic3rInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
|
|
@ -389,7 +392,7 @@
|
|||
<Project>{865172A0-A1A9-49C2-9386-F2FDB4E141B7}</Project>
|
||||
<Name>MatterControlPluginSystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\agg-sharp\agg\Agg.csproj">
|
||||
<ProjectReference Include="..\agg-sharp\Agg\Agg.csproj">
|
||||
<Project>{657DBC6D-C3EA-4398-A3FA-DDB73C14F71B}</Project>
|
||||
<Name>Agg</Name>
|
||||
</ProjectReference>
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
menuItems.Add(new Tuple<string,Func<bool>>(LocalizedString.Get(" Export to Zip"), exportQueueToZipMenu_Click));
|
||||
menuItems.Add(new Tuple<string,Func<bool>>("GCode", null));
|
||||
menuItems.Add(new Tuple<string,Func<bool>>(LocalizedString.Get(" Export to Folder"), exportGCodeToFolderButton_Click));
|
||||
menuItems.Add(new Tuple<string, Func<bool>>("X3G", null));
|
||||
menuItems.Add(new Tuple<string, Func<bool>>(LocalizedString.Get("Export to Folder"), exportX3GButton_Click));
|
||||
|
||||
if (ActiveSliceSettings.Instance.HasSdCardReader())
|
||||
{
|
||||
|
|
@ -196,6 +198,20 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
return true;
|
||||
}
|
||||
|
||||
bool exportX3GButton_Click()
|
||||
{
|
||||
if (ActivePrinterProfile.Instance.ActivePrinter == null)
|
||||
{
|
||||
UiThread.RunOnIdle(MustSelectPrinterMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiThread.RunOnIdle(SelectLocationToExportGCode);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void ExportToFolderFeedbackWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
this.exportingWindow = null;
|
||||
|
|
|
|||
|
|
@ -200,6 +200,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return GetActiveValue("has_sd_card_reader") == "1";
|
||||
}
|
||||
|
||||
public bool IsMakerbotGCodeFlavor()
|
||||
{
|
||||
return GetActiveValue("gcode_flavor") == "makerbot";
|
||||
}
|
||||
|
||||
public bool HasHeatedBed()
|
||||
{
|
||||
return GetActiveValue("has_heated_bed") == "1";
|
||||
|
|
|
|||
|
|
@ -2532,3 +2532,9 @@ Translated:The angle the support infill will be drawn.
|
|||
English:Infill Angle
|
||||
Translated:Infill Angle
|
||||
|
||||
English:Export to Folder
|
||||
Translated:Export to Folder
|
||||
|
||||
English:Export as X3G
|
||||
Translated:Export as X3G
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue