Improving BaseObject

Creating debug tools for print log output
This commit is contained in:
Lars Brubaker 2021-03-09 14:42:44 -08:00
parent 005b868c4d
commit f73ca75084
5 changed files with 72 additions and 7 deletions

View file

@ -36,6 +36,7 @@ using System.Runtime.InteropServices;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Threading;
using MatterControl.Printing;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
@ -43,6 +44,7 @@ using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.SerialPortCommunication.FrostedSerial;
using MatterHackers.VectorMath;
using Microsoft.Extensions.Configuration;
using Mindscape.Raygun4Net;
using Photon.Parts;
@ -92,7 +94,7 @@ namespace MatterHackers.MatterControl
[STAThread]
public static void Main(string[] args)
{
#if false
#if false // this is for some early testing of SLA output
var test = new PhotonFile();
void Progress(string message)
{
@ -113,6 +115,36 @@ namespace MatterHackers.MatterControl
}
#endif
#if false // this is for processing print log exports
var filename = "C:\\Users\\LarsBrubaker\\Downloads\\210309 B2 print_log.txt";
var lines = File.ReadAllLines(filename);
var newPosition = default(Vector3);
var ePosition = 0.0;
var instruction = 0;
var layer = 0;
using (var writetext = new StreamWriter("C:\\Temp\\printlog.gcode"))
{
foreach (var line in lines)
{
if (line.Contains(" G1 "))
{
GCodeFile.GetFirstNumberAfter("X", line, ref newPosition.X);
GCodeFile.GetFirstNumberAfter("Y", line, ref newPosition.Y);
GCodeFile.GetFirstNumberAfter("Z", line, ref newPosition.Z);
GCodeFile.GetFirstNumberAfter("E", line, ref ePosition);
writetext.WriteLine($"G1 X{newPosition.X} Y{newPosition.Y} Z{newPosition.Z} E{ePosition}");
instruction++;
if(instruction % 500 == 0)
{
writetext.WriteLine($"; LAYER:{layer++}");
}
}
}
}
#endif
// Set the global culture for the app, current thread and all new threads
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;