Robota Softwarehouse B.V.
  Home Company Products Projects Developers Contact Search  

Plotter slowdown routines for Roland DXY plotters

One day I got a Roland plotter and wanted to change it into a CNC machine. I couldn't find a program to make my Roland DXY plotter move slowly so I wrote this little hack. The 'program' creates a microstep file from a roland dxy plotter file. A microstep file makes the plotter move extremely slow so you can use it for CNC purpose. I posted the source somewhere on the internet but kept receiving emails from people asking me for an executable version. Well, nearly 2 years later ... here it is...

How does it work?



The program simply calculates all steps in between, for example let's say the plotter is at 10, 10, and the file says: line to coordinate 20,20 normally the plotter will move to coordinate 20,20 with the speed selected. However, on most plotters the minimum speed selected is still to fast to use the plotter for anything else then drawing. This application will generate all steps in between so the plotter file says:

line to 11,11 line to 12,12 ... line to 20,20

This trick makes the plotter file move extremely slow.

How do I get it?



Click on one of the following links to download the application.

Download executable for Windows.

Download source code for Visual Studio 6 zip archive. (You might need to install the MFC dll for older windows systems).

Download ANSI C library source (PlotterCNClib.cpp) to compile under any platform

Download ANSI C library header (PlotterCNClib.h) to compile under any platform

What does it cost?

Nothing. Absolutely nothing. This application is free. The application is released under the GNU public license. You are allowed to change and distribute this application freely. However, you may not sell the application or use it to promote other services or use it in any commercial matter without my consent.


I do not guaranty anything, you use the program at your own risk.  If you have any suggestions or questions let me know. Please keep in mind this was just a few minute hack.

Below the library source to have a look:

// PlotterCNC.cpp
//
// HOW TO MAKE YOUR ROLAND DXY PLOTTER MOVE VERY VERY VERY VERY SLOW
//
// SUBMITTED BY
// Arne Diegenbach
// CARLABS AUTOMOTIVE LABORATORIES / WWW.CARLABS.NET
//
// WHAT IS THIS?
// This little application converts a Roland DXY file to Roland microstep DXY file
// 
// WHAT IS THIS FOR?
// Normally if your plotter needs to move from let's say [10,10] to [14,10]
// it will move in the selected velocity speed (VS).
// If you want to use your plotter as a CNC machine (I use it for engraving)
// you want it to move very slow and constant.
//
// HOW DOES IT WORK?
// It changes every vector to a multiple microstep vectors. So [10,10] to [14,10]
// becomes [10,10] to [11,10] to [12,10] to [13,10] to [14,10].
// In this way your plotter moves with constant speed and very very very slow.
//
// HOW TO USE?
// Use the nornal Roland driver to print to a file
// Change the path below to point to the path, compile and run
// Temporarily change the COM/LPT port of the Roland driver to point to a non existing
// port.
// Start Hyperterm, check if the communication with your plotter works by typing OI
// Now choose 'Send text file' and select the file generated by this program.
//
// FOR WHAT PLOTTER DOES IT WORK?
// Although this program was made for the Roland DXY 1300 plotter, you might
// use it for every plotter in that series or adapt it to your plotter.
//
// IF YOU HAVE ANY PROBLEMS OR QUESTIONS LET ME KNOW.
//
// This program is made with plain vanilla ansi c. It 'should' compile on nearly
// every c-compiler/platform.
// Mail me if you want to have an executable version.
//
// Yes, you can donate your plotter, money, pizza.
//
// arne _AT_ carlabs.net
//
// This is a 15 minutes try and play program.
//
//
// COPYRIGHT
// This program is published under the GNU public license.
// You may not remove this header and commercial use is not allowed
// without my expressed written permission. You can distribute this file.
// 
// Have fun! Send me some (pictures) of your results.
// Download from: http://www.robota.nl/cnc/
//
// CHANGE HISTORY
// 2003-11			ARNE	Initial build
#include "stdafx.h"	// ms specific header, remove otherwise
#include <string>


int cnc_microstep(const char* infile, const char* outfile)
{
	FILE *f = fopen(infile, "r");
	if (f == 0)
		return -1;
	unlink(outfile);
	FILE *of = fopen(outfile, "w");
	if (of == NULL) {
		fclose(f);
		return -2;
	}
	int c;
	char b[512], bb[100];
	char *p = b, *pp = bb;
	int x,y,lx=0,ly=0,dx,dy;
	while ((c = fgetc(f)) != EOF) {
		if (c == ';') {
			*p++ = c;
			*p++ = 0;
			if (memcmp(b, "PD", 2) == 0 || memcmp(b, "PU", 2) == 0) {
				p = b+2;
				pp = bb;
				while (*p != ',')
					*pp++ = *p++;
				*pp = 0;
				x = atoi(bb);
				pp = bb;
				while (*++p != ';')
					*pp++ = *p;
				*pp = 0;
				y = atoi(bb);
				
				if (lx && b[1] == 'D') {
					dx = x - lx; dx = dx < 0 ? -dx : dx;
					dy = y - ly; dy = dy < 0 ? -dy : dy;
					if (dx > 1 || dy > 1) {
						int max = dx > dy ? dx : dy;
						if (max > 0) {
							double deltax = (double)(x - lx) / (double)max;
							double deltay = (double)(y - ly) / (double)max;
							double xp = lx + deltax;
							double yp = ly + deltay;
							while (--max) {
								fprintf(of, "PD%d,%d;\n", (long)xp, (long)yp);
	//							fprintf(of, "PD%d,%d; **** CHECK\n", (long)xp,(long)yp);
								xp += deltax;
								yp += deltay;
							}
						}
					}
				}


				lx = x;
				ly = y;
			}
			fprintf(of, "%s\n", b);
			p = b;
			*p = 0;
		}
		else *p++ = c;
	}
	fclose(of);
	fclose(f);
	return 0;
}

Tags

General conditions (pdf) - Algemene voorwaarden (pdf) - Algemene voorwaarden (html)
Copyright 2005 Robota Softwarehouse B.V.. All rights reserved.

Robota Softwarehouse B.V. - Weth. Driessenstr. 71 - 1107XH - Amsterdam - The Netherlands - KvK 53227115
Email: info@robota.nl - Website: http://www.robota.nl - Telephone: +31203631747 - Tailor-made software since 1990