Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GCodeFileInfo.cpp « GCodes « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4242a7864290834f3de3113ac20f8053246d15b8 (plain)
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
/*
 * GCodeFileInfo.cpp
 *
 *  Created on: 11 Jan 2020
 *      Author: David
 */

#include "GCodeFileInfo.h"

void GCodeFileInfo::Init() noexcept
{
	isValid = false;
	incomplete = true;
	firstLayerHeight = 0.0;
	objectHeight = 0.0;
	layerHeight = 0.0;
	printTime = simulatedTime = 0;
	numFilaments = 0;
	lastModifiedTime = 0;
	generatedBy.Clear();
	fileSize = 0;
	for (size_t extr = 0; extr < MaxExtruders; extr++)
	{
		filamentNeeded[extr] = 0.0;
	}
}

unsigned int GCodeFileInfo::GetNumLayers() const noexcept
{
	if (layerHeight <= 0.0) { return 0; }
	const float nl = (firstLayerHeight > 0.0)
						? (objectHeight - firstLayerHeight)/layerHeight + 1
							: objectHeight/layerHeight;
	return rintf(max<float>(nl, 0.0));
}

// End