/* drawing (DXF) to G-code (NGC) converter
* Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
*/
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include "cmdparser.h"
#include "drawing.h"
#include "filename.h"
#include "gcode.h"
#include "settings.h"
/**
* @brief process cmd command
* @param[in] strm stream to read command arguments from
* @return if processing command was successful
*/
bool CmdParser::procCmd_cmd(std::istream &strm)
{
// skip whitespace and use rest of line as custom command
strm >> std::ws;
std::string cmd;
getline(strm, cmd);
// add custom command to G-code
mGCode.appendCustom(cmd);
return true;
}
/**
* @brief process cut command
* @param[in] strm stream to read command arguments from
* @return if processing command was successful
*/
bool CmdParser::procCmd_cut(std::istream &strm)
{
// get arguments
std::string layerName;
strm >> layerName;
if (strm.fail()) {
std::cerr << "missing layer name" << std::endl;
return false;
}
// get layer
Drawing::Layers::const_iterator layer = mDrawing.mLayers.find(layerName);