Skip to content

Commit

Permalink
v3.11.1
Browse files Browse the repository at this point in the history
- (Improvement) Remove developer machine path in PDB / error messages
- (Fix) HoneyComb infill not going to the right most edge of the image (#649)
- (Fix) AnyCubic machine names were not showing in most files
- (Fix) PWMX: Unable to set version 1
- (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653)
  • Loading branch information
sn4k3 committed Jan 31, 2023
1 parent e953d62 commit 86cd97b
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 87 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 30/01/2023 - v3.11.1

- (Improvement) Remove developer machine path in PDB / error messages
- (Fix) HoneyComb infill not going to the right most edge of the image (#649)
- (Fix) AnyCubic machine names were not showing in most files
- (Fix) PWMX: Unable to set version 1
- (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653)

## 15/01/2023 - v3.11.0

- **UI:**
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<PathMap>$(MSBuildProjectDirectory)=$(MSBuildProjectName)</PathMap>
</PropertyGroup>
</Project>
26 changes: 5 additions & 21 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
- **UI:**
- (Improvement) Layer navigation load time by parallel `Mat` to `Bitmap` conversion
- (Improvement) Allow to show exceptions without the stack trace and detailed trigger action by using the `MessageExceiption` (#644)
- (Improvement) Allow progress to have and display a detailed log (#644)
- (Improvement) Convert format to another with multiple versions will now only show the possible versions for the extension
- **Suggestion - Wait time before cure:**
- (Improvement) Set the first wait time based on first valid layer mass rather than use the fixed limit
- (Improvement) Set zero time to empty and dummy layers
- (Improvement) When creating the dummy layer also increment the bottom layer count as the created layer count as one
- **PCB Exposure:**
- (Add) Excellon Drill Format (drl) to cut off holes (Implementation may lack some advanced features, please confirm the result) (#646)
- (Fix) Arc (G03) with negative offsets (I-/J-) was not drawing the shape correctly
- (Fix) Implement the rotation for the outline primitive (#645)
- **File formats:**
- (Improvement) Formats now sanitize the selected version before encode given the file extension, if version is out of range it will force the last known version
- (Fix) CBDDLP: Remove a table from the file that might cause layer corruption
- (Add) Operations - `AfterCompleteReport` property: Gets or sets an report to show to the user after complete the operation with success
- (Improvement) Suggestion - Wait time after cure: Set zero time to empty and dummy layers
- (Improvement) Slight improvement on the contour intersection check, yields better performance on resin and suction cup detection
- (Improvement) Allow to trigger message boxes from operations and scripts (#644)
- (Upgrade) .NET from 6.0.12 to 6.0.13
- (Improvement) Remove developer machine path in PDB / error messages
- (Fix) HoneyComb infill not going to the right most edge of the image (#649)
- (Fix) AnyCubic machine names were not showing in most files
- (Fix) PWMX: Unable to set version 1
- (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653)

34 changes: 22 additions & 12 deletions UVtools.Core/FileFormats/FileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@ public virtual uint ResolutionX
RaisePropertyChanged(nameof(DisplayAspectRatioStr));
RaisePropertyChanged(nameof(IsDisplayPortrait));
RaisePropertyChanged(nameof(IsDisplayLandscape));

RaisePropertyChanged(nameof(Xppmm));
RaisePropertyChanged(nameof(PixelWidth));
RaisePropertyChanged(nameof(PixelWidthMicrons));

NotifyAspectChange();
}
}
Expand All @@ -1586,6 +1591,11 @@ public virtual uint ResolutionY
RaisePropertyChanged(nameof(DisplayAspectRatioStr));
RaisePropertyChanged(nameof(IsDisplayPortrait));
RaisePropertyChanged(nameof(IsDisplayLandscape));

RaisePropertyChanged(nameof(Yppmm));
RaisePropertyChanged(nameof(PixelHeight));
RaisePropertyChanged(nameof(PixelHeightMicrons));

NotifyAspectChange();
}
}
Expand Down Expand Up @@ -1626,6 +1636,9 @@ public virtual float DisplayWidth
RaisePropertyChanged(nameof(Display));
RaisePropertyChanged(nameof(DisplayDiagonal));
RaisePropertyChanged(nameof(DisplayDiagonalInches));
RaisePropertyChanged(nameof(Xppmm));
RaisePropertyChanged(nameof(PixelWidth));
RaisePropertyChanged(nameof(PixelWidthMicrons));
NotifyAspectChange();
}
}
Expand All @@ -1642,6 +1655,9 @@ public virtual float DisplayHeight
RaisePropertyChanged(nameof(Display));
RaisePropertyChanged(nameof(DisplayDiagonal));
RaisePropertyChanged(nameof(DisplayDiagonalInches));
RaisePropertyChanged(nameof(Yppmm));
RaisePropertyChanged(nameof(PixelHeight));
RaisePropertyChanged(nameof(PixelHeightMicrons));
NotifyAspectChange();
}
}
Expand Down Expand Up @@ -1704,12 +1720,12 @@ public virtual float MachineZ
/// <summary>
/// Gets or sets the pixels per mm on X direction
/// </summary>
public virtual float Xppmm => DisplayWidth > 0 ? ResolutionX / DisplayWidth : 0;
public virtual float Xppmm => ResolutionX > 0 && DisplayWidth > 0 ? ResolutionX / DisplayWidth : 0;

