Skip to content

Commit a97b892

Browse files
author
Sven
committed
Updated variable names according to naming convention.
1 parent 2d46a86 commit a97b892

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

  • ReaderWriter/3rdPartyFormatAdapters/GCODE/GCodeReaderWriter

ReaderWriter/3rdPartyFormatAdapters/GCODE/GCodeReaderWriter/GCodeReader.cs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ namespace OpenVectorFormat.GCodeReaderWriter
3737
{
3838
public class GCodeReader : FileReader
3939
{
40-
private WorkPlane currentWP;
41-
private VectorBlock currentVB;
42-
private IFileReaderWriterProgress progress;
40+
private WorkPlane _currentWP;
41+
private VectorBlock _currentVB;
42+
private IFileReaderWriterProgress _progress;
4343
private CacheState _cacheState = CacheState.NotCached;
44-
private string filename;
45-
private bool fileLoadingFinished;
44+
private string _filename;
45+
private bool _fileLoadingFinished;
4646

4747
public new static List<String> SupportedFileFormats { get; } = new List<string>() { ".gcode", ".gco" };
4848

@@ -73,7 +73,7 @@ public override Job CacheJobToMemory()
7373
{
7474
return job;
7575
}
76-
else if (File.Exists(filename))
76+
else if (File.Exists(_filename))
7777
{
7878
ParseGCodeFile();
7979
return job;
@@ -137,8 +137,8 @@ public override WorkPlane GetWorkPlaneShell(int i_workPlane)
137137

138138
public override void OpenJob(string filename, IFileReaderWriterProgress progress = null)
139139
{
140-
this.progress = progress;
141-
this.filename = filename;
140+
this._progress = progress;
141+
this._filename = filename;
142142
_cacheState = CacheState.NotCached;
143143
if (!SupportedFileFormats.Contains(Path.GetExtension(filename)))
144144
{
@@ -153,7 +153,7 @@ public override void OpenJob(string filename, IFileReaderWriterProgress progress
153153
}
154154
};
155155

156-
this.filename = filename;
156+
this._filename = filename;
157157

158158
ParseGCodeFile();
159159
}
@@ -169,19 +169,19 @@ public void ParseGCodeFile()
169169
Vector3 position = new Vector3(0, 0, 0);
170170
float angle = 0f;
171171

172-
GCodeCommandList gCodeCommands = new GCodeCommandList(File.ReadAllLines(filename));
172+
GCodeCommandList gCodeCommands = new GCodeCommandList(File.ReadAllLines(_filename));
173173

174174
bool VBlocked = true;
175175
int MPKey = 0;
176176

177-
currentWP = new WorkPlane
177+
_currentWP = new WorkPlane
178178
{
179179
WorkPlaneNumber = 0
180180
};
181181
job.NumWorkPlanes = 0;
182-
currentWP.Repeats = 0;
182+
_currentWP.Repeats = 0;
183183

184-
currentVB = new VectorBlock
184+
_currentVB = new VectorBlock
185185
{
186186
MarkingParamsKey = 0,
187187
MetaData = new VectorBlock.Types.VectorBlockMetaData
@@ -253,13 +253,13 @@ void UpdateLineSequence(LinearInterpolationCmd linearCmd)
253253
{
254254
UpdateSpeed(linearCmd.isOperation, linearCmd.feedRate);
255255

256-
if (currentVB.LineSequence3D == null)
256+
if (_currentVB.LineSequence3D == null)
257257
{
258-
currentVB.LineSequence3D = new VectorBlock.Types.LineSequence3D();
258+
_currentVB.LineSequence3D = new VectorBlock.Types.LineSequence3D();
259259
}
260-
currentVB.LineSequence3D.Points.Add(linearCmd.xPosition ?? position.X);
261-
currentVB.LineSequence3D.Points.Add(linearCmd.yPosition ?? position.Y);
262-
currentVB.LineSequence3D.Points.Add(linearCmd.zPosition ?? position.Z);
260+
_currentVB.LineSequence3D.Points.Add(linearCmd.xPosition ?? position.X);
261+
_currentVB.LineSequence3D.Points.Add(linearCmd.yPosition ?? position.Y);
262+
_currentVB.LineSequence3D.Points.Add(linearCmd.zPosition ?? position.Z);
263263
}
264264

265265
void UpdateArc(CircularInterpolationCmd circularCmd)
@@ -274,19 +274,19 @@ void UpdateArc(CircularInterpolationCmd circularCmd)
274274
float angleAbs = (float)Math.Acos(dotProduct) * (180.0f / (float)Math.PI);
275275
angle = (circularCmd.isClockwise ? angleAbs : -angleAbs);
276276

277-
if (angle != currentVB.Arcs3D.Angle && currentVB.Arcs3D != null)
277+
if (angle != _currentVB.Arcs3D.Angle && _currentVB.Arcs3D != null)
278278
{
279-
if (currentVB.Arcs3D.Angle != 0 && !VBlocked)
279+
if (_currentVB.Arcs3D.Angle != 0 && !VBlocked)
280280
{
281281
NewVectorBlock();
282282
}
283283
}
284284

285285
UpdateSpeed(true, circularCmd.feedRate); // Update Speed in between to complete all checks for new VBs before adding centers. Update speed after angle to not write a possible new speed to the old VB
286286

287-
if (currentVB.Arcs3D == null)
287+
if (_currentVB.Arcs3D == null)
288288
{
289-
currentVB.Arcs3D = new VectorBlock.Types.Arcs3D
289+
_currentVB.Arcs3D = new VectorBlock.Types.Arcs3D
290290
{
291291
Angle = angle,
292292

@@ -295,9 +295,9 @@ void UpdateArc(CircularInterpolationCmd circularCmd)
295295
StartDz = position.Z
296296
};
297297
}
298-
currentVB.Arcs3D.Centers.Add(position.X + circularCmd.xCenterRel ?? position.X);
299-
currentVB.Arcs3D.Centers.Add(position.Y + circularCmd.yCenterRel ?? position.Y);
300-
currentVB.Arcs3D.Centers.Add(position.Z);
298+
_currentVB.Arcs3D.Centers.Add(position.X + circularCmd.xCenterRel ?? position.X);
299+
_currentVB.Arcs3D.Centers.Add(position.Y + circularCmd.yCenterRel ?? position.Y);
300+
_currentVB.Arcs3D.Centers.Add(position.Z);
301301
}
302302

303303
void UpdateSpeed(bool isOperation, float? newSpeed)
@@ -329,8 +329,8 @@ void UpdateSpeed(bool isOperation, float? newSpeed)
329329

330330
void processPauseCmd(PauseCommand pauseCmd)
331331
{
332-
currentVB.ExposurePause = new VectorBlock.Types.ExposurePause();
333-
currentVB.ExposurePause.PauseInUs = (ulong)pauseCmd.duration * 1000;
332+
_currentVB.ExposurePause = new VectorBlock.Types.ExposurePause();
333+
_currentVB.ExposurePause.PauseInUs = (ulong)pauseCmd.duration * 1000;
334334
}
335335

336336
void processToolChandeCmd(ToolChangeCommand toolChangeCmd)
@@ -375,12 +375,12 @@ int NewMarkingParams()
375375

376376
void NewVectorBlock()
377377
{
378-
currentVB.MarkingParamsKey = NewMarkingParams();
379-
currentWP.VectorBlocks.Add(currentVB);
380-
currentWP.NumBlocks++;
381-
addedVectorBlocks.Add(currentVB);
378+
_currentVB.MarkingParamsKey = NewMarkingParams();
379+
_currentWP.VectorBlocks.Add(_currentVB);
380+
_currentWP.NumBlocks++;
381+
addedVectorBlocks.Add(_currentVB);
382382

383-
currentVB = new VectorBlock()
383+
_currentVB = new VectorBlock()
384384
{
385385
MetaData = new VectorBlock.Types.VectorBlockMetaData
386386
{
@@ -394,10 +394,10 @@ void NewVectorBlock()
394394
void NewWorkPlane()
395395
{
396396
NewVectorBlock();
397-
currentWP.ZPosInMm = position.Z;
398-
job.WorkPlanes.Add(currentWP);
397+
_currentWP.ZPosInMm = position.Z;
398+
job.WorkPlanes.Add(_currentWP);
399399
job.NumWorkPlanes++;
400-
currentWP = new WorkPlane
400+
_currentWP = new WorkPlane
401401
{
402402
WorkPlaneNumber = job.NumWorkPlanes
403403
};

0 commit comments

Comments
 (0)