possible to controll ISEL EP1090 with EMC2

More
15 Mar 2011 10:25 #7847 by goaran
Hello,

i have a old ISEL EP1090 which i want to use as a 3d printer. Datasheet see here
www.micompan.de/uploads/media/EP1090_-_EP1090-4.pdf
Therefor i cant use the default software which is closed source ;(

Does anyone know if it is possible to controll that machine with EMC2 ?
The machine has some internal cnc software which needs some nc-code (not normal g-code) to run.
I dont want to take it apart because it still works. so the easyest way would be if there is a possibility to talk over the rs232 to it by emc or to somehow get the dir/step signals to the stepper-controllers

thanks in advance

Please Log in or Create an account to join the conversation.

More
15 Mar 2011 12:41 #7850 by andypugh
It probably uses HPGL. It is somewhat tricky to go from EMC2 to HPGL.

In theory you could create a HAL component that takes the X and Y position commands and inputs and puts them together into a HPGL command to send to the serial port.

Sounds like fun :-)

I have used a HPGL printer for 3-D printing, in my case I used some GNU Octave ( www.gnu.org/software/octave/ ) code to slice up the STL files into outlines, to be cut out of sticky paper with a vinyl cutter: I have attached the code below in case it is useful. It ran on my Mac, using a USB to serial convertor.
filename = '/Users/andy2/Documents/work/Front Right v10t.stl'

z = input('Start position (-Inf for beginning)')

iter = 3;

% set up plotter

