Skip to content

Commit

Permalink
v0.8.5.0
Browse files Browse the repository at this point in the history
* (Add) Tool - Calculator: Convert millimeters to pixels
* (Add) Tool - Calculator: Find the optimal "Ligth-Off Delay"
* (Add) Internal abstraction of display size to all file formats
* (Add) Default demo file that loads on startup when no file is specified (this can be disable/enabled on settings)
  • Loading branch information
sn4k3 committed Oct 14, 2020
1 parent 4230f87 commit 89f5df3
Show file tree
Hide file tree
Showing 41 changed files with 1,957 additions and 49 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# Inventor
CAD/OldVersions/
.lockfile

# User-specific files
*.rsuser
*.suo
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
* (Improvement) GUI is now scalable
* (Fix) Some bug found and fixed during convertion

## 14/10/2020 - v0.8.5.0

* (Add) Tool - Calculator: Convert millimeters to pixels
* (Add) Tool - Calculator: Find the optimal "Ligth-Off Delay"
* (Add) Internal abstraction of display size to all file formats
* (Add) Default demo file that loads on startup when no file is specified (this can be disable/enabled on settings)

## 13/10/2020 - v0.8.4.3

* (Add) Tool - Layer repair: Allow remove islands recursively (#74)
Expand Down
Binary file not shown.
Binary file added UVtools.CAD/UVtools_demo_file.3mf
Binary file not shown.
Binary file added UVtools.CAD/UVtools_demo_file.ipt
Binary file not shown.
Binary file added UVtools.CAD/UVtools_demo_file.sl1
Binary file not shown.
Binary file added UVtools.CAD/UVtools_demo_file.stl
Binary file not shown.
2 changes: 2 additions & 0 deletions UVtools.Core/About.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public static class About
public static string Company = "PTRTECH";
public static string Website = "https://github.com/sn4k3/UVtools";
public static string Donate = "https://paypal.me/SkillTournament";

public static string DemoFile = "UVtools_demo_file.sl1";
}
}
13 changes: 12 additions & 1 deletion UVtools.Core/FileFormats/CWSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ public override uint ResolutionY
set => OutputSettings.YResolution = SliceSettings.Yres = (ushort) value;
}

public override float DisplayWidth
{
get => OutputSettings.PlatformXSize;
set => OutputSettings.PlatformXSize = value;
}
public override float DisplayHeight
{
get => OutputSettings.PlatformYSize;
set => OutputSettings.PlatformYSize = value;
}

public override byte AntiAliasing => (byte) OutputSettings.AntiAliasingValue;

public override float LayerHeight
Expand Down Expand Up @@ -579,7 +590,7 @@ public override void RebuildGCode()
}
}
// delay = max(extra['wait'], 500) + int(((int(lift)/(extra['lift_feed']/60)) + (int(lift)/(extra['lift_retract']/60)))*1000)
uint extraDelay = (uint)(((LiftHeight / (LiftSpeed / 60f)) + (LiftHeight / (RetractSpeed / 60f))) * 1000);
uint extraDelay = (uint)(OperationCalculator.LightOffDelayC.Calculate(LiftHeight, LiftHeight, RetractSpeed) * 1000);
if (layerIndex < BottomLayerCount)
{
extraDelay = (uint)Math.Max(extraDelay + 10000, layer.ExposureTime * 1000);
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/ChituboxFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,17 @@ public override uint ResolutionY
set => HeaderSettings.ResolutionY = value;
}

public override float DisplayWidth
{
get => HeaderSettings.BedSizeX;
set => HeaderSettings.BedSizeX = value;
}
public override float DisplayHeight
{
get => HeaderSettings.BedSizeY;
set => HeaderSettings.BedSizeY = value;
}

public override byte AntiAliasing => (byte) (IsCbtFile ? SlicerInfoSettings.AntiAliasLevel : HeaderSettings.AntiAliasLevel);

public override float LayerHeight
Expand Down
12 changes: 12 additions & 0 deletions UVtools.Core/FileFormats/ChituboxZipFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -138,6 +139,17 @@ public override uint ResolutionY
set => HeaderSettings.ResolutionY = value;
}

public override float DisplayWidth
{
get => HeaderSettings.MachineX;
set => HeaderSettings.MachineX = value;
}
public override float DisplayHeight
{
get => HeaderSettings.MachineY;
set => HeaderSettings.MachineX = value;
}

public override byte AntiAliasing => HeaderSettings.AntiAliasing;

public override float LayerHeight
Expand Down
26 changes: 24 additions & 2 deletions UVtools.Core/FileFormats/FileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Emgu.CV;
Expand Down Expand Up @@ -349,11 +350,32 @@ public bool RequireFullEncode
set => _haveModifiedLayers = value;
} // => LayerManager.IsModified;

public Size Resolution => new Size((int) ResolutionX, (int) ResolutionY);

public Size Resolution
{
get => new Size((int)ResolutionX, (int)ResolutionY);
set
{
ResolutionX = (uint) value.Width;
ResolutionY = (uint) value.Height;
}
}

public abstract uint ResolutionX { get; set; }

public abstract uint ResolutionY { get; set; }

public SizeF Display
{
get => new SizeF(DisplayWidth, DisplayHeight);
set
{
DisplayWidth = value.Width;
DisplayHeight = value.Height;
}
}

