robocut1.0.11/ 0000755 0001750 0001750 00000000000 13156345750 012571 5 ustar markus markus robocut1.0.11/examples/ 0000755 0001750 0001750 00000000000 13156345750 014407 5 ustar markus markus robocut1.0.11/examples/legal_reg-marks_h310.svg 0000644 0001750 0001750 00000020025 13156345750 020716 0 ustar markus markus
robocut1.0.11/examples/letter_reg-marks.svg 0000644 0001750 0001750 00000017725 13156345750 020413 0 ustar markus markus
robocut1.0.11/examples/a4_reg-marks_h260.svg 0000644 0001750 0001750 00000020052 13156345750 020142 0 ustar markus markus
robocut1.0.11/Plotter.h 0000755 0001750 0001750 00000005427 13156345750 014406 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
#include
#include "Common.h"
using namespace std;
#include "CuttingThread.h"
// Perform the cut. Returns error state. Note that this just sends the data, it has no way of knowing whether it really
// worked and there is no easy way to cancel it.
//
// media: The type of media. I'm not sure what this effects, see CuttingDialog.cpp/ui for values. 300 is "custom".
// The value is not fully checked for sanity.
// speed: Cutting speed: 1-10 inclusive.
// pressure: Cutting pressure: 1-33 inclusive.
// trackenhancing: Supposed to feed/unfeed the media a few times to create tracks.
// regmark: Whether to use registration marks for calibration.
// regsearch: ?
// regwidth/height: Distance between the registration marks.
//
// TODO: Apparently you can change the number of registration marks?
Error Cut(CutParams p);
const int VENDOR_ID_GRAPHTEC = 0x0b4d;
const int PRODUCT_ID_CC200_20 = 0x110a;
const int PRODUCT_ID_CC300_20 = 0x111a;
const int PRODUCT_ID_SILHOUETTE_SD_1 = 0x111c;
const int PRODUCT_ID_SILHOUETTE_SD_2 = 0x111d;
const int PRODUCT_ID_SILHOUETTE_CAMEO = 0x1121;
const int PRODUCT_ID_SILHOUETTE_PORTRAIT = 0x1123;
struct cutter_id
{
string msg;
int usb_vendor_id;
int usb_product_id;
};
struct cutter_id *Identify();
robocut1.0.11/PathPaintEngine.h 0000644 0001750 0001750 00000004670 13156345750 015767 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
#include
#include
#include "PathPaintPage.h"
// This is a simple paint engine that records all the paths painted.
// It is used with QSvgPainter to record the paths in an SVG.
// The only device it can draw to is PathPaintDevice
class PathPaintEngine : public QPaintEngine
{
public:
PathPaintEngine(QPaintDevice* pdev);
bool begin(QPaintDevice* pdev);
void drawPath(const QPainterPath& path);
void drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr);
void drawPolygon(const QPointF* points, int pointCount, PolygonDrawMode mode);
bool end();
Type type() const;
void updateState(const QPaintEngineState& state);
private:
PathPaintDevice* dev;
QTransform transform;
QVector dashPattern;
bool isCosmetic;
qreal getDistance(const QPointF &p1, const QPointF &p2);
QPointF getPointAtLenght(const QPointF &p1, const QPointF &p2, qreal &l1);
};
robocut1.0.11/NoCopy.h 0000755 0001750 0001750 00000003174 13156345750 014161 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
class NoCopy
{
public:
NoCopy() { }
~NoCopy() { }
private:
NoCopy(const NoCopy&) = delete;
const NoCopy& operator=(const NoCopy&) = delete;
};
#define NOCOPY NoCopy nocopyvar
robocut1.0.11/CuttingThread.cpp 0000644 0001750 0001750 00000003512 13156345750 016043 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "CuttingThread.h"
#include "Plotter.h"
CuttingThread::CuttingThread(QObject *parent) :
QThread(parent)
{
}
void CuttingThread::setParams(const CutParams& p)
{
params = p;
}
void CuttingThread::run()
{
Error e = Cut(params);
if (e)
emit success();
else
emit error(e.message().c_str());
exec();
}
robocut1.0.11/CuttingDialog.ui 0000644 0001750 0001750 00000003035 13156345750 015666 0 ustar markus markus
CuttingDialog0029568Cutting...CuttingQt::HorizontalQDialogButtonBox::CancelbuttonBoxaccepted()CuttingDialogaccept()248254157274buttonBoxrejected()CuttingDialogreject()316260286274
robocut1.0.11/Common.h 0000755 0001750 0001750 00000006324 13156345750 014202 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
/// Result Class
#include
#include
#include
#include
#include
using std::vector;
using std::string;
typedef string::size_type stringpos;
/// Error Handling
class Error
{
public:
explicit Error(bool S) : s(S) { }
explicit Error(const char* C) : s(false), m(C) { }
Error(const string& msg) : s(false), m(msg) { }
operator bool() { return s; } // TODO: Use bool hack from boost so int i = Error(); doesn't work.
string message() { if (m.empty()) return "Unspecified Error"; return m; }
private:
bool s;
string m;
};
const Error Success(true);
const Error Failure(false);
// Integer to string.
inline string ItoS(int I)
{
std::stringstream S;
S << I;
return S.str();
}
// Unsigned integer to string.
inline string UItoS(unsigned int I)
{
std::stringstream S;
S << I;
return S.str();
}
// Unsigned long long to string.
inline string ULLtoS(unsigned long long I)
{
char out[128];
sprintf(out, "%lld", I);
return out;
}
// String to integer, returns Fail on fail.
inline int StoI(const string& S, int Fail = 0)
{
char* EP;
const char* P = S.c_str();
int R = strtol(P, &EP, 0);
if (EP == P)
return Fail;
return R;
}
// String to unsigned integer, returns Fail on fail.
inline unsigned int StoUI(const string& S, unsigned int Fail = 0)
{
char* EP;
const char* P = S.c_str();
int R = strtoul(P, &EP, 0);
if (EP == P)
return Fail;
return R;
}
// String to unsigned integer, returns Fail on fail.
inline unsigned int StoULL(const string& S, unsigned long long Fail = 0)
{
char* EP;
const char* P = S.c_str();
int R = strtoull(P, &EP, 0);
if (EP == P)
return Fail;
return R;
}
// Get an environmental variable.
inline string GetEnv(const string& Var)
{
char* V = getenv(Var.c_str());
if (!V)
return "";
return V;
}
robocut1.0.11/changelog 0000644 0001750 0001750 00000005155 13156345750 014451 0 ustar markus markus 1.0.11
* Windows and OSX binaries released for first time
* Add in-tree libusb for Windows. Not the best practice but it is only two files.
* Added Transform_Silhouette_Cameo() to rotate the plot as SVG onscreen. Allow left aligned paper. Cameo has high x-coordinates to the left, although the head homes at the left side.
* Added File->Reload (CTRL-L), this saves a lot of clicking and scrolling through the file dialogue while adjusting the design.
* Added View->Identify to print the devices seen to stdout. This option is temporarily hidden in the menu (via the .ui file) until it does something user-visible.
* Refactored UsbOpen() / UsbInit() from Plotter.cpp:Cut().
* Added to about message and tooltip. Removed debug page dump on stdout;
* robocut.spec added, as used in https://build.opensuse.org/package/show?package=robocut&project=home:jnweiger
* Move all information to Readme.md rather than spreading it out over multiple files.
* Maybe very slightly better icon? It's still pretty rubbish! Contributions welcome!
* Change links to point to http://robocut.org/
* Code style fixes
* Mouse zoom is the "standard" way now.
* Mouse zooms to the cursor.
* QT5 support
1.0.10
* Fixed missing image files.
1.0.9
* Add USB ID 111A for CC300-20 Craft Robo Lite as another default.
1.0.8
* changes in Robocut.pro for qmake so no QT files are shipped (Debian requirement)
1.0.7
* Add USB ID 111C as another default.
1.0.6
* Tim fixed drawing bug
* changed from float to int for output to plotter, fixes crash of 2nd
gen plotter model
* changed display pen size to 0
* Tim fixed track enhancing option was inverted.
1.0.5
* adding all the changes needed for Debian
* fixed watch file
* make binary lower case
* removed redundant copyright form the copyright file
* recreated all the images so we have the copyright
* added vcs information to control file
* merged mentor in to master
1.0.4
* add .desktop file for Ubuntu
* default needs to be 10 for pressure
* get menu working
* better sample reg file
1.0.3
* manpage
* command line interface
* mouse wheel zoom
* change the draw command to move command if the cut is on the outer edge,
kind of clipping (but not in preview)
* dash pattern from path
* sort the different paths to cut faster
* bounding box option to cut inside path first (good for letters)
* registration mark support
1.0.2
* Initial Release on Ubuntu.
Master
* Some brief documentation
* Initial registration mark support
* Load page size from file
* Small UI improvements
Version 0.2 - a3b13ad - Oct 24th 2010
* Initial working version.
robocut1.0.11/PathPaintPage.cpp 0000644 0001750 0001750 00000007230 13156345750 015764 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "PathPaintPage.h"
#include "PathPaintEngine.h"
#include
uint qHash(const QPolygonF& key)
{
QByteArray repr;
for (int i = 0; i < key.size(); ++i)
{
double x = key[i].x();
double y = key[i].y();
repr.append(reinterpret_cast(&x), sizeof(x));
repr.append(reinterpret_cast(&y), sizeof(y));
}
return qHash(repr);
}
PathPaintDevice::PathPaintDevice(double widthInMm, double heightInMm, double pixelsPerMm)
{
engine = NULL;
width = widthInMm;
height = heightInMm;
pathsClipped = false;
ppm = pixelsPerMm;
if (ppm == 0.0)
ppm = 1.0;
}
PathPaintDevice::~PathPaintDevice()
{
if (engine)
delete engine;
}
void PathPaintDevice::addPath(const QPolygonF& path)
{
if (pagePathSet.contains(path))
return;
pagePathSet.insert(path);
pagePaths.append(path);
// Clip the path.
for (int j = 0; j < pagePaths.back().size(); ++j)
{
// pagePaths are in mm, so convert from pixels to mm.
pagePaths.back()[j] /= ppm;
if (pagePaths.back()[j].x() < 0.0)
{
pathsClipped = true;
pagePaths.back()[j].setX(0.0);
}
if (pagePaths.back()[j].y() < 0.0)
{
pathsClipped = true;
pagePaths.back()[j].setY(0.0);
}
if (pagePaths.back()[j].x() > width)
{
pathsClipped = true;
pagePaths.back()[j].setX(width);
}
if (pagePaths.back()[j].y() > height)
{
pathsClipped = true;
pagePaths.back()[j].setY(height);
}
}
}
QPaintEngine* PathPaintDevice::paintEngine() const
{
if (!engine)
engine = new PathPaintEngine(const_cast(this));
return engine;
}
QList PathPaintDevice::paths()
{
return pagePaths;
}
int PathPaintDevice::metric(PaintDeviceMetric metric) const
{
switch (metric)
{
// Width in pixels.
case PdmWidth:
return width * ppm;
case PdmHeight:
return height * ppm;
case PdmWidthMM:
return width;
case PdmHeightMM:
return height;
case PdmNumColors:
return 2;
case PdmDepth:
return 1;
case PdmDpiX:
return 25.4 * ppm; // Convert to inches.
case PdmDpiY:
return 25.4 * ppm;
case PdmPhysicalDpiX:
return 25.4 * ppm;
case PdmPhysicalDpiY:
return 25.4 * ppm;
}
return 0;
}
bool PathPaintDevice::clipped() const
{
return pathsClipped;
}
robocut1.0.11/ProgramOptions.cpp 0000644 0001750 0001750 00000036214 13156345750 016266 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "ProgramOptions.h"
#include
#include
#include
#include
#include
using namespace std;
ProgramOptions::ProgramOptions ( )
{
initAttributes();
}
ProgramOptions::~ProgramOptions ( )
{
}
ProgramOptions& ProgramOptions::Instance()
{
static ProgramOptions instance;
return instance;
}
void ProgramOptions::setSortPath ( int new_var )
{
sortPath = new_var;
}
int ProgramOptions::getSortPath ( )
{
return sortPath;
}
void ProgramOptions::setStartCut ( int new_var )
{
startCut = new_var;
}
int ProgramOptions::getStartCut ( )
{
return startCut;
}
void ProgramOptions::setFileName ( QString new_var )
{
fileName = new_var;
}
QString ProgramOptions::getFileName ( )
{
return fileName;
}
void ProgramOptions::setTspSortPath ( int new_var )
{
tspSortPath = new_var;
}
int ProgramOptions::getTspSortPath ( )
{
return tspSortPath;
}
void ProgramOptions::setMedia ( int new_var )
{
if (new_var<0) new_var = 0;
if (new_var>25) new_var = 25;
media = new_var;
}
int ProgramOptions::getMedia ( )
{
return media;
}
void ProgramOptions::setSpeed ( int new_var )
{
speed = new_var;
}
int ProgramOptions::getSpeed ( )
{
return speed;
}
void ProgramOptions::setPressure ( int new_var )
{
pressure = new_var;
}
int ProgramOptions::getPressure ( )
{
return pressure;
}
void ProgramOptions::setRegMarkAuto ( int new_var )
{
regMarkAuto = new_var;
}
int ProgramOptions::getRegMarkAuto ( )
{
return regMarkAuto;
}
void ProgramOptions::setRegMark ( int new_var )
{
regMark = new_var;
}
int ProgramOptions::getRegMark ( )
{
return regMark;
}
void ProgramOptions::setRegDimensionWidth ( int new_var )
{
regDimensionWidth = new_var;
}
int ProgramOptions::getRegDimensionWidth ( )
{
return lroundl(regDimensionWidth);
}
void ProgramOptions::setRegDimensionHeight ( int new_var )
{
regDimensionHeight = new_var;
}
int ProgramOptions::getRegDimensionHeight ( )
{
return lroundl(regDimensionHeight);
}
void ProgramOptions::setRegOriginWidth ( int new_var )
{
regOriginWidth = new_var;
}
int ProgramOptions::getRegOriginWidth ( )
{
return lroundl(regOriginWidth);
}
void ProgramOptions::setRegOriginHeight ( int new_var )
{
regOriginHeight = new_var;
}
int ProgramOptions::getRegOriginHeight ( )
{
return lroundl(regOriginHeight);
}
void ProgramOptions::setRegDimensionWidthMM ( double new_var )
{
regDimensionWidth = new_var*20;
}
double ProgramOptions::getRegDimensionWidthMM ( )
{
return regDimensionWidth/20;
}
void ProgramOptions::setRegDimensionHeightMM ( double new_var )
{
regDimensionHeight = new_var*20;
}
double ProgramOptions::getRegDimensionHeightMM ( )
{
return regDimensionHeight/20;
}
void ProgramOptions::setRegOriginWidthMM ( double new_var )
{
regOriginWidth = new_var*20;
}
double ProgramOptions::getRegOriginWidthMM ( )
{
return regOriginWidth/20;
}
void ProgramOptions::setRegOriginHeightMM ( double new_var )
{
regOriginHeight = new_var*20;
}
double ProgramOptions::getRegOriginHeightMM ( )
{
return regOriginHeight/20;
}
void ProgramOptions::setVersion ( QString new_var )
{
version = new_var;
}
QString ProgramOptions::getVersion ( )
{
return version;
}
void ProgramOptions::setVendorUSB_ID ( int new_var )
{
vendorUSB_ID = new_var;
}
int ProgramOptions::getVendorUSB_ID ( )
{
return vendorUSB_ID;
}
void ProgramOptions::setProductUSB_ID ( int new_var )
{
productUSB_ID = new_var;
}
int ProgramOptions::getProductUSB_ID ( )
{
return productUSB_ID;
}
void ProgramOptions::setMarginTop ( int new_var )
{
marginTop = new_var;
}
int ProgramOptions::getMarginTop ( )
{
return lroundl(marginTop);
}
void ProgramOptions::setMarginRight ( int new_var )
{
marginRight = new_var;
}
int ProgramOptions::getMarginRight ( )
{
return lroundl(marginRight);
}
void ProgramOptions::setMarginTopMM ( double new_var )
{
marginTop = new_var*20;
}
double ProgramOptions::getMarginTopMM ( )
{
return marginTop/20;
}
void ProgramOptions::setMarginRightMM ( double new_var )
{
marginRight = new_var*20;
}
double ProgramOptions::getMarginRightMM ( )
{
return marginRight/20;
}
void ProgramOptions::setTrackEnhancing ( int new_var )
{
trackEnhancing = new_var;
}
int ProgramOptions::getTrackEnhancing ( )
{
return trackEnhancing;
}
int ProgramOptions::GetOpt (int argc, char *argv[] )
{
static int version_flag = 0, help_flag = 0, show_flag = 0;
int index, option_index = 0;
int c = 0;
const char shortopts[] = "stg:p:ra:b:c:d:";
static struct option longopts[] =
{
{"help", no_argument, &help_flag, 1},
{"version", no_argument, &version_flag, 1},
{"show", no_argument, &show_flag, 1},
{"no-sort", no_argument, 0, 's'},
{"bb-sort", no_argument, 0, 't'},
{"cut", no_argument, 0, 'l'},
{"media", required_argument, 0, 'm'},
{"speed", required_argument, 0, 'g'},
{"pressure", required_argument, 0, 'p'},
{"track-enhancing", no_argument, 0, 'n'},
{"margin-top", required_argument, 0, 'o'},
{"margin-right", required_argument, 0, 'q'},
{"reg-mark-auto", no_argument, 0, 'r'},
{"reg-mark", no_argument, 0, 'h'},
{"reg-dimension-width", required_argument, 0, 'a'},
{"reg-dimension-height", required_argument, 0, 'b'},
{"reg-origin-width", required_argument, 0, 'c'},
{"reg-origin-height", required_argument, 0, 'd'},
{"usb-vendor-id", required_argument, 0, 'e'},
{"usb-product-id", required_argument, 0, 'f'},
{0, 0, 0, 0}
};
opterr = 0;
while ((c = getopt_long(argc, argv, shortopts, longopts, &option_index)) != -1)
{
switch (c)
{
case 0:
/* If this option set a flag, do nothing else now. */
if (longopts[option_index].flag != 0) break;
//cout << longopts[option_index].name << endl;
break;
case 's':
setSortPath(true);
break;
case 't':
setTspSortPath(true);
break;
case 'l':
setStartCut(true);
break;
case 'm':
setMedia(atoi(optarg));
break;
case 'g':
setSpeed(atoi(optarg));
break;
case 'p':
setPressure(atoi(optarg));
break;
case 'n':
setTrackEnhancing(true);
break;
case 'o':
setMarginTopMM(atof(optarg));
break;
case 'q':
setMarginRightMM(atof(optarg));
break;
case 'r':
setRegMarkAuto(true);
break;
case 'h':
setRegMark(true);
break;
case 'a':
setRegDimensionWidthMM(atof(optarg));
break;
case 'b':
setRegDimensionHeightMM(atof(optarg));
break;
case 'c':
setRegOriginWidthMM(atof(optarg));
break;
case 'd':
setRegOriginHeightMM(atof(optarg));
break;
case 'e':
setVendorUSB_ID(atoi(optarg));
break;
case 'f':
setProductUSB_ID(atoi(optarg));
break;
case '?':
if (optopt == 'f')
cerr << "Option -"<< optopt <<" requires an argument." << endl;
else if (isprint (optopt))
cerr << "Unknown option `-"<< (char)optopt <<"'." << endl;
else
cerr << "Unknown option character ASCII code "<< optopt <<"." << endl;
exit(0);
default:
abort();
}
}
for (index = optind; index < argc; index++)
{
//cout << "Non-option argument " << argv[index] <<"'." << endl;
fileName = argv[optind]; // take the first non arg as file
continue;
}
if(show_flag)
{
showShow();
exit(0);
}
if(help_flag)
{
showHelp();
exit(0);
}
if(version_flag)
{
showVersion();
exit(0);
}
return 0;
}
void ProgramOptions::showHelp ( )
{
// "<------------------------------------------------------------------------------>"
cout << "The `Robocut' program plots or cuts SVG files on a Craft Robo or Silhouette SD" << endl;
cout << "or most likely any other customer grade Graphtec cutting plotter." << endl << endl;
cout << "Usage:" << endl;
cout << " robocut [OPTIONS...] [File]" << endl << endl;
// "<------------------------------------------------------------------------------>"
cout << "Help Options:" << endl;
cout << " --help Show summary of options." << endl;
cout << " --version Show version information and copyright details." << endl;
cout << " --show Show all the parameters entered and the defaults." << endl << endl;
// "<------------------------------------------------------------------------------>"
cout << "Application Options:" << endl;
cout << " -s, --no-sort Stop sort the objects from the SVG before plotting." << endl;
cout << " -t, --bb-sort Sort the objects by bounding box, good for letters." << endl;
cout << " This will cut out the inside first and than the" << endl;
cout << " outside." << endl;
cout << " --cut Shows the cutting dialogue after start." << endl;
cout << " --media INT Select the media. See drop down box." << endl;
cout << " -g, --speed INT The speed between 1 and 33." << endl;
cout << " -p, --pressure INT The pressure between 1 and 10." << endl;
cout << " --track-enhancing Move three times back and forward to create a" << endl;
cout << " track." << endl;
cout << " --margin-top DOUBLE Define the margin on top in mm." << endl;
cout << " --margin-right DOUBLE Define the margin right in mm." << endl << endl;
// "<------------------------------------------------------------------------------>"
cout << "Registration Mark Options:" << endl;
cout << " -r, --reg-mark-auto Use registration marks and find the marks" << endl;
cout << " automatically." << endl;
cout << " --reg-mark Use registration marks but set the knife manually" << endl;
cout << " on top the round mark." << endl;
cout << " -a, --reg-dimension-width DOUBLE" << endl;
cout << " Specify the length in mm between the the two" << endl;
cout << " horizontal marks." << endl;
cout << " -b, --reg-dimension-height DOUBLE" << endl;
cout << " Specify the length in mm between the the two" << endl;
cout << " vertical marks." << endl;
cout << " -c, --reg-origin-width DOUBLE" << endl;
cout << " Specify the length in mm between the the edge of" << endl;
cout << " the paper and the first horizontal mark." << endl;
cout << " -d, --reg-origin-height DOUBLE" << endl;
cout << " Specify the length in mm between the the edge of" << endl;
cout << " the paper and the first vertical mark." << endl << endl;
// "<------------------------------------------------------------------------------>"
cout << "Device Options:" << endl;
cout << " --usb-vendor-id INT Try this program with other usb hardware on" << endl;
cout << " your own risk. You need to convert hex to dec." << endl;
cout << " --usb-product-id INT May also work with other hardware, try" << endl;
cout << " usb-devices program to scan your computer." << endl;
cout << "Report bugs to https://bugs.launchpad.net/robocut/+filebug." << endl;
// "<------------------------------------------------------------------------------>"
}
void ProgramOptions::showVersion ( )
{
cout << (version.toStdString()); // see main.cpp
cout << "\n\nCopyright (C) 2015\n";
cout << "This is free software; see the source for copying conditions. There is NO\n";
cout << "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n";
cout << "Written by Tim Hutt and Markus Schulz \n";
}
void ProgramOptions::showShow ( )
{
cout << "Application Options:\n";
cout << " -s, --no-sort "<< getSortPath() << endl;
cout << " -t, --bb-sort "<< getTspSortPath() << endl;
cout << " --cut "<< getStartCut() << endl;
cout << " --media "<< getMedia() << endl;
cout << " -g, --speed "<< getSpeed() << endl;
cout << " -p, --pressure "<< getPressure() << endl;
cout << " --track-enhancing "<< getTrackEnhancing() << endl;
cout << " --margin-top "<< getMarginTopMM() << " / " << getMarginTop() << endl;
cout << " --margin-right "<< getMarginRightMM() << " / " << getMarginRight() << endl;
cout << " -r, --reg-mark-auto "<< getRegMarkAuto() << endl;
cout << " --reg-mark "<< getRegMark() << endl;
cout << " -a, --reg-dimension-width "<< getRegDimensionWidthMM() << " / " << getRegDimensionWidth() << endl;
cout << " -b, --reg-dimension-height "<< getRegDimensionHeightMM() << " / " << getRegDimensionHeight() << endl;
cout << " -c, --reg-origin-width "<< getRegOriginWidthMM() << " / " << getRegOriginWidth() << endl;
cout << " -d, --reg-origin-height "<< getRegOriginHeightMM() << " / " << getRegOriginHeight() << endl;
cout << " --usb-vendor-id "<< getVendorUSB_ID() << endl;
cout << " --usb-product-id "<< getProductUSB_ID() << endl;
cout << "[File] "<< getFileName().toStdString() << endl;
}
void ProgramOptions::initAttributes ( ) {
sortPath = false;
tspSortPath = false; // used for BBox
startCut = false;
fileName = "";
media = 2;
speed = 10;
pressure = 10;
regMarkAuto = false;
regMark = false;
setRegDimensionWidthMM(180.0);
setRegDimensionHeightMM(240.0);
setRegOriginWidthMM(15.0);
setRegOriginHeightMM(10.0);
vendorUSB_ID = 0x0b4d;
productUSB_ID = 0x111d;
setMarginTop(500);
setMarginRight(320);
trackEnhancing = false;
}
robocut1.0.11/Robocut.pro 0000644 0001750 0001750 00000005476 13156345750 014744 0 ustar markus markus # -------------------------------------------------
# Project created by QtCreator 2010-10-03T18:21:30
# -------------------------------------------------
TARGET = robocut
VERSION = 1.0.11
TEMPLATE = app
INSTALLS += icon \
target
target.path = /usr/bin
icon.files += ./images/robocut.xpm
icon.path = /usr/share/pixmaps/
SOURCES += main.cpp \
MainWindow.cpp \
Plotter.cpp \
Common.cpp \
PathPaintEngine.cpp \
CutDialog.cpp \
CuttingDialog.cpp \
CuttingThread.cpp \
PathPaintPage.cpp \
PathSorter.cpp \
ProgramOptions.cpp
HEADERS += MainWindow.h \
Plotter.h \
NoCopy.h \
Common.h \
PathPaintEngine.h \
CutDialog.h \
CuttingDialog.h \
CuttingThread.h \
PathPaintPage.h \
PathSorter.h \
ProgramOptions.h
FORMS += MainWindow.ui \
CutDialog.ui \
CuttingDialog.ui
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS)
QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS)
QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
DEFINES += ROBOCUT_VERSION=\\\"$$VERSION\\\"
unix:LIBS += -lusb-1.0
win32:LIBS += $$_PRO_FILE_PWD_/libusb-windows/libusb-1.0.a
win32:INCLUDEPATH += $$_PRO_FILE_PWD_/libusb-windows
QT += svg
RESOURCES += \
resources.qrc
DISTFILES += \
readme.txt \
install.txt \
changelog \
images/cap-blue.png \
images/cap-pen.png \
images/cap-red.png \
images/cap-yellow.png \
images/icon.png \
images/robocut.xpm \
images/cap.xcf \
images/pen.xcf \
examples/a4_reg-marks_h260.svg \
examples/legal_reg-marks_h310.svg \
examples/letter_reg-marks.svg \
robocut.spec \
Readme.md
# Instructions for Windows release:
# In Qt Creator, go to Projects->Run
# Add->Deployment configuration
# Rename->"Create Windows Release"
# Add Deploy Step->Custom Process Step
#
# Command: C:\Qt\5.4\mingw491_32\bin\windeployqt.exe
# Argument: --dir Robocut --compiler-runtime robocut.exe
# Working dir: %{buildDir}/%{CurrentBuild:Type}
#
# Add another process step:
#
# Command: C:\Windows\System32\xcopy.exe
# Argument: /Y robocut.exe Robocut
# Working dir: %{buildDir}/%{CurrentBuild:Type}
#
# Select that deployment method and run the program. You should be given a directory with all the required files in
# it. Before you zip and upload it, exit Qt creator and rename c:\Qt to c:\Qt2. Re-run it to verify that it works
# without the Qt SDK installed.
#
# Note that there is a minor flaw in this deployment method - if you later update your Qt SDK it will find the updated
# DLLs in c:\Qt *before* it finds the local Qt DLLs and won't run properly. The solution is to add a qt.conf
# file, but that makes development more of a faff. Anyway, Qt Windows deployment is a big mess.
robocut1.0.11/PathPaintEngine.cpp 0000644 0001750 0001750 00000013271 13156345750 016317 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "PathPaintEngine.h"
#include
#include
PathPaintEngine::PathPaintEngine(QPaintDevice* pdev)
: QPaintEngine(AllFeatures)
{
dev = dynamic_cast(pdev);
if (!dev)
qWarning("PathPaintEngine: unsupported target device.");
}
bool PathPaintEngine::begin(QPaintDevice* pdev)
{
dev = dynamic_cast(pdev);
if (!dev)
qWarning("PathPaintEngine: unsupported target device.");
// TODO: setActive?
return true;
}
bool approximatelyEqual(qreal a, qreal b, qreal epsilon)
{
return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool essentiallyEqual(qreal a, qreal b, qreal epsilon)
{
return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool definitelyGreaterThan(qreal a, qreal b, qreal epsilon)
{
return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool definitelyLessThan(qreal a, qreal b, qreal epsilon)
{
return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
void PathPaintEngine::drawPath(const QPainterPath& path)
{
if (!dev)
return;
if(!isCosmetic)
{
QList polys = path.toSubpathPolygons();
for (int i = 0; i < polys.size(); ++i)
{
if(dashPattern.empty()) dev->addPath(transform.map(polys[i]));
else
{
QPolygonF polytemp = transform.map(polys[i]), newpoly;
int dashtoggle = 1, dashi=0, j = 0;
qreal actualdashsize = dashPattern[dashi];
QPointF origin = QPointF(polytemp[j]), testp;
j++;
do
{
newpoly = QPolygonF();
newpoly.append(origin);
do
{
testp = polytemp[j];
origin = QPointF(getPointAtLenght(QPointF(origin), polytemp[j], actualdashsize));
if (essentiallyEqual(origin.x(), polytemp[j].x(), 0.01 ) && approximatelyEqual(origin.y(), polytemp[j].y(),0.01) && j+1 < polytemp.size())
{
origin = polytemp[j];
int tempz = polytemp.size();
j++;
testp = polytemp[j];
}
newpoly.append(origin);
}while(definitelyGreaterThan(actualdashsize,0.0,0.1) && testp!=origin);
if(dashtoggle == 1)
{
dev->addPath(newpoly);
}
dashtoggle = dashtoggle * -1;
dashi++;
if(dashi >= dashPattern.size()) dashi=0;
actualdashsize = dashPattern[dashi];
}while(!essentiallyEqual(origin.x(), polytemp[j].x(), 0.001 ) || !essentiallyEqual(origin.y(), polytemp[j].y(),0.001));
}
}
}
}
void PathPaintEngine::drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr)
{
// Nop.
}
void PathPaintEngine::drawPolygon(const QPointF* points, int pointCount, PolygonDrawMode mode)
{
if (!dev)
return;
QPolygonF p;
for (int i = 0; i < pointCount; ++i)
p.append(points[i]);
dev->addPath(transform.map(p));
}
bool PathPaintEngine::end()
{
if (!dev)
return false;
return true;
}
QPaintEngine::Type PathPaintEngine::type() const
{
return QPaintEngine::User;
}
void PathPaintEngine::updateState(const QPaintEngineState& state)
{
if (state.state() & DirtyTransform)
transform = state.transform();
dashPattern = state.pen().dashPattern();
isCosmetic = state.pen().isCosmetic();
}
qreal PathPaintEngine::getDistance(const QPointF &p1, const QPointF &p2)
{
qreal testx1 = p1.x();
qreal testy1 = p1.y();
qreal testx2 = p2.x();
qreal testy2 = p2.y();
qreal a = 0.0;
qreal b = 0.0;
double c = 0.0;
if(testx1 >= testx2) a = testx1 - testx2;
else a = testx2 - testx1;
if(testy1 >= testy2) b = testy1 - testy2;
else b = testy2 - testy1;
c = sqrt((double)(a*a+b*b));
return (qreal) c;
}
QPointF PathPaintEngine::getPointAtLenght(const QPointF &p1, const QPointF &p2, qreal &l1)
{
qreal testx1 = p1.x();
qreal testy1 = p1.y();
qreal testx2 = p2.x();
qreal testy2 = p2.y();
qreal lenghtp1p2 = getDistance(p1,p2);
qreal lenghtdash = l1;
l1 = lenghtp1p2 - lenghtdash;
if (definitelyLessThan(lenghtp1p2, lenghtdash, 0.01))
{
l1 = lenghtdash - lenghtp1p2;
return p2;
}
if (definitelyGreaterThan(lenghtdash, lenghtp1p2, 0.01))
{
l1 = lenghtdash - lenghtp1p2;
return p1;
}
l1 = 0;
qreal factor = lenghtp1p2/lenghtdash;
qreal a = testx1-testx2;
qreal b = testy1-testy2;
qreal aa = a/factor;
qreal bb = b/factor;
QPointF ret = QPointF(testx1-aa,testy1-bb);
return ret;
}
robocut1.0.11/CutDialog.ui 0000644 0001750 0001750 00000042022 13156345750 015003 0 ustar markus markus
CutDialog00482340CutRobocutMedia:Card without Craft Paper Backing:/images/cap-yellow.png:/images/cap-yellow.pngCard with Craft Paper Backing:/images/cap-yellow.png:/images/cap-yellow.pngVinyl Sticker:/images/cap-blue.png:/images/cap-blue.pngFilm Labels:/images/cap-blue.png:/images/cap-blue.pngThick Media:/images/cap-yellow.png:/images/cap-yellow.pngThin Media:/images/cap-blue.png:/images/cap-blue.pngPen:/images/cap-pen.png:/images/cap-pen.pngBond Paper 13-28 lbs:/images/cap-blue.png:/images/cap-blue.pngBristol Paper 57-67 lbs:/images/cap-yellow.png:/images/cap-yellow.pngCardstock 40-60 lbs:/images/cap-yellow.png:/images/cap-yellow.pngCover 40-60 lbs:/images/cap-yellow.png:/images/cap-yellow.pngFilm, Double Matte Translucent:/images/cap-blue.png:/images/cap-blue.pngFilm, Vinyl With Adhesive Back:/images/cap-blue.png:/images/cap-blue.pngFilm, Window With Kling Adhesive:/images/cap-blue.png:/images/cap-blue.pngIndex 90 lbs:/images/cap-red.png:/images/cap-red.pngInkjet Photo Paper 28-44 lbs:/images/cap-yellow.png:/images/cap-yellow.pngInkjet Photo Paper 45-75 lbs:/images/cap-red.png:/images/cap-red.pngMagnetic Sheet:/images/cap-red.png:/images/cap-red.pngOffset 24-60 lbs:/images/cap-blue.png:/images/cap-blue.pngPrint Paper Light Weight:/images/cap-blue.png:/images/cap-blue.pngPrint Paper Medium Weight:/images/cap-yellow.png:/images/cap-yellow.pngSticker Sheet:/images/cap-blue.png:/images/cap-blue.pngTag 100 lbs:/images/cap-red.png:/images/cap-red.pngText Paper 24-70 lbs:/images/cap-blue.png:/images/cap-blue.pngVellum Bristol 57-67 lbs:/images/cap-yellow.png:/images/cap-yellow.pngWriting Paper 24-70 lbs:/images/cap-blue.png:/images/cap-blue.pngSpeed:1102Qt::HorizontalPressure:1332Qt::HorizontalTrack Enhancing110133Registration Marks (Experimental!)truefalseSearch Registration MarkstrueDimensions (width × height):001880 mm300.000000000000000180.000000000000000×001880 mm1000.000000000000000240.000000000000000Qt::Vertical200Qt::HorizontalQDialogButtonBox::Cancel|QDialogButtonBox::OkbuttonBoxaccepted()CutDialogaccept()257156157274buttonBoxrejected()CutDialogreject()325156286274mediaCombocurrentIndexChanged(int)CutDialogonMediaChanged(int)1232944105speedSlidervalueChanged(int)speedSpinBoxsetValue(int)2468143481speedSpinBoxvalueChanged(int)speedSlidersetValue(int)4348124681pressureSlidervalueChanged(int)pressureSpinBoxsetValue(int)246116434116pressureSpinBoxvalueChanged(int)pressureSlidersetValue(int)434116246116onMediaChanged(int)
robocut1.0.11/CuttingDialog.h 0000644 0001750 0001750 00000004727 13156345750 015511 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
#include "CuttingThread.h"
namespace Ui {
class CuttingDialog;
}
// This is the dialog that shows while the cut is progressing. The thread that does the cutting
// is also owned by the dialog, in a slightly bad design.
class CuttingDialog : public QDialog
{
Q_OBJECT
public:
explicit CuttingDialog(QWidget *parent = 0);
~CuttingDialog();
// Start the cutting thread. Call this only once, before the dialog is shown.
// It creates the thread, passes it the cutting details, and runs it.
void startCut(const CutParams& params);
protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent* e);
private:
Ui::CuttingDialog *ui;
// The cutting thread. It is pretty basic - just one long run() routine and then it calls onSuccess() or
// onError().
CuttingThread* thread;
private slots:
// These are called from the thread when it has finished. Only one is called.
void onSuccess();
void onError(QString message);
};
robocut1.0.11/CutDialog.h 0000644 0001750 0001750 00000005047 13156345750 014623 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
namespace Ui {
class CutDialog;
}
// This dialog asks the user what settings to use for cutting.
class CutDialog : public QDialog
{
Q_OBJECT
public:
explicit CutDialog(QWidget *parent = 0);
~CutDialog();
// The media code. See CutDialog.ui for a list.
int media() const;
// The speed (1-10).
int speed() const;
// The cutting pressure (1-33).
int pressure() const;
// Track enhancing. This is when the cutter rolls the media backwards and forwards
// a few times before cutting in order to indent it with tracks where the rollors are.
// The idea is that it will slip less after that is done.
bool trackEnhancing() const;
// Whether to search.
bool regMark() const;
bool regSearch() const;
// Positions of the registration marks.
double regWidth() const;
double regHeight() const;
protected:
void changeEvent(QEvent *e);
private slots:
// When they change the media selection, update the default speed and pressure.
void onMediaChanged(int idx);
private:
Ui::CutDialog *ui;
};
robocut1.0.11/CutDialog.cpp 0000644 0001750 0001750 00000007655 13156345750 015165 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "CutDialog.h"
#include "ui_CutDialog.h"
#include "ProgramOptions.h"
CutDialog::CutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CutDialog)
{
ui->setupUi(this);
ui->mediaCombo->setCurrentIndex(ProgramOptions::Instance().getMedia());
ui->speedSlider->setValue(ProgramOptions::Instance().getSpeed());
ui->pressureSlider->setValue(ProgramOptions::Instance().getPressure());
ui->trackEnhancingCheckbox->setChecked(ProgramOptions::Instance().getTrackEnhancing());
if(ProgramOptions::Instance().getRegMark())
{
ui->regMarksGroup->setChecked(true);
ui->regSearchCheckbox->setChecked(false);
}
if(ProgramOptions::Instance().getRegMarkAuto())
{
ui->regMarksGroup->setChecked(true);
ui->regSearchCheckbox->setChecked(true);
}
ui->regWidthSpinner->setValue(ProgramOptions::Instance().getRegDimensionWidthMM());
ui->regHeightSpinner->setValue(ProgramOptions::Instance().getRegDimensionHeightMM());
}
CutDialog::~CutDialog()
{
delete ui;
}
void CutDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
int CutDialog::media() const
{
int idx = ui->mediaCombo->currentIndex();
// Media code for each entry.
int medias[] = {
100, 101, 102, 106, 111, 112, 113, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138
};
if (idx < 0 || idx >= 26)
idx = 0;
return medias[idx];
}
int CutDialog::speed() const
{
return ui->speedSlider->value();
}
int CutDialog::pressure() const
{
return ui->pressureSlider->value();
}
bool CutDialog::trackEnhancing() const
{
return ui->trackEnhancingCheckbox->isChecked();
}
bool CutDialog::regMark() const
{
return ui->regMarksGroup->isChecked();
}
bool CutDialog::regSearch() const
{
return ui->regSearchCheckbox->isChecked();
}
double CutDialog::regWidth() const
{
return ui->regWidthSpinner->value();
}
double CutDialog::regHeight() const
{
return ui->regHeightSpinner->value();
}
void CutDialog::onMediaChanged(int idx)
{
if (idx < 0 || idx >= 26)
idx = 0;
// Pressure for each entry.
int pressures[] = {
27, 27, 10, 14, 27, 2, 10, 30, 30, 30, 30, 1, 1,
1, 30, 20, 27, 30, 30, 5, 25, 20, 20, 30, 30, 30
};
// Default speed is max except for magnetic sheet.
int newspeed = idx == 17 ? 3 : 10;
int newpressure = pressures[idx];
ui->speedSlider->setValue(newspeed);
ui->pressureSlider->setValue(newpressure);
}
robocut1.0.11/MainWindow.h 0000644 0001750 0001750 00000006235 13156345750 015024 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
#include
#include
#include
#include "CutDialog.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
// The cutting paths that were loaded from the SVG.
QList paths;
// For displaying the cuts.
QGraphicsScene* scene;
// The dialog that asks what settings to use. We keep this around and reuse it as necessary.
CutDialog* cutDialog;
// The directory that the last file was opened from.
QString lastOpenDir;
// Timer for the cutting animation.
QTimer* animationTimer;
// The circle that marks where the cutter blade is.
QGraphicsItem* cutMarker;
// Cut marker progress.
int cutMarkerPath; // Current path.
int cutMarkerLine; // Current line in path
double cutMarkerDistance; // Current distance along edge.
QSizeF mediaSize;
QString filename;
public:
int sortFlag;
int tspFlag;
int cutFlag;
char *fileValue;
private slots:
void on_actionZoom_Out_triggered();
void on_actionZoom_In_triggered();
void on_actionReset_triggered();
void on_actionAnimate_toggled(bool animate);
void on_actionManual_triggered();
void on_actionCut_triggered();
void on_actionExit_triggered();
void on_actionAbout_triggered();
void on_actionOpen_triggered();
void on_actionReload_triggered();
void on_actionIdentify_triggered();
// Advance the cutting animation frame.
void animate();
private:
// Use empty string to indicate no file is loaded.
void setFileLoaded(QString filename);
bool eventFilter(QObject *o, QEvent *e);
void loadFile();
};
robocut1.0.11/resources.qrc 0000644 0001750 0001750 00000000402 13156345750 015306 0 ustar markus markus images/cap-blue.pngimages/cap-pen.pngimages/cap-red.pngimages/cap-yellow.pngimages/icon.png
robocut1.0.11/MainWindow.ui 0000644 0001750 0001750 00000011705 13156345750 015210 0 ustar markus markus
MainWindow00823753Robocut:/images/icon.png:/images/icon.pngQPainter::Antialiasing|QPainter::TextAntialiasingQGraphicsView::ScrollHandDragQGraphicsView::AnchorUnderMouse0082321FileHelpViewAboutManual (Online)F1OpenCtrl+OfalseCutCtrl+PExitCtrl+QtruefalseAnimateAnimate -- Simulate movement onscreenCtrl+AfalseResetCtrl+RfalseZoom In+falseZoom Out-falseReloadReload the current SVG fileCtrl+LIdentify devicesIdentify connected PlotterCtrl+Ifalse
robocut1.0.11/Common.cpp 0000644 0001750 0001750 00000002715 13156345750 014532 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "Common.h"
robocut1.0.11/ProgramOptions.h 0000644 0001750 0001750 00000007541 13156345750 015734 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include
class ProgramOptions
{
private:
ProgramOptions ( );
ProgramOptions(const ProgramOptions &);
ProgramOptions & operator=(const ProgramOptions &);
virtual ~ProgramOptions ( );
public:
// Singleton
static ProgramOptions& Instance();
private:
int sortPath;
int startCut;
QString fileName;
int tspSortPath;
int media;
int speed;
int pressure;
int regMarkAuto;
int regMark;
double regDimensionWidth;
double regDimensionHeight;
double regOriginWidth;
double regOriginHeight;
QString version;
int vendorUSB_ID;
int productUSB_ID;
double marginTop;
double marginRight;
int trackEnhancing;
public:
void setSortPath ( int new_var );
int getSortPath ( );
void setStartCut ( int new_var );
int getStartCut ( );
void setFileName ( QString new_var );
QString getFileName ( );
void setTspSortPath ( int new_var );
int getTspSortPath ( );
void setMedia ( int new_var );
int getMedia ( );
void setSpeed ( int new_var );
int getSpeed ( );
void setPressure ( int new_var );
int getPressure ( );
void setRegMarkAuto ( int new_var );
int getRegMarkAuto ( );
void setRegMark ( int new_var );
int getRegMark ( );
void setRegDimensionWidth ( int new_var );
int getRegDimensionWidth ( );
void setRegDimensionHeight ( int new_var );
int getRegDimensionHeight ( );
void setRegOriginWidth ( int new_var );
int getRegOriginWidth ( );
void setRegOriginHeight ( int new_var );
int getRegOriginHeight ( );
void setRegDimensionWidthMM ( double new_var );
double getRegDimensionWidthMM ( );
void setRegDimensionHeightMM ( double new_var );
double getRegDimensionHeightMM ( );
void setRegOriginWidthMM ( double new_var );
double getRegOriginWidthMM ( );
void setRegOriginHeightMM ( double new_var );
double getRegOriginHeightMM ( );
void setVersion ( QString new_var );
QString getVersion ( );
void setVendorUSB_ID ( int new_var );
int getVendorUSB_ID ( );
void setProductUSB_ID ( int new_var );
int getProductUSB_ID ( );
void setMarginTop ( int new_var );
int getMarginTop ( );
void setMarginRight ( int new_var );
int getMarginRight ( );
void setMarginTopMM ( double new_var );
double getMarginTopMM ( );
void setMarginRightMM ( double new_var );
double getMarginRightMM ( );
void setTrackEnhancing ( int new_var );
int getTrackEnhancing ( );
private:
void showHelp ( );
void showVersion ( );
void showShow ( );
void initAttributes ( ) ;
public:
int GetOpt (int argc, char *argv[] );
};
robocut1.0.11/PathPaintPage.h 0000644 0001750 0001750 00000005267 13156345750 015441 0 ustar markus markus /***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt *
* Copyright (C) 2010 Markus Schulz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
// TODO: Rename this file to PathPaintDevice.h
#include
#include
#include
#include
class PathPaintEngine;
// Needed for QSet. Simply concatenates all the coordinates in a QByteArray and hashes that.
uint qHash(const QPolygonF& key);
class PathPaintDevice : public QPaintDevice
{
public:
PathPaintDevice(double widthInMm, double heightInMm, double pixelsPerMm = 90.0/25.4);
~PathPaintDevice();
// Adds a path to the device.
// Also automatically ignores duplicate paths, which QSvgPainter creates (I guess for the fill and stroke).
// Paths are clipped (horribly) to the page. And if any are clipped, clipped() returns true.
void addPath(const QPolygonF& path);
// Get a list of paths.
QList paths();
// Returns true if any paths had to be clipped.
bool clipped() const;
QPaintEngine* paintEngine() const;
protected:
int metric(PaintDeviceMetric metric) const;
private:
mutable PathPaintEngine* engine;
// The paths added.
QList pagePaths;
// Set of paths, so we can detect duplicates.
QSet pagePathSet;
bool pathsClipped;
double width;
double height;
double ppm;
};
robocut1.0.11/install.txt 0000644 0001750 0001750 00000001327 13156345750 015003 0 ustar markus markus INSTALLATION
^^^^^^^^^^^^
sudo apt-get install libqt4-dev libusb-1.0-0-dev git-core
# Go to home directory (or wherever you want to install it)
cd ~
# Get the latest source code (if you don't already have it)
git clone git://gitorious.org/robocut/robocut.git
# Go into the source code directory.
cd robocut
# Build the project.
qmake
make
# At this point the executable is built, and you can just link to it if you like, or you can install it
# system-wide like this:
sudo cp Robocut /usr/local/bin
# Then create a link in your menu to /usr/local/bin/Robocut (not capital R)
# Finally remember to make sure you are in the lp group:
adduser lp
# You will probably have to log out and log in again after that.
robocut1.0.11/images/ 0000755 0001750 0001750 00000000000 13156345750 014036 5 ustar markus markus robocut1.0.11/images/icon.png 0000644 0001750 0001750 00000001645 13156345750 015502 0 ustar markus markus PNG
IHDR @ @ iq gAMA a pHYs *K tEXtSoftware Paint.NET v3.5.100r !IDATx^KTQc3SAPZئE/ZXPm[
EТ0@I"h@ ##"\iNǙn^P};(97>2E"a0ˑ͊7ordL_'pȃYWqןW,~y40ގkfOsҸGsu)W_O_}O ,k(. . . . .qqqpu\@\@\yiaWw_4i31W;q3iC<ܷoC ,h<94H`裫h=B~d`CA >d`CA >d`CA >d`CA >d`CA >d`CA >d`CA >d`CA >d`CA >d`ZMCyE^`i`bޜk7*RiOJ:թTS9e*Viʕ?,PTk5*1wZڿ%TN.Fw]?oP7a{`å?0Z@Js|Wz{`CM,uZ{-olF.]|CY&m>|#ֳf0/ m_~xӖ;a_d>n6^?g=P?Biaq- IENDB` robocut1.0.11/images/cap-pen.png 0000644 0001750 0001750 00000001357 13156345750 016075 0 ustar markus markus PNG
IHDR @ @ iq sRGB bKGD pHYs tIME>: tEXtComment This drawing is:
Copyright 2010 Markus Schulz
and is licensed under the GPL version 3w IDATx9,DADK\jPjB\5vN\$JGei^?V76ےWx1p\<?q/i^owrm~Ϻm<``m {;Pe:~
/Nf4|> ,`%bx0@B2Vf_*~T1͢Rio{?$qk_ߔfQh?K̆P"iI7@4x@
Hw+(1J,1VoPb<`F݈*
v5ශBidK̜P'
^埮Ʋ>_W sI_/^C%jx\(EpU_Xb2aHƟbXZІHaM%Ǫ#K:6`tpVL ˤ
n6 x IENDB` robocut1.0.11/images/cap-red.png 0000644 0001750 0001750 00000001210 13156345750 016051 0 ustar markus markus PNG
IHDR @ @ iq sRGB bKGD pHYs tIME; tEXtComment This drawing is:
Copyright 2010 Markus Schulz
and is licensed under the GPL version 3w }IDATxX10XExGAI#((yD@S(ie+"R w1#ȓ] ݳk`G`.^sJr9OK8--bT)}[@TAAS
Y`~nP[Y~~y4 C PÒ_d,60*)@m4XK,@]-,@'LV+p N'`n_ #-;b ˑ,1ҍȲ@AV@4R=xO1 8RX0O焾ﻏW@CrYje}ꍘ&Të`0 )so IENDB` robocut1.0.11/images/robocut.xpm 0000644 0001750 0001750 00000004262 13156345750 016245 0 ustar markus markus /* XPM */
static char * robocut_xpm[] = {
"32 32 68 1",
" c None",
". c #3D4083",
"+ c #ECEDF2",
"@ c #525590",
"# c #E0E1EC",
"$ c #606299",
"% c #CBCBDD",
"& c #777AA8",
"* c #444788",
"= c #1B206F",
"- c #121769",
"; c #E7E8F0",
"> c #2D327A",
", c #DADBE7",
"' c #3C4083",
") c #BFC0D6",
"! c #595D96",
"~ c #1D2270",
"{ c #14196A",
"] c #E8E8F0",
"^ c #2F347C",
"/ c #DADBE8",
"( c #3E4285",
"_ c #C0C1D7",
": c #5B5E97",
"< c #E9EAF1",
"[ c #30347C",
"} c #DCDCE8",
"| c #3F4385",
"1 c #C1C2D7",
"2 c #5C6098",
"3 c #1A1F6E",
"4 c #797BAA",
"5 c #1E2371",
"6 c #7679A9",
"7 c #252975",
"8 c #686B9F",
"9 c #30357C",
"0 c #1C2170",
"a c #000000",
"b c #323232",
"c c #333333",
"d c #2E2C27",
"e c #2E2C28",
"f c #302F2D",
"g c #343434",
"h c #7096E0",
"i c #648EDE",
"j c #638EDE",
"k c #5685D3",
"l c #4E7FD0",
"m c #FB000C",
"n c #FA000C",
"o c #FC010C",
"p c #5282D1",
"q c #FB000B",
"r c #FC000B",
"s c #4889DB",
"t c #F8000C",
"u c #F9000B",
"v c #FB010C",
"w c #FF0000",
"x c #FA0C18",
"y c #FE000B",
"z c #FE010C",
"A c #FC000C",
"B c #F8000A",
"C c #FC0611",
" ",
" ",
" .+@#$%&******* ",
" =-;>,')!======== ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{]^/(_:~~~~~~~~ ",
" ~{<[}|12~~~~~~~~ ",
" ~3456789~~~~~~~~ ",
" ~~~~0~~~~~~~~~~~ ",
" ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" aaaaaaaaaaa ",
" bbbcdeefbg ",
" hij ",
" kll mno ",
" pl oqmnr ",
" s tuv ",
" wxyzABC ",
" z "};
robocut1.0.11/images/pen.xcf 0000644 0001750 0001750 00000002200 13156345750 015314 0 ustar markus markus gimp xcf file @ @ BB G
gimp-comment Created with GIMP gimp-image-grid (style solid)
(fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000))
(bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000))
(xspacing 10.000000)
(yspacing 10.000000)
(spacing-unit inches)
(xoffset 0.000000)
(yoffset 0.000000)
(offset-unit inches)
@ @
New Layer
\ @ @ p @ @ ; : J 8 ; 5 % 3 e 1 c / <
# -
+ ) WH &