Skip to content

Commit

Permalink
v3.5.6
Browse files Browse the repository at this point in the history
- **Tools**
   - **PCB Exposure:**
      - (Add) Able to choose the size midpoint rounding method (#520)
      - (Fix) Allow to flash alone D03 commands (#520)
      - (Fix) Correct line thickness to have at least 1px error (#523)
   - (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation
- (Add) Cmd: Convert command now allow to pass 'auto' as target type to auto convert specific files, valid for SL1 files configured with FILEFORMAT_xxx (#522)
- (Add) GCode: Command to sync and wait for movement completion [Only enabled for cws format] (#514)
- (Add) VDT: Transition layer count
- (Upgrade) AvaloniaUI from 0.10.16 to 0.10.17
  • Loading branch information
sn4k3 committed Jul 29, 2022
1 parent 315ce3b commit 0805133
Show file tree
Hide file tree
Showing 34 changed files with 1,115 additions and 284 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 29/07/2022 - v3.5.6

- **Tools**
- **PCB Exposure:**
- (Add) Able to choose the size midpoint rounding method (#520)
- (Fix) Allow to flash alone D03 commands (#520)
- (Fix) Correct line thickness to have at least 1px error (#523)
- (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation
- (Add) Cmd: Convert command now allow to pass 'auto' as target type to auto convert specific files, valid for SL1 files configured with FILEFORMAT_xxx (#522)
- (Add) GCode: Command to sync and wait for movement completion [Only enabled for cws format] (#514)
- (Add) VDT: Transition layer count
- (Upgrade) AvaloniaUI from 0.10.16 to 0.10.17

## 18/07/2022 - v3.5.5

- **File formats:**
Expand Down
14 changes: 10 additions & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
- **File formats:**
- (Add) `LayerImageType`: Gets the layer image data type used on this file format
- (Improvement) jxs, rgb.cws and xml.cws: Improve the layer image read/write performance by a significant amount
- (Fix) xml.cws: Wanhao printers need 32 bit png instead of 8 bit png (#514)
- **Tools**
- **PCB Exposure:**
- (Add) Able to choose the size midpoint rounding method (#520)
- (Fix) Allow to flash alone D03 commands (#520)
- (Fix) Correct line thickness to have at least 1px error (#523)
- (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation
- (Add) Cmd: Convert command now allow to pass 'auto' as target type to auto convert specific files, valid for SL1 files configured with FILEFORMAT_xxx (#522)
- (Add) GCode: Command to sync and wait for movement completion [Only enabled for cws format] (#514)
- (Add) VDT: Transition layer count
- (Upgrade) AvaloniaUI from 0.10.16 to 0.10.17

2 changes: 1 addition & 1 deletion UVtools.AvaloniaControls/UVtools.AvaloniaControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.16" />
<PackageReference Include="Avalonia" Version="0.10.17" />
</ItemGroup>

<ItemGroup>
Expand Down
39 changes: 38 additions & 1 deletion UVtools.Cmd/Symbols/ConvertCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
using System;
using System.CommandLine;
using System.Globalization;
using System.IO;
using System.Linq;
using UVtools.Core.Extensions;
Expand All @@ -21,7 +22,7 @@ internal static Command CreateCommand()
var command = new Command("convert", "Convert input file into a output file format by a known type or extension")
{
GlobalArguments.InputFileArgument,
new Argument<string>("target-type/ext", "Target format type or extension"),
new Argument<string>("target-type/ext", "Target format type or extension. Use 'auto' for SL1 files with specified FILEFORMAT_xxx"),
GlobalArguments.OutputFileArgument,

new Option<ushort>(new[] {"-v", "--version"}, "Sets the file format version"),
Expand All @@ -30,6 +31,42 @@ internal static Command CreateCommand()

command.SetHandler((FileInfo inputFile, string targetTypeExt, FileInfo? outputFile, ushort version, bool noOverwrite) =>
{
if (string.Equals(targetTypeExt, "auto", StringComparison.InvariantCultureIgnoreCase))
{
using var testFile = Program.OpenInputFile(inputFile, FileFormat.FileDecodeType.Partial);
string? convertFileExtension;
switch (testFile)
{
case SL1File sl1File:
convertFileExtension = sl1File.LookupCustomValue<string>(SL1File.Keyword_FileFormat, null);
break;
case VDTFile vdtFile:
if (string.IsNullOrWhiteSpace(vdtFile.ManifestFile.Machine.UVToolsConvertTo) || vdtFile.ManifestFile.Machine.UVToolsConvertTo == "None")
convertFileExtension = vdtFile.LookupCustomValue<string>(SL1File.Keyword_FileFormat, null);
else
convertFileExtension = vdtFile.ManifestFile.Machine.UVToolsConvertTo;
break;
default:
Program.WriteLineError($"The file '{testFile.Filename}' is not a valid candidate for auto conversion. Please specify the target format instead.");
return;
}
if (string.IsNullOrWhiteSpace(convertFileExtension))
{
Program.WriteLineError($"The file '{testFile.Filename}' does not specify a target format, unable to guess. Please specify the target format instead.");
return;
}
convertFileExtension = convertFileExtension.ToLower(CultureInfo.InvariantCulture);
var fileExtension = FileFormat.FindExtension(convertFileExtension);
if (fileExtension is null)
{
Program.WriteLineError($"Unable to find a valid target type from '{convertFileExtension}' extension.");
}
targetTypeExt = fileExtension!.GetFileFormat()!.GetType().Name;
outputFile = new FileInfo(Path.Combine(testFile.DirectoryPath!, $"{testFile.FilenameNoExt}.{convertFileExtension}"));
}
var targetType = FileFormat.FindByType(targetTypeExt);
if (targetType is null)
{
Expand Down
2 changes: 1 addition & 1 deletion UVtools.Cmd/UVtools.Cmd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>UVtoolsCmd</AssemblyName>
<ApplicationIcon>UVtools.ico</ApplicationIcon>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Authors>Tiago Conceição, sn4k3</Authors>
<Company>PTRTECH</Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
Expand Down
43 changes: 43 additions & 0 deletions UVtools.Core/Extensions/EmguExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,49 @@ public static void Resize(this Mat src, double scale, Inter interpolation = Inte

#region Draw Methods

/// <summary>
/// Correct openCV thickness which always results larger than specified
/// </summary>
/// <param name="thickness">Thickness to correct</param>
/// <returns></returns>
public static int CorrectThickness(int thickness)
{
if (thickness < 3) return thickness;
return thickness - 1;
}

public static void DrawLineAccurate(this Mat src, Point pt1, Point pt2, MCvScalar color, int thickness, LineType lineType = LineType.EightConnected)
{
/*var deltaX = pt2.X - pt1.X;
var deltaY = pt2.Y - pt1.Y;
var deg = Math.Atan2(deltaY, deltaX) * (180 / Math.PI);
src.DrawRotatedRectangle(
new Size(Math.Abs(deltaX), thickness),
new Point(pt1.X + deltaX / 2, pt1.Y + deltaY / 2),
color, (int)deg, -1, lineType);*/

if (thickness >= 3)
{
thickness--;
/*var lastNumber = thickness % 10;
switch (lastNumber)
{
case 1:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
thickness--;
break;
}*/
}

CvInvoke.Line(src, pt1, pt2, color, thickness, lineType);
}

/// <summary>
/// Draw a rotated square around a center point
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions UVtools.Core/FileFormats/CWSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ public CWSFile()
};
GCode.CommandShowImageM6054.Set(";<Slice>", "{0}");
GCode.CommandWaitG4.Set(";<Delay>", "{0}");
GCode.CommandSyncMovements.Enabled = true;
}
#endregion

Expand Down
5 changes: 3 additions & 2 deletions UVtools.Core/FileFormats/FileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public override string ToString()
//new CXDLPv1File(), // Creality Box v1
new CXDLPFile(), // Creality Box
new LGSFile(), // LGS, LGS30
//new OSFFile(), // OSF
new FlashForgeSVGXFile(), // SVGX
new GenericZIPFile(), // Generic zip files
new VDAFile(), // VDA
Expand Down Expand Up @@ -2792,11 +2793,11 @@ public virtual float MaterialMilliliters {
get => _materialMilliliters;
set
{
if (value <= 0)
if (value <= 0) // Recalculate
{
value = (float)Math.Round(this.Where(layer => layer is not null).Sum(layer => layer.MaterialMilliliters), 3);
}
else
else // Set from value
{
value = (float)Math.Round(value, 3);
}
Expand Down
Loading

0 comments on commit 0805133

Please sign in to comment.