Skip to content

Commit

Permalink
v5.0.5
Browse files Browse the repository at this point in the history
- (Add) PrusaSlicer printer: Elegoo Saturn 4 Ultra 16K
- (Improvement) Goo: Implement and support the tilting vat printers
- (Improvement) All shapes in pixel editor will now respect the non-equal pixel pitch and compensate the lower side to print a regular shape, this also affects the polygons on PCB exposure tool and other tools as well
- (Fix) PCB Exposure: Use raw polygons instead of angle aligned polygons to respect the gerber implementation (#976)
  • Loading branch information
sn4k3 committed Jan 9, 2025
1 parent d1c88b9 commit 702d5b1
Show file tree
Hide file tree
Showing 27 changed files with 621 additions and 196 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Changelog

## 09/01/2025 - v5.0.5

- (Add) PrusaSlicer printer: Elegoo Saturn 4 Ultra 16K
- (Improvement) Goo: Implement and support the tilting vat printers
- (Improvement) All shapes in pixel editor will now respect the non-equal pixel pitch and compensate the lower side to print a regular shape, this also affects the polygons on PCB exposure tool and other tools as well
- (Fix) PCB Exposure: Use raw polygons instead of angle aligned polygons to respect the gerber implementation (#976)

## 08/01/2025 - v5.0.4

- PCB Exposure:
- (Fix) Polygon primitive vertex count not parsing correctly when having argument (#976)
- (Fix) Unable to parse primitive multiplications (#976)
- (Fix) Polygon primitive vertex count parsing to the incorrect variable (#976)
- (Fix) Obround aperture to follow the correct implementation (two semicircles connected by parallel lines tangent to their endpoints) (#976)
- (Fix) Implement the "hole diameter" argument in all apertures (#976)
- (Fix) Implement the "rotation" argument for the polygon aperture
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>

<!-- Versions -->
<UVtoolsVersion>5.0.4</UVtoolsVersion>
<UVtoolsVersion>5.0.5</UVtoolsVersion>
<AvaloniaVersion>11.2.3</AvaloniaVersion>

<!-- MvvmToolkit -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# generated by PrusaSlicer 2.8.0+win64 on 2024-07-24 at 21:26:44 UTC
# generated by PrusaSlicer 2.9.0 on 2025-01-08 at 03:32:14 UTC
absolute_correction = 0
bed_custom_model =
bed_custom_texture =
Expand Down Expand Up @@ -26,7 +26,7 @@ min_exposure_time = 1
min_initial_exposure_time = 1
print_host =
printer_model = SL1
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_SL1\nPRINTER_VENDOR_ELEGOO\nPRINTER_MODEL_SATURN4_ULTRA\nFILEFORMAT_ENCRYPTED.CTB\n\nSTART_CUSTOM_VALUES\nBottomLiftHeight_0.05\nLiftHeight_0.05\nBottomLiftSpeed_0.05\nLiftSpeed_0.05\nRetractSpeed_0.05\nBottomLightPWM_255\nLightPWM_255\nEND_CUSTOM_VALUES
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_SL1\nPRINTER_VENDOR_ELEGOO\nPRINTER_MODEL_SATURN4_ULTRA_12K\nFILEFORMAT_ENCRYPTED.CTB\n\nSTART_CUSTOM_VALUES\nBottomLiftHeight_0.05\nLiftHeight_0.05\nBottomLiftSpeed_0.05\nLiftSpeed_0.05\nRetractSpeed_0.05\nBottomLightPWM_255\nLightPWM_255\nEND_CUSTOM_VALUES
printer_settings_id =
printer_technology = SLA
printer_variant = default
Expand Down
43 changes: 43 additions & 0 deletions PrusaSlicer/printer/Elegoo Saturn 4 Ultra 16K.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# generated by PrusaSlicer 2.9.0 on 2025-01-08 at 03:33:33 UTC
absolute_correction = 0
bed_custom_model =
bed_custom_texture =
bed_shape = 0x0,211.68x0,211.68x118.37,0x118.37
default_sla_material_profile = Prusa Orange Tough 0.05
default_sla_print_profile = 0.05 Normal
display_height = 118.37
display_mirror_x = 1
display_mirror_y = 0
display_orientation = landscape
display_pixels_x = 15120
display_pixels_y = 6230
display_width = 211.68
elefant_foot_compensation = 0.2
elefant_foot_min_width = 0.2
fast_tilt_time = 5
gamma_correction = 1
high_viscosity_tilt_time = 10
host_type = octoprint
inherits = Original Prusa SL1
max_exposure_time = 120
max_initial_exposure_time = 300
max_print_height = 220
min_exposure_time = 1
min_initial_exposure_time = 1
print_host =
printer_model = SL1
printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_SL1\nPRINTER_VENDOR_ELEGOO\nPRINTER_MODEL_SATURN4_ULTRA_16K\nFILEFORMAT_ENCRYPTED.CTB\n\nSTART_CUSTOM_VALUES\nBottomLiftHeight_0.05\nLiftHeight_0.05\nBottomLiftSpeed_0.05\nLiftSpeed_0.05\nRetractSpeed_0.05\nBottomLightPWM_255\nLightPWM_255\nEND_CUSTOM_VALUES
printer_settings_id =
printer_technology = SLA
printer_variant = default
printer_vendor =
printhost_apikey =
printhost_cafile =
relative_correction = 1,1
relative_correction_x = 1
relative_correction_y = 1
relative_correction_z = 1
sla_archive_format = SL1
sla_output_precision = 0.001
slow_tilt_time = 8
thumbnails = 290x290/PNG, 116x116/PNG
9 changes: 4 additions & 5 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- PCB Exposure:
- (Fix) Polygon primitive vertex count not parsing correctly when having argument (#976)
- (Fix) Obround aperture to follow the correct implementation (two semicircles connected by parallel lines tangent to their endpoints) (#976)
- (Fix) Implement the "hole diameter" argument in all apertures (#976)
- (Fix) Implement the "rotation" argument for the polygon aperture
- (Add) PrusaSlicer printer: Elegoo Saturn 4 Ultra 16K
- (Improvement) Goo: Implement and support the tilting vat printers
- (Improvement) All shapes in pixel editor will now respect the non-equal pixel pitch and compensate the lower side to print a regular shape, this also affects the polygons on PCB exposure tool and other tools as well
- (Fix) PCB Exposure: Use raw polygons instead of angle aligned polygons to respect the gerber implementation (#976)

5 changes: 2 additions & 3 deletions Scripts/UVtools.ScriptSample/ScriptPreventResinShrinkage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ private Mat GenerateDotPattern() {
var evenRow = false;
for (int y = 0; y < pattern.Size.Height; y += yStep) {
for (int x = 0; x < pattern.Size.Width; x += xStep) {
CvInvoke.Circle(pattern,
new Point(x + (evenRow ? xStep / 2 : 0), y),
GrainSize.Value / 2,
pattern.DrawCircle(new Point(x + (evenRow ? xStep / 2 : 0), y),
SlicerFile.PixelsToNormalizedPitch(GrainSize.Value / 2),
EmguExtensions.WhiteColor,
-1, LineType.FourConnected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ public bool ScriptExecute()
// Do the left eye
var x = xCenter - noseThickness/2 - faceSpacing - eyeDiameter/2;
int y = faceSpacing;
CvInvoke.Circle(mats[0], new Point(x, y), eyeDiameter/2, EmguExtensions.WhiteColor, -1, lineType);
CvInvoke.Circle(mats[1], new Point(x, y), eyeDiameter/2, EmguExtensions.WhiteColor, -1, lineType);
var radius = SlicerFile.PixelsToNormalizedPitch(eyeDiameter / 2);
mats[0].DrawCircle(new Point(x, y), radius, EmguExtensions.WhiteColor, -1, lineType);
mats[1].DrawCircle(new Point(x, y), radius, EmguExtensions.WhiteColor, -1, lineType);
Progress++;

// Do the right eye, the mirror of left...
x = (int)(SlicerFile.ResolutionX - x);
CvInvoke.Circle(mats[0], new Point(x, y), eyeDiameter / 2, EmguExtensions.WhiteColor, -1, lineType);
CvInvoke.Circle(mats[3], new Point(x, y), eyeDiameter / 2, EmguExtensions.WhiteColor, -1, lineType);
mats[0].DrawCircle(new Point(x, y), radius, EmguExtensions.WhiteColor, -1, lineType);
mats[3].DrawCircle(new Point(x, y), radius, EmguExtensions.WhiteColor, -1, lineType);
Progress++;

// Do the noose
Expand Down
2 changes: 1 addition & 1 deletion UVtools.AvaloniaControls/UVtools.AvaloniaControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- ExtendedNumericUpDown: Initial value with a reset button and value unit label
- IndexSelector: Allow to choose an index from a collection count and display the selected number
- GroupBox: Similar to GroupBox of WinForms, it contain an Header and Content</Description>
<Version>4.0.2</Version>
<Version>4.0.3</Version>

<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/sn4k3/UVtools/tree/master/UVtools.AvaloniaControls</RepositoryUrl>
Expand Down
9 changes: 7 additions & 2 deletions UVtools.Core/Excellon/ExcellonDrillFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ public Point PositionMmToPx(PointF atMm)

public int SizeMmToPx(float sizeMm)
=> (int)Math.Max(1, Math.Round(sizeMm * XYppmm.Max() * SizeScale, (MidpointRounding)SizeMidpointRounding));

public Size SizeMmToPx(float sizeMmX, float sizeMmY)
=> new ((int)Math.Max(1, Math.Round(sizeMmX * XYppmm.Width * SizeScale, (MidpointRounding)SizeMidpointRounding)),
(int)Math.Max(1, Math.Round(sizeMmX * XYppmm.Height * SizeScale, (MidpointRounding)SizeMidpointRounding)));
#endregion

#region Static methods
Expand All @@ -383,9 +387,10 @@ public static void ParseAndDraw(ExcellonDrillFormat document, string filePath, M

foreach (var drill in document.Drills)
{
var radiusMillimeters = document.GetMillimeters(drill.Diameter / 2);
var position = document.PositionMmToPx(document.GetMillimeters(drill.Position));
var radius = document.SizeMmToPx(document.GetMillimeters(drill.Diameter / 2));
CvInvoke.Circle(mat, position, radius,
var radius = document.SizeMmToPx(radiusMillimeters, radiusMillimeters);
mat.DrawCircle(position, radius,
document.InversePolarity ? EmguExtensions.WhiteColor : EmguExtensions.BlackColor,
-1,
enableAntiAliasing ? LineType.AntiAlias : LineType.EightConnected);
Expand Down
73 changes: 71 additions & 2 deletions UVtools.Core/Extensions/DrawingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,73 @@ public static double CalculatePolygonRadiusFromSideLength(double length, int sid
return length / (2 * Math.Cos((90 - theta / 2) * Math.PI / 180.0));
}


public static Point[] GetPolygonVertices(int sides, double diameter, PointF center, double startingAngle = 0, bool flipHorizontally = false, bool flipVertically = false, MidpointRounding midpointRounding = MidpointRounding.AwayFromZero)
public static Point[] GetPolygonVertices(int sides, SizeF diameter, PointF center, double startingAngle = 0, bool flipHorizontally = false, bool flipVertically = false, MidpointRounding midpointRounding = MidpointRounding.AwayFromZero)
{
if (sides < 3)
throw new ArgumentException("Polygons can't have less than 3 sides...", nameof(sides));

var vertices = new Point[sides];
var radiusX = diameter.Width / 2; // X radius for pixel pitch
var radiusY = diameter.Height / 2; // Y radius for pixel pitch

if (sides == 4)
{
var rotatedRect = new RotatedRect(center, new SizeF(diameter.Width - 1, diameter.Height - 1), (float)startingAngle);
var verticesF = rotatedRect.GetVertices();
for (var i = 0; i < verticesF.Length; i++)
{
vertices[i] = verticesF[i].ToPoint(midpointRounding);
}
}
else
{
var angleIncrement = 2 * Math.PI / sides;
var startRotationAngleRadians = startingAngle * Math.PI / 180;

for (int i = 0; i < sides; i++)
{
var angle = startRotationAngleRadians + i * angleIncrement;

// Scale the X and Y coordinates independently for pixel pitch
var x = (int)Math.Round(center.X + radiusX * Math.Cos(angle), midpointRounding);
var y = (int)Math.Round(center.Y + radiusY * Math.Sin(angle), midpointRounding);

vertices[i] = new Point(x, y);
}
}

if (flipHorizontally)
{
var startX = center.X - radiusX;
var endX = center.X + radiusX;
for (int i = 0; i < sides; i++)
{
vertices[i].X = (int)Math.Round(endX - (vertices[i].X - startX), midpointRounding);
}
}

if (flipVertically)
{
var startY = center.Y - radiusY;
var endY = center.Y + radiusY;
for (int i = 0; i < sides; i++)
{
vertices[i].Y = (int)Math.Round(endY - (vertices[i].Y - startY), midpointRounding);
}
}

return vertices;
}


public static Point[] GetAlignedPolygonVertices(int sides, SizeF diameter, PointF center, double startingAngle = 0, bool flipHorizontally = false, bool flipVertically = false, MidpointRounding midpointRounding = MidpointRounding.AwayFromZero)
{
if (sides != 4) startingAngle += (180 - (360.0 / sides)) / 2;
return GetPolygonVertices(sides, diameter, center, startingAngle, flipHorizontally, flipVertically, midpointRounding);

/*if (sides < 3)
throw new ArgumentException("Polygons can't have less than 3 sides...", nameof(sides));
var vertices = new Point[sides];
var radius = diameter / 2;
Expand All @@ -58,6 +119,7 @@ public static Point[] GetPolygonVertices(int sides, double diameter, PointF cent
}
else
{
// Aligned version
var angleIncrement = 360.0 / sides; //calculate the rotation angle
var rad = Math.PI / 180.0;
Expand Down Expand Up @@ -110,5 +172,12 @@ public static Point[] GetPolygonVertices(int sides, double diameter, PointF cent
}
return vertices;
*/
}

public static Point[] GetAlignedPolygonVertices(int sides, float diameter, PointF center, double startingAngle = 0, bool flipHorizontally = false, bool flipVertically = false, MidpointRounding midpointRounding = MidpointRounding.AwayFromZero)
{
if (sides != 4) startingAngle += (180 - (360.0 / sides)) / 2;
return GetPolygonVertices(sides, new SizeF(diameter, diameter), center, startingAngle, flipHorizontally, flipVertically, midpointRounding);
}
}
Loading

0 comments on commit 702d5b1

Please sign in to comment.