Merge pull request #5184 from larsbrubaker/main

main
This commit is contained in:
Lars Brubaker 2022-01-05 14:01:15 -08:00 committed by GitHub
commit b5a54a2d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 17 deletions

View file

@ -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());

View file

@ -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;
@ -78,7 +77,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;

View file

@ -215,8 +215,7 @@ namespace MatterHackers.MatterControl.Library.Export
var errors = new List<ValidationError>();
if (ApplicationSettings.ValidFileExtensions.IndexOf(sourceExtension, StringComparison.OrdinalIgnoreCase) >= 0
|| string.Equals(sourceExtension, ".mcx", StringComparison.OrdinalIgnoreCase))
if (ApplicationSettings.ValidFileExtensions.IndexOf(sourceExtension, StringComparison.OrdinalIgnoreCase) >= 0)
{
if (CenterOnBed)
{

View file

@ -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<ImageBuffer> thumbnailListener, Action<MeshContentProvider> buildThumbnail, ILibraryItem libraryItem, ILibraryContainer libraryContainer, int thumbWidth, int thumbHeight, ThemeConfig theme)

View file

@ -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)

View file

@ -213,6 +213,7 @@ namespace MatterHackers.MatterControl.PrintQueue
case ".STL":
return StlProcessing.GetEstimatedMemoryUse(fileLocation);
case ".3MF":
case ".AMF":
return AmfDocument.GetEstimatedMemoryUse(fileLocation);

View file

@ -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;

View file

@ -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();

View file

@ -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
@ -973,6 +979,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).
@ -1048,6 +1057,9 @@ Translated:Gear
English:General
Translated:General
English:Generate
Translated:Generate
English:Generate Support
Translated:Generate Support
@ -1150,6 +1162,9 @@ Translated:Help
English:HEXAGON
Translated:HEXAGON
English:Hide
Translated:Hide
English:History
Translated:History
@ -1873,6 +1888,9 @@ Translated:Outside Perimeters
English:Overhang
Translated:Overhang
English:Overhang Angle
Translated:Overhang Angle
English:Override Radius
Translated:Override Radius
@ -1927,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
@ -2188,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?
@ -2365,6 +2389,9 @@ Translated:Seam Placement
English:Search
Translated:Search
English:Search Results
Translated:Search Results
English:seconds
Translated:seconds
@ -2575,6 +2602,9 @@ Translated:Sphere
English:Spiral Vase
Translated:Spiral Vase
English:Split
Translated:Split
English:Split Mesh
Translated:Split Mesh
@ -2731,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}
@ -3046,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.

@ -1 +1 @@
Subproject commit 3ff85dfb5a47d603d123c185e4b6adb1e7dedabd
Subproject commit 03e836b4b1a85321ef1d33fc66c1e2b5f67134df