Further Refinements Improving Output of my Sovol SO-1 Plotter and some Generative Art with Point.py


I will share some additional insights to improve plotting.   I have some experience with hobby cnc milling with a mpcnc I built.  When milling, I get better results with using a shorter tool and with bringing the workpiece closer to to the tool tip.  To translate this to pen plotting, that would mean having less of the pen tip protruding from my pen holder and lifting my plotting surface to be closer to the pen.  This also makes sense if you think about how you hold a pen, you generally hold it near the pen tip end because that gives you better control than if you held it at the midpoint or some other arbitrary position.  I bought a box of 12 inch glass mirror tiles that I use with my 3d printer, so I have several extras at hand.  I am using three 12 inch glass mirror tiles from a big box store stacked on top of each other set on an MDF platform as a flat surface to elevate my writing surface for my Sovol SO-1 plotter.  I am using 3m blue painter's tape to hold the paper to the mirror.

I experimented with the juicy-gcode parameters I am using with the pen lifting and cut down on the dwelling time with the G4 commands and cut out some of the servo angle steps on the toolon, below is my latest juicy-gcode flavor text:

gcode

{

   begin = "M280P0S30;G90;G21;G28 X Y;G1 F1000;M201 X1000 Y1000 Z1000 E1000;M204 P1000.00 R1000.00 T1000.00;M205 S0.00 T0.00 B20000 X5.00 Y5.00 Z0.40 E.500"

   end = "G4 P50; M280P0S30;G1 X0 Y0"

   toolon =  "M280P0S29;G4 P1;M280P0S28;G4 P1;M280P0S27;G4 P1;M280P0S26;G4 P1;M280P0S25;G4 P1;M280P0S24;G4 P1;M280P0S20"

   tooloff = "G4 P1;M280P0S30;G4 P1"

}

        

I created a simple python program point.py that takes a starting image raster file, and it randomly chooses a pixel, if the pixel rgb parameter is above a certain threshold, it draws a box of within a size range and outputs the results in an svg file (so it can be plotted).  For fun, I took a screenshot of the sovol logo  as the starting image.  

Starting with the sovol logo:


Using the following program point.py I created:


# point.py created by Kevin Lease in 2021 licensed under a Creative Commons

# Attribution-NonCommercial-ShareAlike 4.0 International License

from PIL import Image

import svgwrite

from random import seed

from random import randint


dwg = svgwrite.Drawing('boxes', profile='tiny')


filename = "/Users/kevinlease/desktop/file.png"

threshold = 50

tally = 0

iterations_small = 1250

random_x = 0

random_y = 0

random_square_size = 5

with Image.open(filename) as image:

        width, height = image.size

        px = image.load()

        for i in range(iterations_small):

                random_x = randint(15, (width - 15))

                random_y = randint(15, (height - 15))

                random_square_size = randint(4, 10)

                pixel = image.getpixel((random_x,random_y))

                value = pixel[1]

                if value > threshold:

                        dwg.add(dwg.rect((random_x, random_y), (random_square_size, random_square_size), stroke=svgwrite.rgb(10,10, 10, '%'), fill='none'))

                        print('true')

                        tally = tally + 1



print("width is ", width)

print("height is ", height)

print("tally is ", tally)

print(dwg.tostring())

dwg.save()




I got the following type of output svg file on my computer:



Which I then plotted on paper:


I am very happy with how the plotting quality now.  However, watching this plot run, I noticed that the gcode generated by juicy-gcode doesn't seem to be optimized to avoid unnecessary travel, which makes it somewhat inefficient.  For example, it might plot a square at one end of the drawing and then travel to the opposite end draw another square and back to the opposite again.  

Disclaimer

The author does not make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information on this site is strictly at your own risk, and the author will not be held liable for any losses and damages in connection with the use of this information.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Comments