23 template<
typename Vec>
42 operator bool()
const {
return valid(); }
77 static void parseFrame_(
const std::string_view& frame, std::vector<Command> & outCommands );
78 void applyCommand_(
const Command& command );
79 void applyCommandG_(
const Command& command );
80 MoveAction generateMoveAction_();
81 MoveAction generateReturnToHomeAction_();
82 void resetTemporaryStates_();
87 MoveAction moveLine_(
const Vector3f& newPoint,
const Vector3f& newAngles );
89 MoveAction moveArc_(
const Vector3f& newPoint,
const Vector3f& newAngles,
bool clockwise );
92 void updateWorkPlane_( WorkPlane wp );
95 void updateScaling_();
100 BaseAction2f getArcPoints2_(
const Vector2f& beginPoint,
const Vector2f& endPoint,
bool clockwise );
102 BaseAction3f getArcPoints3_(
const Vector3f& center,
const Vector3f& beginPoint,
const Vector3f& endPoint,
bool clockwise );
106 BaseAction3f getArcPoints3_(
float r,
const Vector3f& beginPoint,
const Vector3f& endPoint,
bool clockwise );
109 MoveAction getToolRotationPoints_(
const Vector3f& newRotationAngles );
111 Vector3f calcNewTranslationPos_();
112 Vector3f calcNewRotationAngles_();
113 Vector3f calcRealCoord_(
const Vector3f& translationPos,
const Vector3f& rotationAngles );
114 void updateRotationAngleAndMatrix_(
const Vector3f& rotationAngles );
115 Vector3f calcRealCoordCached_(
const Vector3f& translationPos,
const Vector3f& rotationAngles );
116 Vector3f calcRealCoordCached_(
const Vector3f& translationPos );
137 CoordType coordType_ = CoordType::Movement;
138 MoveMode moveMode_ = MoveMode::Idle;
139 WorkPlane workPlane_ = WorkPlane::xy;
140 Matrix3f toWorkPlaneXf_;
141 Vector3f translationPos_;
142 Vector3f rotationAngles_;
143 bool absoluteCoordinates_ =
true;
144 Vector3f scaling_ = Vector3f::diagonal( 1.f );
145 bool inches_ =
false;
146 float feedrate_ = 100.f;
147 float feedrateMax_ = 0.f;
150 std::array<Matrix3f, 3> cacheRotationMatrix_;
153 Vector3f inputCoords_;
155 std::optional<float> radius_;
156 std::optional<Vector3f> arcCenter_;
157 Vector3f inputRotation_;
160 std::vector<std::string_view> gcodeSource_;
163 float accuracy_ = 1.e-3f;
164 CNCMachineSettings cncSettings_;
165 std::vector<int> rotationAxesOrderMap_ = {0, 1, 2};
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
class with CNC machine emulation settings
Definition MRCNCMachineSettings.h:19
class to process g-code source and generate toolpath
Definition MRGcodeProcessor.h:20
BaseAction< Vector2f > BaseAction2f
Definition MRGcodeProcessor.h:31
float feedrate
Definition MRGcodeProcessor.h:39
std::vector< std::string > GcodeSource
Definition MRMeshFwd.h:684
std::vector< MoveAction > processSource()
process all lines g-code source and generate corresponding move actions
void setCNCMachineSettings(const CNCMachineSettings &settings)
settings
bool idle
tool direction for each point from action.path
Definition MRGcodeProcessor.h:38
std::vector< Vector2f > path
Definition MRGcodeProcessor.h:27
const CNCMachineSettings & getCNCMachineSettings()
Definition MRGcodeProcessor.h:66
std::vector< Vector3f > toolDirection
Definition MRGcodeProcessor.h:37
MRMESH_CLASS Vector3b
Definition MRMeshFwd.h:219
float value
in lowercase
Definition MRGcodeProcessor.h:57
BaseAction< Vector3f > BaseAction3f
Definition MRGcodeProcessor.h:32
std::string warning
Definition MRGcodeProcessor.h:29
bool valid() const
return true if operation was parsed without warnings
Definition MRGcodeProcessor.h:41
void setGcodeSource(const GcodeSource &gcodeSource)
set g-code source
void reset()
reset internal states
char key
Definition MRGcodeProcessor.h:56
MoveAction processLine(const std::string_view &line, std::vector< Command > &externalStorage)
BaseAction3f action
Definition MRGcodeProcessor.h:36
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRGcodeProcessor.h:25
Definition MRGcodeProcessor.h:55
structure that stores information about the movement of the tool, specified by some string of command...
Definition MRGcodeProcessor.h:35