public abstract float DisplayWidth { get; set; }
public abstract float DisplayHeight { get; set; }
public bool HaveAntiAliasing => AntiAliasing > 1;
public abstract byte AntiAliasing { get; }

Expand Down
15 changes: 15 additions & 0 deletions UVtools.Core/FileFormats/IFileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ public interface IFileFormat
/// </summary>
uint ResolutionY { get; set; }

/// <summary>
/// Gets the size of display in millimeters
/// </summary>
SizeF Display { get; set; }

/// <summary>
/// Gets or sets the display width in millimeters
/// </summary>
float DisplayWidth { get; set; }

/// <summary>
/// Gets or sets the display height in millimeters
/// </summary>
float DisplayHeight { get; set; }

bool HaveAntiAliasing { get; }

/// <summary>
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/ImageFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ public override uint ResolutionY
set => throw new NotImplementedException();
}

public override float DisplayWidth
{
get => ResolutionX;
set => ResolutionX = (uint) value;
}
public override float DisplayHeight
{
get => ResolutionY;
set => ResolutionY = (uint)value;
}

public override byte AntiAliasing { get; } = 1;
public override float LayerHeight { get; set; } = 0;
public override float PrintTime { get; } = 0;
Expand Down
16 changes: 14 additions & 2 deletions UVtools.Core/FileFormats/LGSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class Header
[FieldOrder(3)] public uint Uint_10 { get; set; } = 30; // 0x10: 30 ?
[FieldOrder(4)] public uint Uint_14 { get; set; } = 0; // 0x14: 0 ?
[FieldOrder(5)] public uint Uint_18 { get; set; } = 34; // 0x18: 34 ?
[FieldOrder(6)] public float PixelPerMmY { get; set; }
[FieldOrder(7)] public float PixelPerMmX { get; set; }
[FieldOrder(6)] public float PixelPerMmX { get; set; }
[FieldOrder(7)] public float PixelPerMmY { get; set; }
[FieldOrder(8)] public float ResolutionX { get; set; }
[FieldOrder(9)] public float ResolutionY { get; set; }
[FieldOrder(10)] public float LayerHeight { get; set; }
Expand Down Expand Up @@ -246,6 +246,18 @@ public override uint ResolutionY
set => HeaderSettings.ResolutionY = value;
}

public override float DisplayWidth
{
get => ResolutionX / HeaderSettings.PixelPerMmX;
set { }
}

public override float DisplayHeight
{
get => ResolutionY / HeaderSettings.PixelPerMmY;
set { }
}

public override byte AntiAliasing => 4;

public override float LayerHeight
Expand Down
3 changes: 3 additions & 0 deletions UVtools.Core/FileFormats/MakerbaseFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public override uint ResolutionY
set => temp = 0;
}

public override float DisplayWidth { get; set; }
public override float DisplayHeight { get; set; }

public override byte AntiAliasing => 1;

public override float LayerHeight
Expand Down
13 changes: 13 additions & 0 deletions UVtools.Core/FileFormats/PHZFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,19 @@ public override uint ResolutionY
set => HeaderSettings.ResolutionY = value;
}

public override float DisplayWidth
{
get => HeaderSettings.BedSizeX;
set => HeaderSettings.BedSizeX = value;
}


public override float DisplayHeight
{
get => HeaderSettings.BedSizeY;
set => HeaderSettings.BedSizeY = value;
}

public override byte AntiAliasing => (byte) HeaderSettings.AntiAliasLevelInfo;

public override float LayerHeight
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/PWSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,17 @@ public override uint ResolutionY
set => HeaderSettings.ResolutionY = value;
}

public override float DisplayWidth
{
get => 0;
set { }
}
public override float DisplayHeight
{
get => 0;
set { }
}

public override byte AntiAliasing => (byte) HeaderSettings.AntiAliasing;

public override float LayerHeight
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/SL1File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,17 @@ public override uint ResolutionY
set => PrinterSettings.DisplayPixelsY = value;
}

public override float DisplayWidth
{
get => PrinterSettings.DisplayWidth;
set => PrinterSettings.DisplayWidth = value;
}
public override float DisplayHeight
{
get => PrinterSettings.DisplayHeight;
set => PrinterSettings.DisplayHeight = value;
}

public override byte AntiAliasing => (byte) (PrinterSettings.GammaCorrection > 0 ? LookupCustomValue(Keyword_AntiAliasing, 4) : 1);

public override float LayerHeight
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/UVJFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ public override uint ResolutionY
set => JsonSettings.Properties.Size.Y = (ushort) value;
}

public override float DisplayWidth
{
get => JsonSettings.Properties.Size.Millimeter.X;
set => JsonSettings.Properties.Size.Millimeter.X = value;
}
public override float DisplayHeight
{
get => JsonSettings.Properties.Size.Millimeter.Y;
set => JsonSettings.Properties.Size.Millimeter.Y = value;
}

public override byte AntiAliasing => JsonSettings.Properties.AntiAliasLevel;

public override float LayerHeight
Expand Down
11 changes: 11 additions & 0 deletions UVtools.Core/FileFormats/ZCodexFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ public override uint ResolutionY
set => throw new NotImplementedException();
}

public override float DisplayWidth
{
get => 74.67f;
set {}
}
public override float DisplayHeight
{
get => 132.88f;
set { }
}

public override byte AntiAliasing => UserSettings.AntiAliasing;

public override float LayerHeight
Expand Down
Loading

0 comments on commit 89f5df3

Please sign in to comment.