/// <summary>
/// Gets or sets the pixels per mm on Y direction
/// </summary>
public virtual float Yppmm => DisplayHeight > 0 ? ResolutionY / DisplayHeight : 0;
public virtual float Yppmm => ResolutionY > 0 && DisplayHeight > 0 ? ResolutionY / DisplayHeight : 0;

/// <summary>
/// Gets or sets the pixels per mm
Expand Down Expand Up @@ -1749,12 +1765,12 @@ public virtual float MachineZ
/// <summary>
/// Gets the pixel width in microns
/// </summary>
public float PixelWidthMicrons => DisplayWidth > 0 ? (float)Math.Round(DisplayWidth / ResolutionX * 1000, 3) : 0;
public float PixelWidthMicrons => DisplayWidth > 0 && ResolutionX > 0 ? (float)Math.Round(DisplayWidth / ResolutionX * 1000, 3) : 0;

/// <summary>
/// Gets the pixel height in microns
/// </summary>
public float PixelHeightMicrons => DisplayHeight > 0 ? (float)Math.Round(DisplayHeight / ResolutionY * 1000, 3) : 0;
public float PixelHeightMicrons => DisplayHeight > 0 && ResolutionY > 0 ? (float)Math.Round(DisplayHeight / ResolutionY * 1000, 3) : 0;

/// <summary>
/// Gets the pixel size in microns
Expand Down Expand Up @@ -3241,20 +3257,14 @@ public void Dispose()
/// </summary>
protected void NotifyAspectChange()
{
RaisePropertyChanged(nameof(Xppmm));
RaisePropertyChanged(nameof(Yppmm));
RaisePropertyChanged(nameof(Ppmm));
RaisePropertyChanged(nameof(PpmmMax));
RaisePropertyChanged(nameof(PixelSizeMicrons));
RaisePropertyChanged(nameof(PixelArea));
RaisePropertyChanged(nameof(PixelAreaMicrons));
RaisePropertyChanged(nameof(PixelSizeMicronsMax));
RaisePropertyChanged(nameof(PixelHeight));
RaisePropertyChanged(nameof(PixelHeightMicrons));
RaisePropertyChanged(nameof(PixelSize));
RaisePropertyChanged(nameof(PixelSizeMax));
RaisePropertyChanged(nameof(PixelWidth));
RaisePropertyChanged(nameof(PixelWidthMicrons));
}
#endregion

