diff --git a/PrusaSlicer/printer/Anet N4.ini b/PrusaSlicer/printer/Anet N4.ini index c657ea3..7f1ae23 100644 --- a/PrusaSlicer/printer/Anet N4.ini +++ b/PrusaSlicer/printer/Anet N4.ini @@ -39,4 +39,4 @@ relative_correction_x = 1 relative_correction_y = 1 relative_correction_z = 1 slow_tilt_time = 8 -thumbnails = 400x400,800x480 +thumbnails = 260x140 diff --git a/Scripts/010 Editor/FileFormats.1pj b/Scripts/010 Editor/FileFormats.1pj index a482fe8..4dbf2bf 100644 --- a/Scripts/010 Editor/FileFormats.1pj +++ b/Scripts/010 Editor/FileFormats.1pj @@ -3,6 +3,7 @@ false true true + anet.bt ctb.bt ctb_decrypted.bt ctb_encrypted.bt @@ -12,7 +13,6 @@ gr1.bt lgs.bt mdlp.bt - n4.bt osf.bt osla.bt photons.bt diff --git a/Scripts/010 Editor/anet.bt b/Scripts/010 Editor/anet.bt new file mode 100644 index 0000000..d9da2dd --- /dev/null +++ b/Scripts/010 Editor/anet.bt @@ -0,0 +1,57 @@ +//------------------------------------------------ +//--- 010 Editor v8.0.1 Binary Template +// +// File: Anet N4, N7 +// Authors: Tiago Conceição +//------------------------------------------------ + +BigEndian(); + +typedef struct() { + uint WhitePixelsCount ; // White pixels region (border including corner pixels) + uint XMin ; // Bounding rectangle X + uint YMin ; // Bounding rectangle Y + uint XMax ; // Bounding rectangle Right + uint YMax ; // Bounding rectangle Bottom + uint BitsCount ; + ubyte LayerRLE[(BitsCount + 7) >> 3] ; +} layerData; + +struct HEADER { + uint VersionLen ; // 2 + wchar_t Version[VersionLen/2] ; // 3 + int NameLength ; + wchar_t FileName[NameLength/2] ; // File name without extension + int DescriptionLength ; + wchar_t Description[DescriptionLength/2] ; // File name without extension + + double XYPixelSize ; // mm + double LayerHeight ; // mm; from 0.03 to 0.08 + + uint BaseLayersCount ; // Number of extent filled additional first layers; do not use! + uint FilledBaseLayersCount ; // Number of fully filled first layers inside BaseLayersCount; do not use! + + uint ExposureTime ; // from 3 to 25 + uint BottomExposureTime ; // from 60 to 120 + uint BottomLayerCount ; // from 2 to 10 + uint LiftSpeed ; // mm/s, from 1 to 10 + uint LiftHeight ; // mm, from 3 to 10 + + uint PreviewResolutionX ; // 260 + uint PreviewResolutionY ; // 140 + uint PreviewSize ; // 72866 + ubyte PreviewContent[PreviewSize] ; // BMP image, BGR565 + double VolumeMicroL ; // µl + uint EncodedPrintTime ; // s; for unknown reason always broken in original slicer + uint LayerCount ; +} header; + + +struct LAYERS { + local int i; + for( i = 0; i < header.LayerCount; i++ ){ + layerData lD(); + } +} layers; + +uint SupportsCount ; // Supports count, always 0 \ No newline at end of file diff --git a/Scripts/010 Editor/n4.bt b/Scripts/010 Editor/n4.bt deleted file mode 100644 index 6268843..0000000 --- a/Scripts/010 Editor/n4.bt +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------------------ -//--- 010 Editor v8.0.1 Binary Template -// -// File: Anet N4 -// Authors: Tiago Conceição -//------------------------------------------------ - -BigEndian(); - -typedef struct() { - uint32 WhitePixelsCount ; // White pixels region (border including corner pixels) - uint32 XMin ; // Bounding rectangle X - uint32 YMin ; // Bounding rectangle Y - uint32 XMax ; // Bounding rectangle Right - uint32 YMax ; // Bounding rectangle Bottom - uint32 BitsCount ; - ubyte LayerRLE[(BitsCount + 7) >> 3] ; -} layerData; - -struct HEADER { - uint32 VersionLen ; // 2 - wchar_t Version[VersionLen/2] ; // 3 - uint32 NameLength ; - wchar_t FileName[NameLength/2] ; // File name without extension - uint32 DescriptionLength ; - wchar_t Description[DescriptionLength/2] ; // File name without extension - - double XYPixelSize ; // mm - double LayerHeight ; // mm; from 0.03 to 0.08 - - uint32 BaseLayersCount ; // Number of extent filled additional first layers; do not use! - uint32 FilledBaseLayersCount ; // Number of fully filled first layers inside BaseLayersCount; do not use! - - uint ExposureTime ; // from 3 to 25 - uint BottomExposureTime ; // from 60 to 120 - uint32 BottomLayerCount ; // from 2 to 10 - uint32 LiftSpeed ; // mm/s, from 1 to 10 - uint32 LiftHeight ; // mm, from 3 to 10 - - uint32 PreviewResolutionX ; // 260 - uint32 PreviewResolutionY ; // 140 - uint32 PreviewSize ; // 72866 - ubyte PreviewContent[PreviewSize] ; // BMP image, BGR565 - double VolumeMicroL ; // µl - uint32 EncodedPrintTime ; // s; for unknown reason always broken in original slicer - uint32 LayerCount ; -} header; - - -struct LAYERS { - local int i; - for( i = 0; i < header.LayerCount; i++ ){ - layerData lD(); - } -} layers; - -uint32 SupportsCount ; // Supports count, always 0 \ No newline at end of file diff --git a/UVtools.Core/FileFormats/AnetN4File.cs b/UVtools.Core/FileFormats/AnetN4File.cs index 537429f..9d3e8cc 100644 --- a/UVtools.Core/FileFormats/AnetN4File.cs +++ b/UVtools.Core/FileFormats/AnetN4File.cs @@ -60,12 +60,12 @@ public sealed class AnetN4File : FileFormat public class Header { - [FieldOrder(0)][FieldEndianness(Endianness.Big)] public uint VersionLength { get; set; } = 2; + [FieldOrder(0)][FieldEndianness(Endianness.Big)] public int VersionLength { get; set; } = 2; [FieldOrder(1)][FieldEncoding("UTF-16BE")][FieldLength(nameof(VersionLength))] public string Version { get; set; } = "3"; - [FieldOrder(2)][FieldEndianness(Endianness.Big)] public uint NameLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2; + [FieldOrder(2)][FieldEndianness(Endianness.Big)] public int NameLength { get; set; } = About.SoftwareWithVersion.Length * 2; [FieldOrder(3)][FieldEncoding("UTF-16BE")][FieldLength(nameof(NameLength))] public string Name { get; set; } = About.SoftwareWithVersion; - [FieldOrder(4)][FieldEndianness(Endianness.Big)] public uint DescriptionLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2; - [FieldOrder(5)][FieldEncoding("UTF-16BE")][FieldLength(nameof(DescriptionLength))] public string Description { get; set; } = About.SoftwareWithVersion; + [FieldOrder(4)][FieldEndianness(Endianness.Big)] public int DescriptionLength { get; set; } + [FieldOrder(5)][FieldEncoding("UTF-16BE")][FieldLength(nameof(DescriptionLength))] public string Description { get; set; } = string.Empty; // Printer crashes for non-empty description (FW 1.65) [FieldOrder(6)][FieldEndianness(Endianness.Big)] public double XYPixelSize { get; set; } = 0.04725; // mm [FieldOrder(7)][FieldEndianness(Endianness.Big)] public double LayerHeight { get; set; } // mm; from 0.03 to 0.08 [FieldOrder(8)][FieldEndianness(Endianness.Big)] public uint BaseLayersCount { get; set; } // Number of extent filled additional first layers; do not use! @@ -102,8 +102,8 @@ public sealed class AnetN4File : FileFormat [FieldOrder(0)][FieldEndianness(Endianness.Big)] public uint WhitePixelsCount { get; set; } [FieldOrder(1)][FieldEndianness(Endianness.Big)] public int XMin { get; set; } [FieldOrder(2)][FieldEndianness(Endianness.Big)] public int YMin { get; set; } - [FieldOrder(3)][FieldEndianness(Endianness.Big)] public int XMax { get; set; } = RESOLUTION_X - 1; - [FieldOrder(4)][FieldEndianness(Endianness.Big)] public int YMax { get; set; } = RESOLUTION_Y - 1; + [FieldOrder(3)][FieldEndianness(Endianness.Big)] public int XMax { get; set; } + [FieldOrder(4)][FieldEndianness(Endianness.Big)] public int YMax { get; set; } [FieldOrder(5)][FieldEndianness(Endianness.Big)] public uint BitsCount { get; set; } [Ignore] public uint RleBytesCount @@ -123,8 +123,8 @@ public sealed class AnetN4File : FileFormat WhitePixelsCount = layer.NonZeroPixelCount; // To be re-set latter while encoding XMin = layer.BoundingRectangle.X; YMin = layer.BoundingRectangle.Y; - XMax = layer.BoundingRectangle.Right; - YMax = layer.BoundingRectangle.Bottom; + if (layer.BoundingRectangle.Right > 0) XMax = layer.BoundingRectangle.Right - 1; + if (layer.BoundingRectangle.Bottom > 0) YMax = layer.BoundingRectangle.Bottom - 1; } public override string ToString() @@ -429,7 +429,7 @@ public sealed class AnetN4File : FileFormat using var outputFile = new FileStream(TemporaryOutputFileFullPath, FileMode.Create, FileAccess.Write); HeaderSettings.Name = FilenameNoExt!; - HeaderSettings.Description = $"{About.SoftwareWithVersion} @ {DateTime.Now}"; + HeaderSettings.Description = string.Empty; // $"{About.SoftwareWithVersion} @ {DateTime.Now}"; var previewBuffer = new byte[72866]; // 72866 BmpHeader.CopyTo(previewBuffer, 0);