Load GCodeStream from LibraryItem, process and export
- Issue MatterHackers/MCCentral#3835 Export option not available for gcode files
This commit is contained in:
parent
8e3c9392c2
commit
9014c6021a
3 changed files with 17 additions and 3 deletions
|
|
@ -123,7 +123,19 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
|
||||
bool centerOnBed = true;
|
||||
|
||||
if (firstItem.AssetPath == printer.Bed.EditContext.SourceFilePath)
|
||||
var assetStream = firstItem as ILibraryAssetStream;
|
||||
if (assetStream?.ContentType == "gcode")
|
||||
{
|
||||
using (var gcodeStream = await assetStream.GetStream(progress: null))
|
||||
{
|
||||
this.ApplyStreamPipelineAndExport(
|
||||
new GCodeFileStream(new GCodeFileStreamed(gcodeStream.Stream)),
|
||||
outputPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (firstItem.AssetPath == printer.Bed.EditContext.SourceFilePath)
|
||||
{
|
||||
// If item is bedplate, save any pending changes before starting the print
|
||||
await ApplicationController.Instance.Tasks.Execute("Saving".Localize(), printer.Bed.SaveChanges);
|
||||
|
|
@ -134,7 +146,7 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
{
|
||||
loadedItem = await object3DItem.CreateContent(null);
|
||||
}
|
||||
else if (firstItem is ILibraryAssetStream assetStream)
|
||||
else if (assetStream != null)
|
||||
{
|
||||
loadedItem = await assetStream.CreateContent(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -568,6 +568,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
});
|
||||
},
|
||||
IsEnabled = () => sceneContext.EditableScene
|
||||
|| (sceneContext.EditContext.SourceItem is ILibraryAsset libraryAsset
|
||||
&& string.Equals(Path.GetExtension(libraryAsset.FileName) ,".gcode" ,StringComparison.OrdinalIgnoreCase))
|
||||
},
|
||||
new NamedAction()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 48fd4f32c4b6427e707aa98421406eba1f6c49d1
|
||||
Subproject commit 6ed7846ece258042d42ad6704d018591ea11fe37
|
||||
Loading…
Add table
Add a link
Reference in a new issue