Expand Down Expand Up @@ -6443,10 +6453,10 @@ public Mat GenerateHeatmap(uint layerIndexStart = 0, uint layerIndexEnd = uint.M
public Mat GenerateHeatmap(Rectangle roi, OperationProgress? progress = null) => GenerateHeatmap(0, uint.MaxValue, roi, progress);

public Task<Mat> GenerateHeatmapAsync(uint layerIndexStart = 0, uint layerIndexEnd = uint.MaxValue, Rectangle roi = default, OperationProgress? progress = null)
=> Task.Run(() => GenerateHeatmap(layerIndexStart, layerIndexEnd, roi, progress));
=> Task.Run(() => GenerateHeatmap(layerIndexStart, layerIndexEnd, roi, progress), progress?.Token ?? default);

public Task<Mat> GenerateHeatmapAsync(Rectangle roi, OperationProgress? progress = null)
=> Task.Run(() => GenerateHeatmap(0, uint.MaxValue, roi, progress));
=> Task.Run(() => GenerateHeatmap(0, uint.MaxValue, roi, progress), progress?.Token ?? default);

#endregion
}
38 changes: 15 additions & 23 deletions UVtools.Core/FileFormats/LGSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Emgu.CV.CvEnum;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
Expand Down Expand Up @@ -298,6 +297,7 @@ public override uint ResolutionX
{
HeaderSettings.ResolutionX = value;
base.ResolutionX = value;
HeaderSettings.PixelPerMmX = Xppmm;
}
}

Expand All @@ -308,19 +308,28 @@ public override uint ResolutionY
{
HeaderSettings.ResolutionY = value;
base.ResolutionY = value;
HeaderSettings.PixelPerMmY = Yppmm;
}
}

public override float DisplayWidth
{
get => ResolutionX / HeaderSettings.PixelPerMmX;
set { }
get => (float) Math.Round(ResolutionX / HeaderSettings.PixelPerMmX, 3);
set
{
base.DisplayWidth = value;
HeaderSettings.PixelPerMmX = Xppmm;
}
}

public override float DisplayHeight
{
get => ResolutionY / HeaderSettings.PixelPerMmY;
set { }
get => (float)Math.Round(ResolutionY / HeaderSettings.PixelPerMmY, 3);
set
{
base.DisplayHeight = value;
HeaderSettings.PixelPerMmY = Yppmm;
}
}

public override float MachineZ
Expand Down Expand Up @@ -439,23 +448,6 @@ public LGSFile()
#endregion

#region Methods

protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
switch (e.PropertyName)
{
case nameof(Xppmm):
HeaderSettings.PixelPerMmX = Xppmm;
RaisePropertyChanged(nameof(DisplayWidth));
break;
case nameof(Yppmm):
HeaderSettings.PixelPerMmY = Yppmm;
RaisePropertyChanged(nameof(DisplayHeight));
break;
}
}

