FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ORNLSlicer/src/gcode/gcode_command.cpp at develop · ORNLSlicer/ORNLSlicer · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ORNLSlicer
/
ORNLSlicer
Public
Notifications
You must be signed in to change notification settings
Fork
20
Star
90
Code
Issues
18
Pull requests
5
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ORNLSlicer
/
src
/
gcode
/
gcode_command.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
174 lines (138 loc) · 4.69 KB
Breadcrumbs
ORNLSlicer
/
src
/
gcode
/
gcode_command.cpp
Copy path
File metadata and controls
174 lines (138 loc) · 4.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
include
"
gcode/gcode_command.h
"
#
include
<
QMap
>
#
include
<
QString
>
#
include
<
qcontainerfwd.h
>
#
include
"
geometry/point.h
"
namespace
ORNL
{
GcodeCommand::GcodeCommand
()
: m_line_number(-
1
),
m_command
(
0
),
m_command_id(-
1
),
m_is_motion_command(
false
),
m_is_end_of_layer(
false
),
m_deposition_active(
false
),
m_extruder_speed(
0
) {}
GcodeCommand::GcodeCommand
(
const
GcodeCommand& other)
: m_line_number(other.m_line_number),
m_command(other.m_command),
m_command_id(other.m_command_id),
m_parameters(other.m_parameters),
m_optional_parameters(other.m_optional_parameters),
m_comment(other.m_comment),
m_is_motion_command(other.m_is_motion_command),
m_is_end_of_layer(other.m_is_end_of_layer),
m_deposition_active(other.m_deposition_active),
m_extruder_speed(other.m_extruder_speed) {}
//
! \brief Retrieves the line number of the command
const
int
&
GcodeCommand::getLineNumber
()
const
{
return
m_line_number;
}
//
! \brief Retrieves the Command
const
char
&
GcodeCommand::getCommand
()
const
{
return
m_command;
}
//
! \brief Retrieves the Command ID
const
int
&
GcodeCommand::getCommandID
()
const
{
return
m_command_id;
}
//
! \brief Retrieves the Command motion boolean
const
bool
&
GcodeCommand::getCommandIsMotion
()
const
{
return
m_is_motion_command;
}
//
! \brief Retrieves the Command motion boolean
const
bool
&
GcodeCommand::getCommandIsEndOfLayer
()
const
{
return
m_is_end_of_layer;
}
//
! \brief Retrieves the Command
void
GcodeCommand::clearCommand
() {
m_command =
0
;
}
//
! \brief Retrieves the Command ID
void
GcodeCommand::clearCommandID
() {
m_command_id = -
1
;
}
//
! \brief Retrieves all parameters
const
QMap<
char
,
double
>&
GcodeCommand::getParameters
()
const
{
return
m_parameters;
}
//
! \brief Retrieves optional parameters
const
QMap<
char
,
double
>&
GcodeCommand::getOptionalParameters
()
const
{
return
m_optional_parameters;
}
//
! \brief Retrieves the Comment
const
QString&
GcodeCommand::getComment
()
const
{
return
m_comment;
}
void
GcodeCommand::setLineNumber
(
const
int
line_number) {
m_line_number = line_number;
}
void
GcodeCommand::setCommand
(
const
char
command) {
m_command = command;
}
void
GcodeCommand::setCommandID
(
const
int
commandID) {
m_command_id = commandID;
}
void
GcodeCommand::setComment
(
const
QString& comment) {
m_comment = comment;
}
void
GcodeCommand::setMotionCommand
(
bool
isMotionCommand) {
m_is_motion_command = isMotionCommand;
}
void
GcodeCommand::setEndOfLayer
(
bool
isEndOfLayer) {
m_is_end_of_layer = isEndOfLayer;
}
void
GcodeCommand::addParameter
(
const
char
param_key,
const
double
param_value) {
m_parameters.
insert
(param_key, param_value);
}
void
GcodeCommand::addOptionalParameter
(
const
char
param_key,
const
double
param_value) {
m_optional_parameters.
insert
(param_key, param_value);
}
bool
GcodeCommand::removeParameter
(
const
char
param_key) {
return
m_parameters.
remove
(param_key) >
0
;
}
void
GcodeCommand::clearParameters
() {
m_parameters.
clear
();
m_optional_parameters.
clear
();
}
void
GcodeCommand::clearComment
() {
m_comment.
clear
();
}
bool
GcodeCommand::
operator
==(
const
GcodeCommand& r) {
bool
ret =
getLineNumber
() == r.
getLineNumber
() &&
getCommand
() == r.
getCommand
() &&
getCommandID
() == r.
getCommandID
() &&
getComment
() == r.
getComment
();
QMap<
char
,
double
>::const_iterator temp;
for
(QMap<
char
,
double
>::const_iterator i = m_parameters.
cbegin
(); i != m_parameters.
cend
(); ++i) {
ret &= (temp = r.
m_parameters
.
find
(i.
key
())) != r.
m_parameters
.
end
();
ret &= temp.
value
() == i.
value
();
}
return
ret;
}
bool
GcodeCommand::
operator
!=(
const
GcodeCommand& r) {
return
!(*
this
== r);
}
GcodeCommand& GcodeCommand::
operator
=(
const
GcodeCommand& other) {
m_line_number = other.
m_line_number
;
m_command = other.
m_command
;
m_command_id = other.
m_command_id
;
m_parameters = other.
m_parameters
;
m_optional_parameters = other.
m_optional_parameters
;
m_comment = other.
m_comment
;
m_is_motion_command = other.
m_is_motion_command
;
m_is_end_of_layer = other.
m_is_end_of_layer
;
m_deposition_active = other.
m_deposition_active
;
m_extruder_speed = other.
m_extruder_speed
;
return
*
this
;
}
void
GcodeCommand::setDepositionActive
(
bool
deposition_active) {
m_deposition_active = deposition_active;
}
bool
GcodeCommand::getDepositionActive
()
const
{
return
m_deposition_active;
}
void
GcodeCommand::setExtruderSpeed
(
double
extruder_speed) {
m_extruder_speed = extruder_speed;
}
const
double
&
GcodeCommand::getExtruderSpeed
()
const
{
return
m_extruder_speed;
}
}
//
namespace ORNL
Back
|
FazBrowse Home
|
New Git URL