a = system ('stty -f /dev/cu.usbserial0 evenp cstopb 9600 ...
                       -crtscts -mdmbuf clocal cread')

f = 0; p = 0; pagenumber = 1;

eps_scale = 72/25.4 % conversion from mm to points
plot_scale = 40 % conversion from mm to RD-GL
thickness = 0.59/7 % thickness of layers
pagewidth = 260; % paper size
pageheight = 190;

[F V C] = stl_read(filename);

X = [V(F(:,1),1) V(F(:,2),1) V(F(:,3),1)]; % X coords for each face
Y = [V(F(:,1),2) V(F(:,2),2) V(F(:,3),2)]; %Y
Z = [V(F(:,1),3) V(F(:,2),3) V(F(:,3),3)]; %Z

T = Z; %quick and dirty rotation
Z = X;
X = T;

clear T

% find extents

zmin= min(Z(:))
zmax = max(Z(:))

page_x = pagewidth; page_y = pageheight+10; % force file initialisation
old_ymin = 0;

%for z = zmin:thickness:zmax
for z = max(z, zmin):thickness:zmax

       disp(z)

       I1 = find(sum((Z>z),2) == 1); % Index of faces with 1 vertex greater than z
       I2 = find(sum((Z>z),2) == 2); % index of faces with 2 > z

       C = [];

       for a = 1:length(I1)
               [zs i] = sort(Z(I1(a),:)) ;% put biggest Z last, and store order
               xs = X(I1(a),i);
               ys = Y(I1(a),i);

               x1 = xs(1)+(xs(3)-xs(1))*(z-zs(1))/(zs(3)-zs(1));
               x2 = xs(2)+(xs(3)-xs(2))*(z-zs(2))/(zs(3)-zs(2));

               y1 = ys(1)+(ys(3)-ys(1))*(z-zs(1))/(zs(3)-zs(1));
               y2 = ys(2)+(ys(3)-ys(2))*(z-zs(2))/(zs(3)-zs(2));

               C = [C; x1 y1 x2 y2];

       end

       for a = 1:length(I2)

               [zs i] = sort(Z(I2(a),:)) ;% put biggest Z last, and store order
               xs = X(I2(a),i);
               ys = Y(I2(a),i);

               x1 = xs(2)+(xs(1)-xs(2))*(z-zs(2))/(zs(1)-zs(2));
               x2 = xs(3)+(xs(1)-xs(3))*(z-zs(3))/(zs(1)-zs(3));

               y1 = ys(2)+(ys(1)-ys(2))*(z-zs(2))/(zs(1)-zs(2));
               y2 = ys(3)+(ys(1)-ys(3))*(z-zs(3))/(zs(1)-zs(3));

               C = [C; x1 y1 x2 y2];


       end

       xmax = max(max(C(:,[1 3])));
       xmin = min(min(C(:,[1 3])));
       ymax = max(max(C(:,[2 4])));
       ymin = min(min(C(:,[2 4])));

       pstr = '';

       if (xmax-xmin > pagewidth | ymax-ymin > pageheight)
               clc();
               disp("Page not large enough for object")
               stop
       endif

       if (page_x + xmax - xmin) > pagewidth % not enough room on page
               page_x = 0;
               page_y = page_y + old_ymin;
               old_ymin = 0;
       endif

       if (page_y + ymax - ymin > pageheight) % top of page reached

               if (f ~= 0) % file already open
                       fprintf(f, 'stroke\n');
                       fprintf(f, '%%%%EOF\n');
                       fclose(f);
%                       fprintf(p, "SP 0;");
                       clc();
                       disp("change paper and press any key")
                       fflush(stdout);
                       k = kbhit();
%                       fprintf(p, "SP 1;")

               endif

               if (p ~= 0) % have a plotfile
                       fclose(p)

               endif


               page_y = 0 ; page_x = 0;

               stroke = '';

               f = fopen(['/Users/andy2/Documents/gash' num2str(z) '.eps'], 'wt');

               fprintf(f, '%%!PS-Adobe-3.0 EPSF-3.0\n')
               fprintf(f, '%%%%BoundingBox: %0.2f %0.2f %0.2f %0.2f\n', ...
                       0, 0, (pagewidth)*eps_scale, (pageheight)*eps_scale)
               fprintf(f, '0.75 setlinewidth\n')
               pfilename = sprintf('/Users/andy2/Documents/work/plotfile%02.0f.hpgl',
pagenumber);
               pagenumber = pagenumber + 1;

               p = fopen('/dev/cu.usbserial0', 'w+');
               msg = fcntl (f, F_SETFL, O_NONBLOCK)
               fprintf(p,'%c.R', 27); % Turn on hardware handshaking
               fprintf(p,'%c.M 100;13;;13;10;0:', 27);
               fprintf(p, "IN;");
%               fprintf(p, 'SP 1;');
               fprintf(p, 'VS 6;');
               fflush(p);


               clg
               hold on
               plot([0 ;pagewidth; pagewidth; 0; 0], [0; 0; pageheight; pageheight;
0;], 'r');

               legend("off")


       endif

       plot([page_x; page_x+xmax-xmin; page_x+xmax-xmin; page_x; page_x],
[page_y; page_y; page_y+ymax-ymin; page_y+ymax-ymin; page_y], 'b');


       %Try to string line segments together into loops.

       g = 1:length(C); % use this vector to store indices to the currently
unassigned segments

       lastx = 0 ; lasty = 0;

       pstr = '';

       while (any(g))

                       % find closest point in either start or end sets

                       if length(g) > 1
                               [dist gi] = min(abs(C(g,[1 3])-lastx)+abs(C(g,[2 4])-lasty));
                       else
                               gi = 1;
                       end

                               %find which column of the located row the min dist was in and call it ti
                               [dist ti] = min(dist);
                               gi = gi(ti);

                       if dist > 0.05 % not at or very close to the last point

                               if pstr ~= ''
                                       %Plot the previous loop iter times
                                       pstri = [find(pstr == ';') length(pstr)];
                                       fprintf(p,(pstr(1:pstri(1)))); % move to start of loop
                                       for i = 1:iter
                                               for a = 1:10:length(pstri)

                                                       fprintf(p,(pstr(pstri(a):(pstri(min(a+10,length(pstri)))))));

                                                       do
                                                               fprintf(p, "%c.B\n", 27);
                                                               usleep(30000);
                                                               buff = fgets(p,4);
                                                               fclear(p)
                                                       until str2num(buff) > 1000

                                               end
                                       end
                               end

                               pstr = '' % start a new loop

                               fprintf(f, '%s', stroke)
                               fprintf(f, '%0.2f %0.2f moveto\n', ...
                                       (C(g(gi), [1 3](ti)) - xmin + page_x)*eps_scale, ...
                                       (C(g(gi), [2 4](ti)) - ymin + page_y)*eps_scale);
                               fprintf(f, '%0.2f %0.2f lineto\n', ...
                                       (C(g(gi), [3 1](ti)) - xmin + page_x)*eps_scale, ...
                                       (C(g(gi), [4 2](ti)) - ymin + page_y)*eps_scale);

                               pstr = sprintf('PU %0.2f, %0.2f;PD %0.2f, %0.2f;', ...
                                       ((C(g(gi), [1 3](ti)) - xmin + page_x)*plot_scale), ...
                                       ((C(g(gi), [2 4](ti)) - ymin + page_y)*plot_scale), ...
                                       ((C(g(gi),[3 1](ti)) - xmin + page_x)*plot_scale), ...
                                       ((C(g(gi),[4 2](ti)) - ymin + page_y)*plot_scale));


%                               plot([C(g(gi), [1 3](ti)) C(g(gi), [3 1](ti))] - xmin + page_x , ...
%                                       [C(g(gi), [2 4](ti)) C(g(gi), [4 2](ti))] - ymin + page_y, 'b');

                               lastx = C(g(gi),[3 1](ti)) ; lasty = C(g(gi), [4 2](ti));
                               stroke = 'stroke\n'; % done this way to suppress spurious one

                       else % Actually at previous point

                               fprintf(f, '%0.2f %0.2f lineto\n', ...
                                       (C(g(gi), [3 1](ti)) - xmin + page_x)*eps_scale, (C(g(gi), ...
                                       [4 2](ti)) - ymin + page_y)*eps_scale);

                               pstr = strcat( pstr, sprintf( 'PD %0.2f, %0.2f;', ...
                                       (C(g(gi), [3 1](ti)) - xmin + page_x)*plot_scale, (C(g(gi), ...
                                       [4 2](ti)) - ymin + page_y)*plot_scale));



%                               plot([lastx C(g(gi), [3 1](ti))] - xmin + page_x, ...
%                                       [lasty C(g(gi), [4 2](ti))] - ymin + page_y, 'b')

                               lastx = C(g(gi),[3 1](ti)) ; lasty = C(g(gi), [4 2](ti));
                       endif

                       g = [g(1:gi-1) g(gi+1:end)]; % remove used index from list

       endwhile

       if pstr ~= ''
               %Plot the lasr loop of the slice iter times
               pstri = [find(pstr == ';') length(pstr)];
               fprintf(p,(pstr(1:pstri(1)))); % move to start of loop
               for i = 1:iter
                       for a = 1:10:length(pstri)

                               fprintf(p,(pstr(pstri(a):(pstri(min(a+10,length(pstri)))))));

                               do
                                       fprintf(p, "%c.B\n", 27);
                                       usleep(30000);
                                       buff = fgets(p,4);
                                       fclear(p)
                               until str2num(buff) > 1000

                       end
               end
       end


       fprintf(p, 'PU;');
       fflush(p)

       pstr = ''

       page_x = page_x + (xmax - xmin)*1.04;

       old_ymin = max(old_ymin , (ymax - ymin) * 1.04);

end

fprintf(f, '%s', stroke)
fprintf(f, '%%%%EOF\n')

fclose(f)
fclose(p)

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.067 seconds
Powered by Kunena Forum