From fa28bca56f776f31239fcf3b9edb4440369e2ebe Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 4 Jan 2022 18:10:08 -0800 Subject: [PATCH 1/2] 3df loading working mostly --- .../ApplicationView/ApplicationController.cs | 2 +- .../Library/ContentProviders/MeshContentProvider.cs | 3 ++- MatterControlLib/Library/Export/GCodeExport.cs | 3 +-- MatterControlLib/Library/Providers/LibraryConfig.cs | 2 +- MatterControlLib/Library/Widgets/LibraryWidget.cs | 4 ++-- MatterControlLib/Queue/QueueData.cs | 1 + .../SettingsManagement/ApplicationSettings.cs | 10 +++------- Program.cs | 2 +- StaticData/Translations/Master.txt | 6 ++++++ Submodules/agg-sharp | 2 +- 10 files changed, 19 insertions(+), 16 deletions(-) diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index 4aaeb7365..876a2d1c4 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -998,7 +998,7 @@ namespace MatterHackers.MatterControl Object3D.AssetsPath = ApplicationDataStorage.Instance.LibraryAssetsPath; this.Library = new LibraryConfig(); - this.Library.ContentProviders.Add(new[] { "stl", "obj", "amf", "mcx" }, new MeshContentProvider()); + this.Library.ContentProviders.Add(new[] { "stl", "obj", "3mf", "amf", "mcx" }, new MeshContentProvider()); this.Library.ContentProviders.Add("gcode", new GCodeContentProvider()); this.Library.ContentProviders.Add(new[] { "png", "gif", "jpg", "jpeg" }, new ImageContentProvider()); this.Library.ContentProviders.Add(new[] { "scad" }, new OpenScadContentProvider()); diff --git a/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs b/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs index 6b19957a7..694e58295 100644 --- a/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs +++ b/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs @@ -78,7 +78,8 @@ namespace MatterHackers.MatterControl loadedItem = Object3D.Load(contentStream.Stream, Path.GetExtension(streamInterface.FileName), CancellationToken.None, null /*itemCache*/, progressReporter); // Set MeshPath for non-mcx content. Avoid on mcx to ensure serialization of children - if (item is FileSystemFileItem fileItem + if (loadedItem != null + && item is FileSystemFileItem fileItem && !string.Equals(Path.GetExtension(fileItem.FileName), ".mcx", StringComparison.OrdinalIgnoreCase)) { loadedItem.MeshPath = fileItem.Path; diff --git a/MatterControlLib/Library/Export/GCodeExport.cs b/MatterControlLib/Library/Export/GCodeExport.cs index a5cec98a0..24d2b8428 100644 --- a/MatterControlLib/Library/Export/GCodeExport.cs +++ b/MatterControlLib/Library/Export/GCodeExport.cs @@ -215,8 +215,7 @@ namespace MatterHackers.MatterControl.Library.Export var errors = new List(); - if (ApplicationSettings.ValidFileExtensions.IndexOf(sourceExtension, StringComparison.OrdinalIgnoreCase) >= 0 - || string.Equals(sourceExtension, ".mcx", StringComparison.OrdinalIgnoreCase)) + if (ApplicationSettings.ValidFileExtensions.IndexOf(sourceExtension, StringComparison.OrdinalIgnoreCase) >= 0) { if (CenterOnBed) { diff --git a/MatterControlLib/Library/Providers/LibraryConfig.cs b/MatterControlLib/Library/Providers/LibraryConfig.cs index d424cc4e8..14a0f97e5 100644 --- a/MatterControlLib/Library/Providers/LibraryConfig.cs +++ b/MatterControlLib/Library/Providers/LibraryConfig.cs @@ -204,7 +204,7 @@ namespace MatterHackers.MatterControl.Library { string fileExtensionLower = Path.GetExtension(fileName).ToLower().Trim('.'); return !string.IsNullOrEmpty(fileExtensionLower) - && ApplicationSettings.LibraryMeshFileExtensions.Contains(fileExtensionLower); + && ApplicationSettings.ValidFileExtensions.Contains(fileExtensionLower); } public async Task LoadItemThumbnail(Action thumbnailListener, Action buildThumbnail, ILibraryItem libraryItem, ILibraryContainer libraryContainer, int thumbWidth, int thumbHeight, ThemeConfig theme) diff --git a/MatterControlLib/Library/Widgets/LibraryWidget.cs b/MatterControlLib/Library/Widgets/LibraryWidget.cs index cba7393c0..3fdeaa6c9 100644 --- a/MatterControlLib/Library/Widgets/LibraryWidget.cs +++ b/MatterControlLib/Library/Widgets/LibraryWidget.cs @@ -589,13 +589,13 @@ namespace MatterHackers.MatterControl.PrintLibrary { Icon = StaticData.Instance.LoadIcon("cube.png", 16, 16).SetToColor(theme.TextColor), Title = "Add".Localize(), - ToolTipText = "Add an.stl, .obj, .amf, .gcode or.zip file to the Library".Localize(), + ToolTipText = "Add an.stl, .obj, .3mf, .amf, .gcode or.zip file to the Library".Localize(), Action = (selectedLibraryItems, listView) => { UiThread.RunOnIdle(() => { AggContext.FileDialogs.OpenFileDialog( - new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams, multiSelect: true), + new OpenFileDialogParams(ApplicationSettings.OpenDesignFileParams, multiSelect: true), (openParams) => { if (openParams.FileNames != null) diff --git a/MatterControlLib/Queue/QueueData.cs b/MatterControlLib/Queue/QueueData.cs index 3c44f6717..591627ce7 100644 --- a/MatterControlLib/Queue/QueueData.cs +++ b/MatterControlLib/Queue/QueueData.cs @@ -213,6 +213,7 @@ namespace MatterHackers.MatterControl.PrintQueue case ".STL": return StlProcessing.GetEstimatedMemoryUse(fileLocation); + case ".3MF": case ".AMF": return AmfDocument.GetEstimatedMemoryUse(fileLocation); diff --git a/MatterControlLib/SettingsManagement/ApplicationSettings.cs b/MatterControlLib/SettingsManagement/ApplicationSettings.cs index 98de9446f..2ea429e9e 100644 --- a/MatterControlLib/SettingsManagement/ApplicationSettings.cs +++ b/MatterControlLib/SettingsManagement/ApplicationSettings.cs @@ -47,15 +47,11 @@ namespace MatterHackers.MatterControl public class ApplicationSettings { - public static string ValidFileExtensions { get; } = ".STL;.AMF;.OBJ"; + public static string ValidFileExtensions { get; } = ".stl,.obj,.3mf,.amf,.mcx"; - public static string LibraryMeshFileExtensions { get; } = ".stl,.obj,.amf,.mcx"; + public static string LibraryFilterFileExtensions { get; } = ValidFileExtensions + ",.gcode"; - public static string LibraryFilterFileExtensions { get; } = LibraryMeshFileExtensions + ",.gcode"; - - public static string OpenPrintableFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx"; - - public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx"; + public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, 3MF, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx"; private static ApplicationSettings globalInstance = null; diff --git a/Program.cs b/Program.cs index 918581527..4aaad09a2 100644 --- a/Program.cs +++ b/Program.cs @@ -317,7 +317,7 @@ namespace MatterHackers.MatterControl systemWindow.ShowAsSystemWindow(); } - private static string[] shellFileExtensions = new string[] { ".stl", ".amf" }; + private static string[] shellFileExtensions = new string[] { ".stl", ".amf", ".3mf", ".obj" }; private static readonly object locker = new object(); diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 9fd97cbd4..58684941a 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -973,6 +973,9 @@ Translated:Fit to Cylinder English:Flat Translated:Flat +English:Flattened +Translated:Flattened + English:Force a retraction when moving between islands (distinct parts on the layer). Translated:Force a retraction when moving between islands (distinct parts on the layer). @@ -2575,6 +2578,9 @@ Translated:Sphere English:Spiral Vase Translated:Spiral Vase +English:Split +Translated:Split + English:Split Mesh Translated:Split Mesh diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 3ff85dfb5..a4ed28cd0 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 3ff85dfb5a47d603d123c185e4b6adb1e7dedabd +Subproject commit a4ed28cd0824cc393a0af1bd1109541408a6a87a From e71ec183fa2c0ea17d25bb1687c714a1981ab47f Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 5 Jan 2022 13:22:06 -0800 Subject: [PATCH 2/2] Better loading of sub groups in 3mf files --- .../ContentProviders/MeshContentProvider.cs | 1 - StaticData/Translations/Master.txt | 30 +++++++++++++++++++ Submodules/agg-sharp | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs b/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs index 694e58295..442834267 100644 --- a/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs +++ b/MatterControlLib/Library/ContentProviders/MeshContentProvider.cs @@ -34,7 +34,6 @@ namespace MatterHackers.MatterControl using System; using System.IO; using System.Threading; - using MatterHackers.Agg; using MatterHackers.Agg.Image; using MatterHackers.Agg.Platform; using MatterHackers.DataConverters3D; diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 58684941a..0676191ac 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -100,6 +100,9 @@ Translated:Add English:Add all the items on the bed to the print queue. Translated:Add all the items on the bed to the print queue. +English:Add an.stl, .obj, .3mf, .amf, .gcode or.zip file to the Library +Translated:Add an.stl, .obj, .3mf, .amf, .gcode or.zip file to the Library + English:Add an.stl, .obj, .amf, .gcode or.zip file to the Library Translated:Add an.stl, .obj, .amf, .gcode or.zip file to the Library @@ -940,6 +943,9 @@ Translated:Final Vertices English:Finalized Translated:Finalized +English:Find and create supports where needed +Translated:Find and create supports where needed + English:Find Slice Translated:Find Slice @@ -1051,6 +1057,9 @@ Translated:Gear English:General Translated:General +English:Generate +Translated:Generate + English:Generate Support Translated:Generate Support @@ -1153,6 +1162,9 @@ Translated:Help English:HEXAGON Translated:HEXAGON +English:Hide +Translated:Hide + English:History Translated:History @@ -1876,6 +1888,9 @@ Translated:Outside Perimeters English:Overhang Translated:Overhang +English:Overhang Angle +Translated:Overhang Angle + English:Override Radius Translated:Override Radius @@ -1930,6 +1945,9 @@ Translated:Perimeters Per Extruder English:PETG Temperature Tower Translated:PETG Temperature Tower +English:Pillar Size +Translated:Pillar Size + English:Pin Translated:Pin @@ -2191,6 +2209,9 @@ Translated:Reloading English:Remove Translated:Remove +English:Remove all auto generated supports +Translated:Remove all auto generated supports + English:Remove Items? Translated:Remove Items? @@ -2368,6 +2389,9 @@ Translated:Seam Placement English:Search Translated:Search +English:Search Results +Translated:Search Results + English:seconds Translated:seconds @@ -2737,6 +2761,9 @@ Translated:The angle at which the support material lines will be drawn. English:The angle of the infill, measured from the X axis. Not used when bridging. Translated:The angle of the infill, measured from the X axis. Not used when bridging. +English:The angle to generate support for +Translated:The angle to generate support for + English:The bed is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting bed temperature in SETTINGS -> Filament -> Temperatures.\n\n{1} Translated:The bed is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting bed temperature in SETTINGS -> Filament -> Temperatures.\n\n{1} @@ -3052,6 +3079,9 @@ Translated:The time it takes to heat back up from a cool down. English:The time over which to increase the Extra Length On Restart to its maximum value. Below this time only a portion of the extra length will be applied. Leave 0 to apply the entire amount all the time. Translated:The time over which to increase the Extra Length On Restart to its maximum value. Below this time only a portion of the extra length will be applied. Leave 0 to apply the entire amount all the time. +English:The width and depth of the support pillars +Translated:The width and depth of the support pillars + English:The X and Y position of the hot end that minimizes the chance of colliding with the parts on the bed. Translated:The X and Y position of the hot end that minimizes the chance of colliding with the parts on the bed. diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index a4ed28cd0..03e836b4b 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit a4ed28cd0824cc393a0af1bd1109541408a6a87a +Subproject commit 03e836b4b1a85321ef1d33fc66c1e2b5f67134df