-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTestLaser.cs
94 lines (66 loc) · 2.64 KB
/
TestLaser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ToolsGenGkode
{
public partial class TestLaser : Form
{
public TestLaser()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("%");
int CurrentX = 0;
int CurrentY = 0;
int LastX = -999999;
int LastY = -999999;
int currPower = (int)powerStart.Value;
if (powerStep.Value == 0) powerEnd.Value = powerStart.Value;
int currDuration = (int) durationStart.Value;
if (durationStep.Value == 0) durationEnd.Value = durationStart.Value;
while (currPower <= (int)powerEnd.Value && powerStep.Value != 0)
{
while (currDuration <= (int)durationEnd.Value && durationStep.Value != 0)// int duration = (int)durationStart.Value; duration <= ; duration += (int)durationStep.Value)
{
string ssrt = "M5 ";
if (LastX != CurrentX)
{
//нужно вывести значение по оси Х
LastX = CurrentX;
ssrt += " X" + CurrentX.ToString("#0.###");
}
if (LastY != CurrentY)
{
//нужно вывести значение по оси Х
LastY = CurrentY;
ssrt += " Y" + CurrentY.ToString("#0.###");
}
sb.AppendLine(ssrt.Trim());
sb.AppendLine("M3 S" + currPower.ToString("0000") + " G4 P" + (((decimal)currDuration / 1000).ToString("###0.####")));
sb.AppendLine("M5");
CurrentY += (int) distance.Value;
currDuration += (int) durationStep.Value;
}
CurrentX += (int)distance.Value;
CurrentY = 0;
currPower += (int) powerStep.Value;
}
sb.Replace(',', '.');
sb.AppendLine("%");
textBox1.Text = sb.ToString();
}
private void TestLaser_Load(object sender, EventArgs e)
{
}
}
}