Skip to content

Commit

Permalink
Version 1.7.1.1.a
Browse files Browse the repository at this point in the history
  • Loading branch information
svenhb authored Jan 25, 2024
1 parent b454247 commit a8534f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion GRBL-Plotter/MachineControl/GCode2DViewpaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Fill GraphicPaths
* 2023-09-01 new l:700 f:SetRulerDimension / l:380 f:DrawMachineLimit update grid
* 2023-09-14 l:400 f:DrawMachineLimit() add toolTableOffsetX to show tool positions; issue #361
* 2024-01-13 l:675 f:CreateMarkerArrow add try/catch
* 2024-01-25 l:262 f:CreateDrawingPathFromGCode get markerSize from graphics dimension
*/

using System;
Expand Down Expand Up @@ -258,7 +259,7 @@ private static bool CreateDrawingPathFromGCode(GcodeByLine newL, GcodeByLine old
// mark Z-only movements - could be drills
if ((onlyZ > 1) && (passLimit) && (path == pathPenUp) || (oldL.codeLine.Contains("DOT"))) // pen moved from -z to +z
{
float markerSize = 1;
float markerSize = (float)markerSizeGraphic;
int markerType = 1;
if (!Properties.Settings.Default.importUnitmm || (modal.unitsMode == 20))
{ markerSize /= 25.4F; }
Expand Down
23 changes: 20 additions & 3 deletions GRBL-Plotter/MachineControl/GCodeAnalyze.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* GRBL-Plotter. Another GCode sender for GRBL.
This file is part of the GRBL-Plotter application.
Copyright (C) 2015-2023 Sven Hasemann contact: [email protected]
Copyright (C) 2015-2024 Sven Hasemann contact: [email protected]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -33,6 +33,7 @@ You should have received a copy of the GNU General Public License
* 2023-11-15 l:579 f:GetGCodeLines add pathObjectPenColorOnlyNone = false; show default color, if all imported colors = none
* 2023-11-29 l:510 f:GetGCodeLines add findSubroutineFailCounter; abort searching for subroutine if not found after 10 times
* 2023-12-16 l:850 f:ProcessXmlTagStart check for fiducials via .ToUpper().Contains(fiducialLabel.ToUpper()))
* 2024-01-25 add graphicDimension, markerSizeGraphic to adapt size of point markers
*/

using System;
Expand Down Expand Up @@ -186,6 +187,9 @@ public static bool CodeBlocksAvailable()
internal static XyPoint clipOffset = new XyPoint(-1, -1);
private static bool isHeaderSection = false;

internal static XyPoint graphicDimension = new XyPoint(-1, -1);
internal static float markerSizeGraphic = 1;

internal static bool largeDataAmount = false;
internal static int numberDataLines = 0;

Expand Down Expand Up @@ -286,6 +290,8 @@ private static void ResetGlobalObjects()
clipDimension = new XyPoint();
clipOffset = new XyPoint();
isHeaderSection = false;
graphicDimension = new XyPoint();
markerSizeGraphic = 1;

modal = new ModalGroup(); // clear
XmlMarker.Reset(); // reset lists, holding marker line numbers
Expand Down Expand Up @@ -528,6 +534,17 @@ public static bool GetGCodeLines(IList<string> oldCode, BackgroundWorker worker,

if (isHeaderSection)
{
if (singleLine.Contains("DIMENSION XY") && singleLine.Contains(":")) // GraphicCollectData.cs line 1100
{
var tmpLine = singleLine.Split(':');
var tmpVals = tmpLine[1].Trim().Split(' ');
if (double.TryParse(tmpVals[0], System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out double parsed1))
{ graphicDimension.X = parsed1; }
if (double.TryParse(tmpVals[1], System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out double parsed2))
{ graphicDimension.Y = parsed2; }
markerSizeGraphic = (float)Math.Max(Math.Sqrt(graphicDimension.X * graphicDimension.X + graphicDimension.Y * graphicDimension.Y) / 200f, 0.5);
Logger.Trace("----- graphicDimension '{0}' -> {1:0.00} {2:0.00} marker size:{3:0.0}", singleLine, graphicDimension.X, graphicDimension.Y, markerSizeGraphic);
}
if (singleLine.Contains("SVG DIMENSION") && singleLine.Contains(":"))
{
var tmpLine = singleLine.Split(':');
Expand All @@ -536,7 +553,7 @@ public static bool GetGCodeLines(IList<string> oldCode, BackgroundWorker worker,
{ clipDimension.X = parsed1; }
if (double.TryParse(tmpVals[1], System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out double parsed2))
{ clipDimension.Y = parsed2; }
Logger.Trace("----- clipDimension {0} -> {1:0.00} {2:0.00}", singleLine, clipDimension.X, clipDimension.Y);
Logger.Trace("----- clipDimension '{0}' -> {1:0.00} {2:0.00}", singleLine, clipDimension.X, clipDimension.Y);
}
else if (singleLine.Contains("GRAPHIC OFFSET") && singleLine.Contains(":"))
{
Expand All @@ -557,7 +574,7 @@ public static bool GetGCodeLines(IList<string> oldCode, BackgroundWorker worker,

} // finish reading lines
/*********************************************************************/
if (!largeDataAmount && (figureMarkerCount > 1) && (showArrow || showId))
if (!largeDataAmount && (figureMarkerCount > 0) && (showArrow || showId))
{
ModifyPenUpPath(worker, e, ref progressSubOld, progressMainFactor, showArrow, showId);
}
Expand Down

0 comments on commit a8534f6

Please sign in to comment.