Skip to content

Commit

Permalink
v3.14.4
Browse files Browse the repository at this point in the history
- (Add) File - Rename: Allow to rename the current file with a new name (Ctrl + F2)
- (Improvement) Tool - Edit print parameters: It now apply settings without close the window, allowing user to do continuous work. After all editing is done the user must manually close the window (#731)
- (Improvement) Resin traps and suction cups: Optimization of contour grouping will now make the detection faster if it contains a large number of contours
- (Change) Lower the default setting for binary threshold for resin traps, from 127 to 100
- (Fix) macOS: Unable to have settings on Monterey or above due the settings folder no longer exists on recent systems. (#728)
        Your current settings will not be automatically transferred to the new location, to do such please copy them over or use the following command before upgrade: `mv "$HOME/.local/share/UVtools" "$HOME/Library/Application Support"`
        If you already ran UVtools and would like to transfer old settings, use: `cp -Rf "$HOME/.local/share/UVtools/" "$HOME/Library/Application Support/UVtools/"`
- (Upgrade) .NET from 6.0.16 to 6.0.18
  • Loading branch information
sn4k3 committed Jun 21, 2023
1 parent 4e0e1e2 commit cd38da5
Show file tree
Hide file tree
Showing 28 changed files with 661 additions and 155 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 21/06/2023 - v3.14.4

- (Add) File - Rename: Allow to rename the current file with a new name (Ctrl + F2)
- (Improvement) Tool - Edit print parameters: It now apply settings without close the window, allowing user to do continuous work. After all editing is done the user must manually close the window (#731)
- (Improvement) Resin traps and suction cups: Optimization of contour grouping will now make the detection faster if it contains a large number of contours
- (Change) Lower the default setting for binary threshold for resin traps, from 127 to 100
- (Fix) macOS: Unable to have settings on Monterey or above due the settings folder no longer exists on recent systems. (#728)
Your current settings will not be automatically transferred to the new location, to do such please copy them over or use the following command before upgrade: `mv "$HOME/.local/share/UVtools" "$HOME/Library/Application Support"`
If you already ran UVtools and would like to transfer old settings, use: `cp -Rf "$HOME/.local/share/UVtools/" "$HOME/Library/Application Support/UVtools/"`
- (Upgrade) .NET from 6.0.16 to 6.0.18

## 11/06/2023 - v3.14.3

- **Settings:**
Expand Down
16 changes: 8 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- **Settings:**
- (Add) After save the file replace on it name with the updated print time and material if possible
- (Add) File 'Save as' default name with extended variables (#725)
- (Add) File 'Save as' name cleanup regex
- (Add) When save as a file and if the file name already exists on that directory it will append a number up to one available
- (Remove) File 'Save as' suffix and prefix
- (Add) About: Graphic card name
- (Fix) CTB Encrypted: Check the checksum as last step to be compatible with new Chitubox 1.4.5 CTB files (#696, #726)
- (Add) File - Rename: Allow to rename the current file with a new name (Ctrl + F2)
- (Improvement) Tool - Edit print parameters: It now apply settings without close the window, allowing user to do continuous work. After all editing is done the user must manually close the window (#731)
- (Improvement) Resin traps and suction cups: Optimization of contour grouping will now make the detection faster if it contain a large number of contours
- (Change) Lower the default setting for binary threshold for resin traps, from 127 to 100
- (Fix) macOS: Unable to have settings on Monterey or above due the settings folder no longer exists on recent systems. (#728)
Your current settings will not be automatically transferred to the new location, to do such please copy them over or use the following command before upgrade: `mv "$HOME/.local/share/UVtools" "$HOME/Library/Application Support"`
If you already ran UVtools and would like to transfer old settings, use: `cp -Rf "$HOME/.local/share/UVtools/" "$HOME/Library/Application Support/UVtools/"`
- (Upgrade) .NET from 6.0.16 to 6.0.18

1 change: 1 addition & 0 deletions Scripts/010 Editor/FileFormats.1pj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<file>ctb_decrypted.bt</file>
<file>ctb_encrypted.bt</file>
<file>cxdlp.bt</file>
<file>cxdlpv4.bt</file>
<file>cxdlp_v1.bt</file>
<file>fdg.bt</file>
<file>gr1.bt</file>
Expand Down
4 changes: 2 additions & 2 deletions Scripts/010 Editor/cxdlp.bt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ typedef struct(int size) {
} RgbPreviewImageRawData;

struct HEADER {
uint32 HeaderSize <fgcolor=cBlack, bgcolor=cWhite>;
char Header[HeaderSize] <fgcolor=cBlack, bgcolor=cRed>;
uint32 MagicSize <fgcolor=cBlack, bgcolor=cWhite>;
char Magic[MagicSize] <fgcolor=cBlack, bgcolor=cRed>;

uint16 Version <fgcolor=cBlack, bgcolor=cWhite>;

Expand Down
179 changes: 179 additions & 0 deletions Scripts/010 Editor/cxdlpv4.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
//------------------------------------------------
//--- 010 Editor v8.0.1 Binary Template
//
// File: cxdlpv4
// Authors: Tiago Conceição
//------------------------------------------------

LittleEndian();

struct HEADER {
BigEndian();
uint32 MagicSize <fgcolor=cBlack, bgcolor=cWhite>;
char Magic[MagicSize] <fgcolor=cBlack, bgcolor=cRed>;
ushort Version <fgcolor=cBlack, bgcolor=cRed>;

uint32 PrinterModelSize <fgcolor=cBlack, bgcolor=cWhite>;
char PrinterModel[PrinterModelSize] <fgcolor=cBlack, bgcolor=cRed>;
LittleEndian();

ushort ResolutionX <fgcolor=cBlack, bgcolor=cRed>;
ushort ResolutionY <fgcolor=cBlack, bgcolor=cRed>;

float BedSizeX <fgcolor=cBlack, bgcolor=cRed>;
float BedSizeY <fgcolor=cBlack, bgcolor=cRed>;
float BedSizeZ <fgcolor=cBlack, bgcolor=cRed>;

float TotalHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>;
float LayerHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>;
uint BottomLayersCount <fgcolor=cBlack, bgcolor=cRed>;

uint PreviewSmallOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint LayersDefinitionOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint LayerCount <fgcolor=cBlack, bgcolor=cRed>;
uint PreviewLargeOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint PrintTime <fgcolor=cBlack, bgcolor=cRed>;
uint ProjectorType <fgcolor=cBlack, bgcolor=cRed>;
uint PrintParametersOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint PrintParametersSize <fgcolor=cBlack, bgcolor=cRed>;
uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>;
ushort LightPWM <fgcolor=cBlack, bgcolor=cRed>;
ushort BottomLightPWM <fgcolor=cBlack, bgcolor=cRed>;
uint EncryptionKey <fgcolor=cBlack, bgcolor=cRed>;
uint SlicerOffset <fgcolor=cBlack, bgcolor=cRed>;
uint SlicerSize <fgcolor=cBlack, bgcolor=cRed>;
} header;

struct PREVIEW {
uint ResolutionX <fgcolor=cBlack, bgcolor=cRed>;
uint ResolutionY <fgcolor=cBlack, bgcolor=cRed>;
uint ImageOffset <fgcolor=cBlack, bgcolor=cRed>;
uint ImageLength <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown3 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown4 <fgcolor=cBlack, bgcolor=cRed>;

ubyte Data[ImageLength] <fgcolor=cBlack, bgcolor=cYellow>;
};

struct PRINT_PARAMETERS {
float BottomLiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float BottomLiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>;
float VolumeMl <fgcolor=cBlack, bgcolor=cRed>;
float WeightG <fgcolor=cBlack, bgcolor=cRed>;
float CostDollars <fgcolor=cBlack, bgcolor=cRed>;
float BottomLightOffDelay <fgcolor=cBlack, bgcolor=cRed>;
float LightOffDelay <fgcolor=cBlack, bgcolor=cRed>;

uint BottomLayerCount <fgcolor=cBlack, bgcolor=cRed>;
float ExposureTime <fgcolor=cBlack, bgcolor=cRed>;
float BottomExposureTime <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
};

struct SLICER_INFO {
float BottomLiftHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float BottomLiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>;

uint PerLayerSettings <fgcolor=cBlack, bgcolor=cRed, format=hex>; // 0 to not support, 1 to support
uint TimestampMinutes <fgcolor=cBlack, bgcolor=cRed>;
uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>;
uint SoftwareVersion <fgcolor=cBlack, bgcolor=cRed, format=hex>; // 0
float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeBeforeLift <fgcolor=cBlack, bgcolor=cRed>;
float BottomExposureTime <fgcolor=cBlack, bgcolor=cRed>;
float ExposureTime <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>;
uint TransitionLayerCount <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
uint Padding <fgcolor=cBlack, bgcolor=cRed>;
};

if(header.PreviewSmallOffsetAddress > 0)
{
FSeek(header.PreviewSmallOffsetAddress);
PREVIEW previewSmall <fgcolor=cBlack, bgcolor=cYellow>;
}

if(header.PreviewLargeOffsetAddress > 0)
{
FSeek(header.PreviewLargeOffsetAddress);
PREVIEW previewLarge <fgcolor=cBlack, bgcolor=cYellow>;
}

if(header.PrintParametersOffsetAddress > 0){
FSeek(header.PrintParametersOffsetAddress);
PRINT_PARAMETERS parameters <fgcolor=cBlack, bgcolor=cYellow>;
}

if(header.SlicerOffset > 0){
FSeek(header.SlicerOffset);
SLICER_INFO SlicerInfo <fgcolor=cBlack, bgcolor=cYellow>;
}

struct LAYER_DATA {
float LayerPositionZ <fgcolor=cBlack, bgcolor=cRed>;
float LayerExposure <fgcolor=cBlack, bgcolor=cRed>;
float LightOffSeconds <fgcolor=cBlack, bgcolor=cRed>;
uint DataAddress <fgcolor=cBlack, bgcolor=cRed>;
uint DataSize <fgcolor=cBlack, bgcolor=cRed>;
uint DataType <fgcolor=cBlack, bgcolor=cRed>;
uint CentroidDistance <fgcolor=cBlack, bgcolor=cRed>;
uint TotalArea <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown <fgcolor=cBlack, bgcolor=cRed>;
};

struct LAYER_DATAEX {
float LiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>;
float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeBeforeLift <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>;
float LightPWM <fgcolor=cBlack, bgcolor=cRed>;
};


typedef struct(int size) {
ubyte layerDataBlock[size] <fgcolor=cBlack, bgcolor=cGreen>;
} LAYER_RLE;

FSeek(header.LayersDefinitionOffsetAddress);
struct LAYERS {
local uint i;
for( i = 0; i < header.LayerCount; i++ ){
LAYER_DATA layerData <fgcolor=cBlack, bgcolor=cYellow>;
}
} layers;

struct LAYERSEX {
local uint i;

for( i = 0; i < header.LayerCount; i++ ){
LAYER_DATAEX layerDataEx;
LAYER_RLE lD(layers.layerData[i].DataSize - 44);
}

} layersEx;


BigEndian();
uint CheckSum <fgcolor=cBlack, bgcolor=cWhite>;
LittleEndian();
5 changes: 5 additions & 0 deletions UVtools.Core/CoreSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public static string DefaultSettingsFolder
{
get
{
if (OperatingSystem.IsMacOS())
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", About.Software);
}

var folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
if (string.IsNullOrWhiteSpace(folder)) folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (string.IsNullOrWhiteSpace(folder)) folder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
Expand Down
42 changes: 40 additions & 2 deletions UVtools.Core/EmguCV/EmguContours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,24 @@ public static List<VectorOfVectorOfPoint>[] GetContoursInGroups(VectorOfVectorOf
/// <returns></returns>
public static List<VectorOfVectorOfPoint> GetPositiveContoursInGroups(VectorOfVectorOfPoint contours, int[,] hierarchy)
{
var vectorSize = contours.Size;
var result = new List<VectorOfVectorOfPoint>();
VectorOfVectorOfPoint? vec = null;
for (int i = 0; i < vectorSize; i++)
{
if (hierarchy[i, EmguContour.HierarchyParent] == -1)
{
vec = new VectorOfVectorOfPoint(contours[i]);
result.Add(vec);
}
else
{
vec.Push(contours[i]);
}
}

return result;
/* Old
var result = new List<VectorOfVectorOfPoint>();
var vectorSize = contours.Size;
var processedContours = new bool[vectorSize];
Expand All @@ -275,7 +293,7 @@ public static List<VectorOfVectorOfPoint> GetPositiveContoursInGroups(VectorOfVe
}
}
return result;
return result;*/
}

/// <summary>
Expand All @@ -287,6 +305,26 @@ public static List<VectorOfVectorOfPoint> GetNegativeContoursInGroups(VectorOfVe
{
var result = new List<VectorOfVectorOfPoint>();
var vectorSize = contours.Size;
for (int i = 1; i < vectorSize; i++)
{
if (hierarchy[i, EmguContour.HierarchyParent] == -1) continue;
var vec = new VectorOfVectorOfPoint(contours[i]);
result.Add(vec);

var contourId = i;
for (i += 1; i < vectorSize && hierarchy[i, EmguContour.HierarchyParent] >= contourId; i++)
{
vec.Push(contours[i]);
}

i--;
}

return result;

// Old code
/*var result = new List<VectorOfVectorOfPoint>();
var vectorSize = contours.Size;
var processedContours = new bool[vectorSize];
for (int i = 0; i < vectorSize; i++)
{
Expand All @@ -303,7 +341,7 @@ public static List<VectorOfVectorOfPoint> GetNegativeContoursInGroups(VectorOfVe
}
}
return result;
return result;*/
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions UVtools.Core/Layers/LayerIssueConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public sealed class IslandDetectionConfiguration : DetectionConfiguration
public bool AllowDiagonalBonds { get; set; } = false;

/// <summary>
/// Gets or sets the binary threshold, all pixels below this value will turn in black, otherwise white
/// Gets or sets the binary threshold, all pixels equal or below this value will turn in black, otherwise white
/// Set to 0 to disable this operation
/// </summary>
public byte BinaryThreshold { get; set; } = 1;
Expand Down Expand Up @@ -218,10 +218,10 @@ public sealed class ResinTrapDetectionConfiguration : DetectionConfiguration
public uint StartLayerIndex { get; set; }

/// <summary>
/// Gets or sets the binary threshold, all pixels below this value will turn in black, otherwise white
/// Gets or sets the binary threshold, all pixels equal or below this value will turn in black, otherwise white
/// Set to 0 to disable this operation
/// </summary>
public byte BinaryThreshold { get; set; } = 127;
public byte BinaryThreshold { get; set; } = 100;

/// <summary>
/// Gets the required area size (x*y) to consider process a hollow area (0-255)
Expand Down
14 changes: 9 additions & 5 deletions UVtools.Core/Managers/IssueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ void GenerateAirMap(IInputArray input, IInputOutputArray output, VectorOfVectorO
Parallel.For(0, SlicerFile.LayerCount, CoreSettings.ParallelOptions, layerIndexInt =>
{
progress.PauseIfRequested();
if (progress.Token.IsCancellationRequested) return;
if (progress.Token.IsCancellationRequested)
{
return;
}
uint layerIndex = (uint)layerIndexInt;
var layer = SlicerFile[layerIndex];
Expand All @@ -255,7 +258,6 @@ void GenerateAirMap(IInputArray input, IInputOutputArray output, VectorOfVectorO
)
{
progress.LockAndIncrement();
return;
}
Expand Down Expand Up @@ -606,9 +608,9 @@ void GenerateAirMap(IInputArray input, IInputOutputArray output, VectorOfVectorO
}
var contourLayer = resinTrapImage.Roi(SlicerFile.BoundingRectangle);
using var contours = contourLayer.FindContours(out var heirarchy, RetrType.Tree);
externalContours[layerIndex] = EmguContours.GetExternalContours(contours, heirarchy);
hollows[layerIndex] = EmguContours.GetNegativeContoursInGroups(contours, heirarchy);
using var contours = contourLayer.FindContours(out var hierarchy, RetrType.Tree);
externalContours[layerIndex] = EmguContours.GetExternalContours(contours, hierarchy);
hollows[layerIndex] = EmguContours.GetNegativeContoursInGroups(contours, hierarchy);
resinTrapsContoursArea[layerIndex] = EmguContours.GetContoursArea(hollows[layerIndex]);
if (needDispose)
Expand Down Expand Up @@ -647,6 +649,8 @@ void GenerateAirMap(IInputArray input, IInputOutputArray output, VectorOfVectorO
}); // Parallel end
}

if (progress.Token.IsCancellationRequested) return GetResult();

if (resinTrapConfig.Enabled)
{
//progress.Reset("Detecting Air Boundaries (Resin traps)", LayerCount);
Expand Down
4 changes: 2 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.14.3</Version>
<Version>3.14.4</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
Expand Down Expand Up @@ -91,7 +91,7 @@
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
</ItemGroup>

<Target Name="PreparePackageReleaseNotesFromFile" BeforeTargets="GenerateNuspec">
Expand Down
Loading

0 comments on commit cd38da5

Please sign in to comment.