Skip to content

Commit 39100f2

Browse files
authored
Version 1.7.5.3
1 parent 5140f90 commit 39100f2

19 files changed

+3871
-2503
lines changed

GRBL-Plotter/GCodeCreation/CreateFromForm/GCodeFromImage.Designer.cs

Lines changed: 277 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GRBL-Plotter/GCodeCreation/CreateFromForm/GCodeFromImage.ar.resx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,4 +719,50 @@
719719
<data name="GbOutputSizeShow.Text" xml:space="preserve">
720720
<value>البعد بكسل الفن</value>
721721
</data>
722+
<data name="RbStartGrayS.ToolTip" xml:space="preserve">
723+
<value>لجهاز التوجيه، أو الليزر، أو قلم أو فرشاة أحادية اللون.
724+
725+
يستخدم قيمة تدرج الرمادي (0 - 255) للتحكم في عمق أو قوة الأداة.
726+
727+
ستُؤخذ مرشحات الألوان والتأثيرات في الاعتبار عند إنشاء تدرج الرمادي.</value>
728+
</data>
729+
<data name="RbStartGraySpecial.Text" xml:space="preserve">
730+
<value>قيمة رمادية للاستخدام الخاص</value>
731+
</data>
732+
<data name="RbStartGraySpecial.ToolTip" xml:space="preserve">
733+
<value>لموزعات السوائل أو غيرها من الآلات الخاصة.
734+
يستخدم قيمة التدرج الرمادي (٠ - ٢٥٥) للتحكم في أي محور تحتاجه.
735+
سيتم مراعاة فلاتر الألوان والتأثيرات عند إنشاء التدرج الرمادي.</value>
736+
</data>
737+
<data name="RbStartGrayZ.ToolTip" xml:space="preserve">
738+
<value>لجهاز التوجيه، أو الليزر، أو قلم أو فرشاة أحادية اللون.
739+
740+
يستخدم قيمة تدرج الرمادي (0 - 255) للتحكم في عمق أو قوة الأداة.
741+
742+
ستُؤخذ مرشحات الألوان والتأثيرات في الاعتبار عند إنشاء تدرج الرمادي.</value>
743+
</data>
744+
<data name="nUDSpecialBottom.ToolTip" xml:space="preserve">
745+
<value>قيمة أقل</value>
746+
</data>
747+
<data name="label43.Text" xml:space="preserve">
748+
<value>رمز GCode بعد</value>
749+
</data>
750+
<data name="label42.Text" xml:space="preserve">
751+
<value>قيمة تطبيق رمز GCode</value>
752+
</data>
753+
<data name="label41.Text" xml:space="preserve">
754+
<value>القيمة</value>
755+
</data>
756+
<data name="label40.Text" xml:space="preserve">
757+
<value>رمز GCode قبل</value>
758+
</data>
759+
<data name="label38.Text" xml:space="preserve">
760+
<value>الحد الأدنى (أبيض)</value>
761+
</data>
762+
<data name="label39.Text" xml:space="preserve">
763+
<value>الحد الأقصى (أسود)</value>
764+
</data>
765+
<data name="RbPixelArtDrawShapeScript.Text" xml:space="preserve">
766+
<value>من الكود/البرنامج النصي</value>
767+
</data>
722768
</root>

GRBL-Plotter/GCodeCreation/CreateFromForm/GCodeFromImage.cs

Lines changed: 87 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* GRBL-Plotter. Another GCode sender for GRBL.
22
This file is part of the GRBL-Plotter application.
33
4-
Copyright (C) 2015-2024 Sven Hasemann contact: [email protected]
4+
Copyright (C) 2015-2025 Sven Hasemann contact: [email protected]
55
66
This program is free software: you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -114,7 +114,17 @@ private void GCodeFromImage_FormClosing(object sender, FormClosingEventArgs e)
114114
{
115115
Logger.Info("++++++ GCodeFromImage STOP ++++++");
116116
Properties.Settings.Default.locationImageForm = Location;
117-
Properties.Settings.Default.importImagePixelArt = RbPixelArt.Checked;
117+
118+
int processingMode = Properties.Settings.Default.importImageProcessingMode;
119+
if (RbGrayscalePattern.Checked) { Properties.Settings.Default.importImageProcessingMode=0; }
120+
else if (RbGrayscaleVector.Checked) { Properties.Settings.Default.importImageProcessingMode = 1; }
121+
else if (RbPixelArt.Checked) { Properties.Settings.Default.importImageProcessingMode = 2; }
122+
123+
if (RbStartGrayZ.Checked) { Properties.Settings.Default.importImageGrayAsMode=0; }
124+
else if (RbStartGrayS.Checked) { Properties.Settings.Default.importImageGrayAsMode = 1; }
125+
else if (RbStartGraySpecial.Checked) { Properties.Settings.Default.importImageGrayAsMode = 2; }
126+
127+
Properties.Settings.Default.Save();
118128

119129
pictureBox1.Image = null;
120130
adjustedImage = null;
@@ -158,25 +168,13 @@ public GCodeFromImage(bool loadFile = false)
158168
}
159169

160170
#region load picture
161-
//On form load
162-
/* not used ??? */
163-
private void GCodeFromImage_Load(object sender, EventArgs e)
164-
{
165-
lblStatus.Text = "Done";
166-
GetToolTableSettings();
167-
AutoZoomToolStripMenuItem_Click(this, null);//Set preview zoom mode
168-
RbStartGrayS.Checked = !Properties.Settings.Default.importImageGrayAsZ;
169-
RbPixelArtShape.Checked = !Properties.Settings.Default.importImagePixelArtDrawDot;
170-
}
171-
172171
// load picture when form opens
173172
private void ImageToGCode_Load(object sender, EventArgs e)
174173
{
175174
Location = Properties.Settings.Default.locationImageForm;
176175
Size desktopSize = System.Windows.Forms.SystemInformation.PrimaryMonitorSize;
177176
if ((Location.X < -20) || (Location.X > (desktopSize.Width - 100)) || (Location.Y < -20) || (Location.Y > (desktopSize.Height - 100))) { CenterToScreen(); }
178177

179-
RbStartGrayS.Checked = !Properties.Settings.Default.importImageGrayAsZ;
180178
RbPixelArtShape.Checked = !Properties.Settings.Default.importImagePixelArtDrawDot;
181179
RbPixelArtDrawShapeRect.Checked = !Properties.Settings.Default.importImagePixelArtDrawShapeCircle;
182180

@@ -187,18 +185,37 @@ private void ImageToGCode_Load(object sender, EventArgs e)
187185
else
188186
{ tabControl2.SelectedTab = tabPage2Gray; }
189187

190-
if (Properties.Settings.Default.importImageGrayVectorize)
191-
{ RbGrayscaleVector.Checked = true; }
192-
else
193-
{ RbGrayscalePattern.Checked = true; }
188+
int processingMode = Properties.Settings.Default.importImageProcessingMode;
189+
if (processingMode <= 0)
190+
{
191+
RbGrayscalePattern.Checked = true;
192+
GbOutputSizeSet.Visible = true;
193+
GbOutputSizeShow.Visible = false;
194+
RbGrayscaleVector_CheckedChanged(sender, e);
195+
}
196+
else if (processingMode == 1)
197+
{
198+
RbGrayscaleVector.Checked = true;
199+
GbOutputSizeSet.Visible = true;
200+
GbOutputSizeShow.Visible = false;
201+
RbGrayscaleVector_CheckedChanged(sender, e);
202+
}
203+
else if (processingMode >= 2)
204+
{
205+
RbPixelArt.Checked = true;
206+
GbOutputSizeSet.Visible = false;
207+
GbOutputSizeShow.Visible = true;
208+
RbGrayscaleVector_CheckedChanged(sender, e);
209+
}
194210

195-
if (!Properties.Settings.Default.importImageGrayAsZ)
196-
RbStartGrayS.Checked = true;
211+
int grayMode = Properties.Settings.Default.importImageGrayAsMode;
212+
if (grayMode <= 0) { RbStartGrayZ.Checked = true; }
213+
else if (grayMode == 1) { RbStartGrayS.Checked = true; }
214+
else if (grayMode >= 2) { RbStartGraySpecial.Checked = true; }
197215

198216
TabControl2_SelectedIndexChanged(null, null); // don't 'ApplyColorCorrections'
199217
}
200218
EnableControlEvents();
201-
RbPixelArt.Checked = Properties.Settings.Default.importImagePixelArt;
202219

203220
ResetColorCorrectionControls();
204221

@@ -207,6 +224,7 @@ private void ImageToGCode_Load(object sender, EventArgs e)
207224

208225
ProcessLoading(); // reset color corrections
209226
UpdateToolTableList(); // show tool-files and last loaded tools
227+
Highlight();
210228
}
211229

212230
private static string lastFile = "";
@@ -302,7 +320,7 @@ public void LoadUrl(string url) // called from MainFormLoadFile 654
302320
MessageBox.Show(string.Format("Error on loading from URL '{0}'\r\n{1}", url, err.Message), "Error");
303321
}
304322
}
305-
323+
306324
private void GCodeFromImage_DragEnter(object sender, DragEventArgs e)
307325
{ e.Effect = DragDropEffects.All; }
308326

@@ -359,7 +377,7 @@ private void ProcessLoading()
359377
GenerateResultImageGray(ref resultToolNrArray); // fill resultToolNrArray (Image-Pixel=GrayVal)
360378
}
361379
#endregion
362-
380+
363381
private void GetToolTableSettings()
364382
{
365383
if (useColorMode) // use color mode
@@ -449,7 +467,7 @@ private void ListAvailableTools(bool all = true)
449467
}
450468
CheckedListBoxTools.SelectedIndexChanged += CheckedListBoxTools_SelectedIndexChanged;
451469
}
452-
470+
453471
/// <summary>
454472
/// update result after deselecting tools
455473
/// </summary>
@@ -517,7 +535,7 @@ private void ApplyColorCorrectionsEvent(object sender, EventArgs e) // nUDMaxCo
517535
if (logEnable) Logger.Trace("ApplyColorCorrectionsEvent sender:{0} preventEvent:{1} ", ((Control)sender).Name, preventEvent);
518536
if (preventEvent) return;
519537
if ((sender.GetType() == typeof(RadioButton)) && !((RadioButton)sender).Checked) return;
520-
// if ((sender.GetType() == typeof(CheckBox)) && !((CheckBox)sender).Checked) return;
538+
// if ((sender.GetType() == typeof(CheckBox)) && !((CheckBox)sender).Checked) return;
521539

522540
DisableControlEvents();
523541
{
@@ -573,7 +591,7 @@ private void ApplyColorCorrections(string source)
573591
resoFactorX = 1;
574592
resoFactorY = 1;
575593

576-
LbLSizeXPic.Text = originalImage.Width.ToString()+" px";
594+
LbLSizeXPic.Text = originalImage.Width.ToString() + " px";
577595
LbLSizeYPic.Text = originalImage.Height.ToString() + " px";
578596
UpdateSizeControls();
579597

@@ -601,7 +619,7 @@ private void ApplyColorCorrections(string source)
601619
ySize = originalImage.Height * (int)NuDPixelArtDotsPerPixel.Value;
602620
}
603621
pixelCount = xSize * ySize;
604-
Logger.Info("●●● ApplyColorCorrections pixelCount:{0} Size:{1} x {2} resoVal:{3} desiredX:{4} desiredY:{5}", pixelCount, xSize, ySize, nUDResoX.Value, resoDesiredX, resoDesiredY);
622+
Logger.Info("●●● ApplyColorCorrections pixelCount:{0} Size:{1} x {2} resoVal:{3:0.0000} desiredX:{4:0.0000} desiredY:{5:0.0000}", pixelCount, xSize, ySize, nUDResoX.Value, resoDesiredX, resoDesiredY);
605623

606624
try
607625
{
@@ -1181,7 +1199,7 @@ private void Timer1_Tick(object sender, EventArgs e)
11811199
}
11821200
}
11831201
}
1184-
1202+
11851203
/// <summary>
11861204
/// Count amount of different colors in adjusted image
11871205
/// </summary>
@@ -1367,12 +1385,12 @@ private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
13671385
oldPoint = e.Location;
13681386
}
13691387
}
1370-
1388+
13711389
private static String HexConverter(System.Drawing.Color c)
13721390
{
13731391
return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
13741392
}
1375-
1393+
13761394
private void CbExceptColor_CheckedChanged(object sender, EventArgs e)
13771395
{
13781396
if (cbExceptColor.Checked)
@@ -1559,6 +1577,11 @@ private void Highlight()
15591577
else
15601578
{ RbStartGrayS.BackColor = GbStartGrayS.BackColor = Color.WhiteSmoke; }
15611579

1580+
if (RbStartGraySpecial.Checked)
1581+
{ RbStartGraySpecial.BackColor = GbStartGraySpecial.BackColor = Color.Yellow; }
1582+
else
1583+
{ RbStartGraySpecial.BackColor = GbStartGraySpecial.BackColor = Color.WhiteSmoke; }
1584+
15621585
if (RbEngravingLine.Checked)
15631586
{ RbEngravingLine.BackColor = GbEngravingLine.BackColor = Color.Yellow; }
15641587
else
@@ -1597,7 +1620,40 @@ private void RbEngravingLine_CheckedChanged(object sender, EventArgs e)
15971620

15981621
private void BtnReloadPattern_Click(object sender, EventArgs e)
15991622
{
1600-
// dummy function,
1623+
// dummy function,
16011624
}
1625+
1626+
private void TbPixelArtDrawShapeFileDialog_Click(object sender, EventArgs e)
1627+
{
1628+
SetFilePath(TbPixelArtDrawShapeScript);
1629+
}
1630+
1631+
private void SetFilePath(TextBox tmp, string filter = "GCode (*.nc)|*.nc|All Files (*.*)|*.*")
1632+
{
1633+
OpenFileDialog opnDlg = new OpenFileDialog();
1634+
string ipath = Datapath.MakeAbsolutePath(tmp.Text);
1635+
Logger.Info("SetFilePath initiial: box:{0} makeAbsolute:{1}", tmp.Text, ipath);
1636+
opnDlg.InitialDirectory = ipath.Substring(0, ipath.LastIndexOf("\\"));
1637+
opnDlg.Filter = filter; //"GCode (*.nc)|*.nc|All Files (*.*)|*.*";
1638+
// MessageBox.Show(opnDlg.InitialDirectory+"\r\n"+ Application.StartupPath);
1639+
if (opnDlg.ShowDialog(this) == DialogResult.OK)
1640+
{
1641+
FileInfo f = new FileInfo(opnDlg.FileName);
1642+
string path;
1643+
Logger.Info("SetFilePath DirectoryName:{0} Datapath.AppDataFolder:{1}", f.DirectoryName, Datapath.AppDataFolder);
1644+
if (f.DirectoryName == Datapath.AppDataFolder)
1645+
path = f.Name; // only file name
1646+
else if (f.DirectoryName.StartsWith(Datapath.AppDataFolder))
1647+
path = f.FullName.Replace(Datapath.AppDataFolder, ".");
1648+
else
1649+
path = f.FullName; // Full path
1650+
if (path.StartsWith(@".\"))
1651+
path = path.Substring(2);
1652+
tmp.Text = path;
1653+
Logger.Info("SetFilePath changed: box:{0} makeAbsolute:{1}", path, opnDlg.FileName);
1654+
}
1655+
opnDlg.Dispose();
1656+
}
1657+
16021658
}
16031659
}

GRBL-Plotter/GCodeCreation/CreateFromForm/GCodeFromImage.cs.resx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,4 +716,46 @@ Jinak začíná na levém dolním okraji.</value>
716716
<data name="GbOutputSizeShow.Text" xml:space="preserve">
717717
<value>Rozměr Pixel Art</value>
718718
</data>
719+
<data name="RbStartGrayS.ToolTip" xml:space="preserve">
720+
<value>Pro router, laser nebo jednobarevné pero nebo štětec
721+
Použije hodnotu ve stupních šedi (0 - 255) k ovládání hloubky nebo výkonu nástroje.
722+
Při generování stupňů šedi budou brány v úvahu barevné filtry a efekty.</value>
723+
</data>
724+
<data name="RbStartGraySpecial.Text" xml:space="preserve">
725+
<value>Šedá hodnota speciální použití</value>
726+
</data>
727+
<data name="RbStartGraySpecial.ToolTip" xml:space="preserve">
728+
<value>Pro dávkovače kapalin nebo jiné speciální stroje.
729+
Použije hodnotu ve stupních šedi (0 - 255) k ovládání jakékoli osy, kterou potřebujete.
730+
Při generování stupňů šedi budou brány v úvahu barevné filtry a efekty.</value>
731+
</data>
732+
<data name="RbStartGrayZ.ToolTip" xml:space="preserve">
733+
<value>Pro router, laser nebo jednobarevné pero nebo štětec
734+
Použije hodnotu ve stupních šedi (0 - 255) k ovládání hloubky nebo výkonu nástroje.
735+
Při generování stupňů šedi budou brány v úvahu barevné filtry a efekty.</value>
736+
</data>
737+
<data name="nUDSpecialBottom.ToolTip" xml:space="preserve">
738+
<value>Nižší hodnota</value>
739+
</data>
740+
<data name="label43.Text" xml:space="preserve">
741+
<value>GCode po</value>
742+
</data>
743+
<data name="label42.Text" xml:space="preserve">
744+
<value>Hodnota použití GCode</value>
745+
</data>
746+
<data name="label41.Text" xml:space="preserve">
747+
<value>Hodnota</value>
748+
</data>
749+
<data name="label40.Text" xml:space="preserve">
750+
<value>GCode dříve</value>
751+
</data>
752+
<data name="label38.Text" xml:space="preserve">
753+
<value>Min (bílá)</value>
754+
</data>
755+
<data name="label39.Text" xml:space="preserve">
756+
<value>Max (černá)</value>
757+
</data>
758+
<data name="RbPixelArtDrawShapeScript.Text" xml:space="preserve">
759+
<value>Z kódu / skriptu</value>
760+
</data>
719761
</root>

GRBL-Plotter/GCodeCreation/CreateFromForm/GCodeFromImage.de-DE.resx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,46 @@ Farbfilter und Effekte werden bei der Generierung von Graustufen berücksichtigt
678678
<data name="GbOutputSizeShow.Text" xml:space="preserve">
679679
<value>Pixel-Art-Dimension</value>
680680
</data>
681+
<data name="RbStartGrayS.ToolTip" xml:space="preserve">
682+
<value>Für Router, Laser oder einfarbigen Stift oder Pinsel.
683+
Verwendet den Graustufenwert (0–255), um die Tiefe oder Leistung des Werkzeugs zu steuern.
684+
Farbfilter und -effekte werden bei der Graustufengenerierung berücksichtigt.</value>
685+
</data>
686+
<data name="RbStartGraySpecial.Text" xml:space="preserve">
687+
<value>Grauwert-Sondernutzung</value>
688+
</data>
689+
<data name="RbStartGraySpecial.ToolTip" xml:space="preserve">
690+
<value>Für Flüssigkeitsspender oder andere Spezialmaschinen.
691+
Verwendet den Graustufenwert (0–255) zur Steuerung der gewünschten Achsen.
692+
Farbfilter und -effekte werden bei der Graustufengenerierung berücksichtigt.</value>
693+
</data>
694+
<data name="RbStartGrayZ.ToolTip" xml:space="preserve">
695+
<value>Für Router, Laser oder einfarbigen Stift oder Pinsel.
696+
Verwendet den Graustufenwert (0–255), um die Tiefe oder Leistung des Werkzeugs zu steuern.
697+
Farbfilter und -effekte werden bei der Graustufengenerierung berücksichtigt.</value>
698+
</data>
699+
<data name="nUDSpecialBottom.ToolTip" xml:space="preserve">
700+
<value>Unterer Wert</value>
701+
</data>
702+
<data name="label43.Text" xml:space="preserve">
703+
<value>GCode nach</value>
704+
</data>
705+
<data name="label42.Text" xml:space="preserve">
706+
<value>GCode-Wert anwenden</value>
707+
</data>
708+
<data name="label41.Text" xml:space="preserve">
709+
<value>Wert</value>
710+
</data>
711+
<data name="label40.Text" xml:space="preserve">
712+
<value>GCode vor</value>
713+
</data>
714+
<data name="label38.Text" xml:space="preserve">
715+
<value>Min (weiß)</value>
716+
</data>
717+
<data name="label39.Text" xml:space="preserve">
718+
<value>Max (schwarz)</value>
719+
</data>
720+
<data name="RbPixelArtDrawShapeScript.Text" xml:space="preserve">
721+
<value>Aus Code/Skript</value>
722+
</data>
681723
</root>

0 commit comments

Comments
 (0)