Moved the primitives contain into MatterControlLib
moved part sheet creator into MatterControlLib moved some other experimental parts to MatterControlLib
This commit is contained in:
parent
f982a60ce6
commit
ef17f38bb7
20 changed files with 3547 additions and 2 deletions
82
MatterControlLib/Library/PartSheets/PartSheetPlugin.cs
Normal file
82
MatterControlLib/Library/PartSheets/PartSheetPlugin.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Copyright (c) 2019, Kevin Pope, John Lewin
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.Extensibility;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
|
||||
namespace MatterHackers.MatterControl.Plugins
|
||||
{
|
||||
public class PartSheetPlugin : IApplicationPlugin
|
||||
{
|
||||
public void Initialize()
|
||||
{
|
||||
// PDF export is limited to Windows
|
||||
if (AggContext.OperatingSystem != OSType.Windows)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationController.Instance.Library.MenuExtensions.Add(
|
||||
new LibraryAction(ActionScope.ListItem)
|
||||
{
|
||||
Title = "Create Part Sheet".Localize(),
|
||||
Action = (selectedLibraryItems, listView) =>
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
var printItems = selectedLibraryItems.OfType<ILibraryAssetStream>();
|
||||
if (printItems.Any())
|
||||
{
|
||||
AggContext.FileDialogs.SaveFileDialog(
|
||||
new SaveFileDialogParams("Save Parts Sheet|*.pdf")
|
||||
{
|
||||
ActionButtonLabel = "Save Parts Sheet".Localize(),
|
||||
Title = ApplicationController.Instance.ProductName + " - " + "Save".Localize()
|
||||
},
|
||||
(saveParams) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(saveParams.FileName))
|
||||
{
|
||||
var feedbackWindow = new SavePartsSheetFeedbackWindow(
|
||||
printItems.Count(),
|
||||
printItems.FirstOrDefault()?.Name,
|
||||
AppContext.Theme.BackgroundColor);
|
||||
|
||||
var currentPartsInQueue = new PartsSheet(printItems, saveParams.FileName);
|
||||
currentPartsInQueue.UpdateRemainingItems += feedbackWindow.StartingNextPart;
|
||||
currentPartsInQueue.DoneSaving += feedbackWindow.DoneSaving;
|
||||
|
||||
feedbackWindow.ShowAsSystemWindow();
|
||||
|
||||
currentPartsInQueue.SaveSheets().ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
IsEnabled = (selectedListItems, listView) =>
|
||||
{
|
||||
// Multiselect - disallow containers
|
||||
return listView.SelectedItems.Any()
|
||||
&& listView.SelectedItems.All(i => !(i.Model is ILibraryContainerLink));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public PluginInfo MetaData { get; } = new PluginInfo()
|
||||
{
|
||||
Name = "Part Sheets",
|
||||
UUID = "580D8EF3-885C-4DD3-903A-4DB136AFD84B",
|
||||
About = "A part sheet plugin",
|
||||
Developer = "MatterHackers, Inc.",
|
||||
Url = "https://www.matterhackers.com"
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue