diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-06-29 07:18:33 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-06-29 07:18:33 +0300 |
commit | 2cbb3f377a7931cc66fae4145c84e99154028327 (patch) | |
tree | a9aa4801e580a9e39e1ce3001e4e162789ff1bf6 /UVtools.Cmd | |
parent | 6d401eb774bc4d9a0014e24b2d48c4f5e156d912 (diff) |
v0.6.0.0v0.6.0.0
* (Add) UVtools now notify when a new version available is detected
* (Add) Mutator "Flip"
* (Add) Mutator "Rotate"
* (Add) User Settings - Many parameters can now be customized to needs
* (Add) File load elapsed time into Title bar
* (Add) Outline - Print Volume bounds
* (Add) Outline - Layer bounds
* (Add) Outline - Hollow areas
* (Add) Double click layer picture to Zoom To Fit
* (Improvement) Huge performance boost in layer reparing and in every mutator
* (Improvement) Layer preview is now faster
* (Improvement) Islands detection is now better and don't skip any pixel, more islands will show or the region will be bigger
* (Improvement) Islands search are now faster, it will jump from island to insland instead of search in every pixel by pixel
* (Improvement) ResinTrap detection and corrected some cases where it can't detect a drain
* (Improvement) Better memory optimization by dispose all objects on operations
* (Improvement) Image engine changed to use only OpenCV Mat instead of two and avoid converting from one to another, as result there's a huge performance gain in some operations (#6)
* (Improvement) UVtools now rely on UVtools.Core, and drop the UVtools.Parser. The Core now perform all operations and transformations inplace of the GUI
* (Improvement) If error occur during save it will show a message with the error
* (Improvement) When rotate layer it will zoom to fit
* (Improvement) Allow zoom to fit to print volume area instead of whole build volume
* (Removed) ImageSharp dependency
* (Removed) UVtools.Parser project
* (Fix) Nova3D Elfin printer values changed to Display Width : 131mm / Height : 73mm & Screen X: 2531 / Y: 1410 (#5)
* (Fix) Fade resizes make image offset a pixel from layer to layer because of integer placement, now it matain the correct position
* (Fix) sl1: AbsoluteCorrection, GammaCorrection, MinExposureTime, MaxExposureTime, FastTiltTime, SlowTiltTime and AreaFill was byte and float values prevents the file from open (#4)
* (Fix) zcodex: XCorrection and YCorrection was byte and float values prevents the file from open (#4)
* (Fix) cws: XCorrection and YCorrection was byte and float values prevents the file from open (#4)
* (Fix) cws: Wrong # char on .gcode file prevent from printing (#4)
Diffstat (limited to 'UVtools.Cmd')
-rw-r--r-- | UVtools.Cmd/Program.cs | 106 |
1 files changed, 72 insertions, 34 deletions
diff --git a/UVtools.Cmd/Program.cs b/UVtools.Cmd/Program.cs index 1b8b7cc..b1224f7 100644 --- a/UVtools.Cmd/Program.cs +++ b/UVtools.Cmd/Program.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; using System.Diagnostics; +using System.Drawing; +using System.Globalization; using System.IO; using System.Reflection; +using System.Threading; using System.Threading.Tasks; using UVtools.Core; @@ -14,6 +17,7 @@ namespace UVtools.Cmd { public static async Task<int> Main(params string[] args) { + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); Stopwatch sw = new Stopwatch(); uint count = 0; var rootCommand = new RootCommand("MSLA/DLP, file analysis, repair, conversion and manipulation") @@ -27,12 +31,17 @@ namespace UVtools.Cmd { Argument = new Argument<FileSystemInfo>("filepath") }, + new Option(new []{"-e", "--extract"}, "Extract file content to a folder") + { + Argument = new Argument<DirectoryInfo>("folder") + }, new Option(new []{"-c", "--convert"}, "Converts input into a output file format by it extension") { Argument = new Argument<FileSystemInfo>("filepath") }, new Option(new []{"-p", "--properties"}, "Print a list of all properties/settings"), + new Option(new []{"-gcode"}, "Print the GCode if available"), new Option(new []{"-i", "--issues"}, "Compute and print a list of all issues"), new Option(new []{"-r", "--repair"}, "Attempt to repair all issues"){ Argument = new Argument<int[]>("[start layer index] [end layer index]") @@ -40,73 +49,58 @@ namespace UVtools.Cmd new Option(new []{"-mr", "--mut-resize"}, "Resizes layer images in a X and/or Y factor, starting from 100% value") { - Argument = new Argument<int[]>("[x%] [y%] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<double[]>("[x%] [y%] [start layer index] [end layer index] [fade 0/1]") }, new Option(new []{"-ms", "--mut-solidify"}, "Closes all inner holes") { - Argument = new Argument<int[]>("[start layer index] [end layer index]") + Argument = new Argument<uint[]>("[start layer index] [end layer index]") }, new Option(new []{"-me", "--mut-erode"}, "Erodes away the boundaries of foreground object") { - Argument = new Argument<int[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<uint[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") }, new Option(new []{"-md", "--mut-dilate"}, "It is just opposite of erosion") { - Argument = new Argument<int[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<uint[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") }, new Option(new []{"-mc", "--mut-close"}, "Dilation followed by Erosion") { - Argument = new Argument<int[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<uint[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") }, new Option(new []{"-mo", "--mut-open"}, "Erosion followed by Dilation") { - Argument = new Argument<int[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<uint[]>("[start iterations] [end iterations] [start layer index] [end layer index] [fade 0/1]") }, new Option(new []{"-mg", "--mut-gradient"}, "The difference between dilation and erosion of an image") { - Argument = new Argument<int[]>("[kernel size] [start layer index] [end layer index] [fade 0/1]") + Argument = new Argument<uint[]>("[kernel size] [start layer index] [end layer index] [fade 0/1]") }, - new Option(new []{"-mpyr", "--mut-pyr"}, "Performs downsampling step of Gaussian pyramid decomposition") + new Option(new []{"-mpy", "--mut-py"}, "Performs downsampling step of Gaussian pyramid decomposition") { - Argument = new Argument<int[]>("[start layer index] [end layer index]") + Argument = new Argument<uint[]>("[start layer index] [end layer index]") }, new Option(new []{"-mgb", "--mut-gaussian-blur"}, "Each pixel is a sum of fractions of each pixel in its neighborhood") { - Argument = new Argument<int[]>("[aperture] [sigmaX] [sigmaY]") + Argument = new Argument<ushort[]>("[aperture] [sigmaX] [sigmaY]") }, new Option(new []{"-mmb", "--mut-median-blur"}, "Each pixel becomes the median of its surrounding pixels") { Argument = new Argument<ushort>("[aperture]") }, - - - - - /*new Option(new []{"-ls", "--layer-start"}, "Specify a start layer index to use with some operations as a range") - { - Argument = new Argument<uint>("Layer index") - }, - - new Option(new []{"-le", "--layer-end"}, "Specify a end layer index to use with some operations as a range") - { - Argument = new Argument<uint>("Layer index") - }, - - new Option(new []{"-is", "--iteration-start"}, "Specify a start layer index to use with some operations as a range") - { - Argument = new Argument<uint>("Layer index") - }, - - new Option(new []{"-fade"}, "Fade a start value towards a end value to use with some operations")*/ - }; rootCommand.Handler = CommandHandler.Create( - (FileSystemInfo file, FileSystemInfo convert, bool properties, bool issues, bool repair, uint layerStartIndex, uint layerEndIndex) => + ( + FileSystemInfo file, + FileSystemInfo convert, + DirectoryInfo extract, + bool properties, + bool gcode, + bool issues, + bool repair + ) => { - Console.WriteLine($"Reading: {file}"); - var fileFormat = FileFormat.FindByExtension(file.FullName, true, true); if (ReferenceEquals(fileFormat, null)) { @@ -114,7 +108,35 @@ namespace UVtools.Cmd } else { + Console.Write($"Reading: {file}"); + sw.Restart(); fileFormat.Decode(file.FullName); + sw.Stop(); + Console.WriteLine($", in {sw.ElapsedMilliseconds}ms"); + Console.WriteLine("----------------------"); + Console.WriteLine($"Layers: {fileFormat.LayerCount} x {fileFormat.LayerHeight}mm = {fileFormat.TotalHeight}mm"); + Console.WriteLine($"Resolution: {new Size((int) fileFormat.ResolutionX, (int) fileFormat.ResolutionY)}"); + Console.WriteLine($"AntiAlias: {fileFormat.ValidateAntiAliasingLevel()}"); + + Console.WriteLine($"Bottom Layer Count: {fileFormat.InitialLayerCount}"); + Console.WriteLine($"Bottom Exposure Time: {fileFormat.InitialExposureTime}s"); + Console.WriteLine($"Layer Exposure Time: {fileFormat.LayerExposureTime}s"); + Console.WriteLine($"Print Time: {fileFormat.PrintTime}s"); + Console.WriteLine($"Cost: {fileFormat.MaterialCost}$"); + Console.WriteLine($"Resin Name: {fileFormat.MaterialName}"); + Console.WriteLine($"Machine Name: {fileFormat.MachineName}"); + + Console.WriteLine($"Thumbnails: {fileFormat.CreatedThumbnailsCount}"); + Console.WriteLine("----------------------"); + } + + if (!ReferenceEquals(extract, null)) + { + Console.Write($"Extracting to {extract.FullName}"); + sw.Restart(); + fileFormat.Extract(extract.FullName); + sw.Stop(); + Console.WriteLine($", finished in {sw.ElapsedMilliseconds}ms"); } if (properties) @@ -140,6 +162,22 @@ namespace UVtools.Cmd Console.WriteLine($"Total properties: {count}"); } + if (gcode) + { + if (ReferenceEquals(fileFormat.GCode, null)) + { + Console.WriteLine("No GCode available"); + } + else + { + Console.WriteLine("----------------------"); + Console.WriteLine(fileFormat.GCode); + Console.WriteLine("----------------------"); + Console.WriteLine($"Total lines: {fileFormat.GCode.Length}"); + } + + } + if (issues) { Console.WriteLine("Computing Issues, please wait."); |