protected override void EncodeInternally(OperationProgress progress)
{
if (FileEndsWith(".lgs")) // Longer Orange 10
Expand Down Expand Up @@ -542,7 +534,7 @@ protected override void DecodeInternally(OperationProgress progress)
{
throw new FileLoadException("Not a valid LGS file!", FileFullPath);
}

//if (HeaderSettings.PrinterModel is 10 or 30 or 120)
//{
// Fix inconsistencies found of different version of plugin and slicers
Expand Down
4 changes: 2 additions & 2 deletions UVtools.Core/FileFormats/PhotonWorkshopFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,13 @@ public override uint[] GetAvailableVersionsForExtension(string? extension)
case "pw0":
case "pwx":
return new uint[] {VERSION_1};
case "pwmx":
case "pwmo":
case "pwms":
case "pmsq":
case "dlp":
return new uint[] { VERSION_1, VERSION_515 };
case "pwma":
case "pwmx":
case "pm3":
case "pm3m":
return new uint[] { VERSION_515, VERSION_516 };
Expand Down Expand Up @@ -1523,7 +1523,7 @@ public override string MachineName
{
get
{
if (string.IsNullOrWhiteSpace(MachineSettings.MachineName)) return MachineSettings.MachineName;
if (!string.IsNullOrWhiteSpace(MachineSettings.MachineName)) return MachineSettings.MachineName;
return PrinterModel switch
{
AnyCubicMachine.PhotonS => "Photon S",
Expand Down
36 changes: 21 additions & 15 deletions UVtools.Core/Operations/OperationInfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ protected override bool ExecuteInternally(OperationProgress progress)
if (_infillType == InfillAlgorithm.Honeycomb)
{
mask = GetHoneycombMask(GetRoiSizeOrVolumeSize());
CvInvoke.Imshow("Honeycomb", mask);
CvInvoke.WaitKey();
}
else if (_infillType == InfillAlgorithm.Concentric)
{
Expand Down Expand Up @@ -484,32 +486,36 @@ public Mat GetHoneycombMask(Size targetSize)
{
var patternMask = EmguExtensions.InitMat(targetSize);

var halfInfillSpacing = _infillSpacing / 2;
var halfInfillSpacingD = _infillSpacing / 2.0;
var halfInfillSpacing = (int)Math.Round(halfInfillSpacingD);
var halfThickenss = _infillThickness / 2;
int width = (int)Math.Round(4 * (_infillSpacing / 2.0 / Math.Sqrt(3)));
int width = (int)Math.Round(4 * (halfInfillSpacing / Math.Sqrt(3)));
var infillColor = new MCvScalar(_infillBrightness);

for (int col = 0; col <= targetSize.Width / _infillSpacing; col++)
int cols = (int)Math.Ceiling((float)targetSize.Width / _infillSpacing) + 2;
int rows = (int)Math.Ceiling((float)targetSize.Height / _infillSpacing);

for (int col = 0; col <= cols; col++)
{
for (int row = 0; row <= targetSize.Height / _infillSpacing; row++)
for (int row = 0; row <= rows; row++)
{
// Move over for the column number.
int x = (int)Math.Round(col * (width * 0.75f));
int x = (int)Math.Round(halfThickenss + col * (width * 0.75f));

// Move down the required number of rows.
int y = row * _infillSpacing;
int y = halfThickenss + halfInfillSpacing + row * _infillSpacing;

// If the column is odd, move down half a hex more.
if (col % 2 == 1) y += halfInfillSpacing;

var points = new Point[]
{
new(x, y),
new((int) Math.Round(x + width * 0.25f), y - _infillSpacing / 2),
new((int) Math.Round(x + width * 0.75f), y - _infillSpacing / 2),
new((int) Math.Round(x + width * 0.25f), y - halfInfillSpacing),
new((int) Math.Round(x + width * 0.75f), y - halfInfillSpacing),
new(x + width, y),
new((int) Math.Round(x + width * 0.75f), y + _infillSpacing / 2),
new((int) Math.Round(x + width * 0.25f), y + _infillSpacing / 2),
new((int) Math.Round(x + width * 0.75f), y + halfInfillSpacing),
new((int) Math.Round(x + width * 0.25f), y + halfInfillSpacing),
};

CvInvoke.Polylines(patternMask, points, true, infillColor, _infillThickness);
Expand All @@ -525,7 +531,7 @@ public Mat GetConcentricMask(Size targetSize)

//var halfInfillSpacing = _infillSpacing / 2;
//var halfThickenss = _infillThickness / 2;
int multiplicator = 1;
int multiplier = 1;
byte position = 0;

int x = patternMask.Width / 2;
Expand All @@ -550,18 +556,18 @@ public Mat GetConcentricMask(Size targetSize)

while (hitLimits.Any(hitLimit => !hitLimit))
{
x += directions[position].X * multiplicator;
y += directions[position].Y * multiplicator;
x += directions[position].X * multiplier;
y += directions[position].Y * multiplier;
if (x < 0 || y < 0 || x >= patternMask.Width || y >= patternMask.Height) hitLimits[position] = true;
points.Add(new Point(x, y));
position++;
if (position == 2)
{
multiplicator++;
multiplier++;
}
else if (position == 4)
{
multiplicator++;
multiplier++;
position = 0;
}
}
Expand Down
8 changes: 6 additions & 2 deletions UVtools.Core/UVtools.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl>
<Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description>
<Version>3.11.0</Version>
<Version>3.11.1</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
Expand All @@ -27,24 +27,28 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>..\documentation\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>..\documentation\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>..\documentation\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>..\documentation\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -74,7 +78,7 @@
<ItemGroup>
<PackageReference Include="AnimatedGif" Version="1.0.5" />
<PackageReference Include="BinarySerializer" Version="8.6.3.2" />
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.0.0" />
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.1.0" />
<PackageReference Include="Emgu.CV" Version="4.6.0.5131" />
<PackageReference Include="Emgu.CV.runtime.ubuntu-x64" Version="4.6.0.5131" />
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.6.0.5131" />
Expand Down
Loading

0 comments on commit 86cd97b

Please sign in to comment.