Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Drawbot_image_to_gcode_v2
Ohmarinus
Newbie
Posts: 7
Permalink
Post Drawbot_image_to_gcode_v2
on: July 14, 2019, 17:59
Quote

Wow, what an awesome forum! I had never heard about this up until now. I have been really scavenging all corners of the internet to find some new interesting things/scripts for Processing etc. I recently 'finished' my DIY homebrew pen plotter (CoreXY, so not polar) and am having a hard time finding good GCODE generation tools for my machine. Been using inkscape with two extensions but it's not all that great.

This is my machine:
Image

What I found so far:

#1 is gcodetools; I have hacked this script in order to use tool changes. I have designed a pen changer that works really well and gcodetools is discontinued by its maker so I had to fix a lot of bugs in the script. Sadly the path generation is very bad and the printer gets choked out on the gcode paths causing ink from the sharpies to blot over into my sketchbook. Sometimes it just hangs on the scripts. So okay I thought: fudge this, I'll try a new tool.

#2 gcodeplot; another inkscape extension, this one lets you choose 'gcode' as a file extension when saving the file. Works really well, the most beautiful paths and really fast gcode. No trash points, just really well thought out movement and plotted lines. Sadly this one has no tool change and it's built in such a way that it's basically impossible to get the tool changes in. So I'm still looking for a script that allows tool changes, especially with custom gcode for each change.

#3 Drawbot_image_to_gcode_v2; One of the best generators I've found out there thanks to this topic. I have completely overhauled the script to suit my printer. Custom header and footer gcode and disabled comments for now. The only issue I'm having is that my image is generated correctly, but when the gcode is generated, the image is suddenly upside-down. I am in the process of adding automatic tool changes to this script, but I am still figuring out how it knows the colors and how I can bind a pen to a specific color.

Here is an image of my first attempt (self-portrait):
Image

And here a timelapse of the first attempt being drawn:

My printer is called LotusXY, can draw with a multitude of pens but my favorite is the Rotring Rapidograph (using the 0.25mm pen in the stopmotion) which I can refill with 'Indische Inkt' (Dutch product I guess, note that this is NOT 'Chinese ink'). The positioning system is called CoreXY and works with fishing string for which I created my own grip-pulleys on the stepper motors. The machine is completely self made and designed. It runs on Ramps 1.4 with Marlin 2.x firmware (beta), has an LCD panel and SD card slot so it can run solo without a laptop connected to it. For the pen up and down movements a mini servo is used and the pen rides on a high-precision linear guide that is salvaged from some old medical machine at the scrapyard. PSU is a repurposed nobrand ATX PSU. All the machine parts are printed on my selfbuilt 3D-printer, it's a derivative of the MendelMax 1.5 type printer.

Well that's all for now, if people are interested in the machine I can write a topic that shows images and has all the ins and outs.

Oh, and I really want to design my own polar plotter! I have two leftover stepper motors, another Ramps 1.4 control board and random bearings etc etc. I'm a pretty good designer when it comes to these small machines and want to make one with the same fishing string as the one used for the CoreXY machine. Because this string is incredibly lightweight, it has very low kinetic energy and therefor can move very fast without causing any jitter. I've seen these hangplotters also can have very smart carriages so I'm doing some research into these machines and will start a design for one pretty soon I guess.

Here is a hand-drawn artwork I made, I really love drawing geometric shapes:
Image

Detail:
Image

Have a nice morning/day/evening,
Marinus

DaniK
Beginner
Posts: 42
Permalink
DaniK
Post Re: Drawbot_image_to_gcode_v2
on: July 17, 2019, 18:52
Quote

Awesome! Very cool project! I looked through some of your youtube videos and the automatic pen-changer is very impressive!
I have done a lot of 4 colour (CMYK) drawings with a polargraph I got from Sandy in the past and such a machine would be perfect for it! (if you are interested there are some pictures in this forum:

Forum


and

Forum

Any plans to share your files, plans, etc on some platform like instructables and or thingiverse? I would be very interested! πŸ™‚

When it comes to Gcode generation for penplotters, I haven't heard of anything (free) other than the ones you already mentioned...I have generated custom gcode for a 3D printer before through Rhinoceros3D and Grasshopper and simply output a txt file and renamed it .gcode and repetier host took it without any problems...so on my computer the Drawbot_image_to_gcode_v2 outputs one txt file for each pen that is defined in the script (6 is standard)....I guess these individual files need to be combined into one with the tool change inbetween? did i get that right?

and the image might be flipped on your machine because the Drawbot_image_to_gcode_v2 script is meant to output code for a wall hanging plotter and that one has probably another coordinate system...flipped y axis or so...because it draws down from zero and not up like most normal xy machines do? It's just an idea, not sure if its true πŸ˜‰

no idea if any of that helps, but I really like your project and want to at least try to help πŸ™‚

D

DaniK
Beginner
Posts: 42
Permalink
DaniK
Post Re: Drawbot_image_to_gcode_v2
on: July 17, 2019, 19:03
Quote

not sure why the links don't work, and I also can't edit the last post anymore....

test:
http://www.polargraph.co.uk/forum/polargraphs-group2/drawing-techniques-forum4/doing-rd-for-the-pen-industrie-thread427/#postid-3210
and
http://www.polargraph.co.uk/forum/polargraphs-group2/general-forum1/cmyk-experiment-thread537/

Ohmarinus
Newbie
Posts: 7
Permalink
Post Re: Drawbot_image_to_gcode_v2
on: July 18, 2019, 12:38
Quote

Wow, very awesome work. Thanks for your reply, I have seen your work around on the forum when I was checking everything that was happening over here and must say I'm delighted. I am in the process of thinking up a V-plotter (or polargraph) and will of course design a good pen holder for it. I can give you a quick tip: The pens will be held with elastic bands and the pen holders will be detachable by using magnets.

I want to make the carriage as light as possible, and have an idea to make the design of the polargraph faster. The idea is to balance out the strings in such a way that when the pen should stop, the pen immediately stops. I plan to do this by attaching the strings in a special way but it's hard to explain in words. I'll try to make a mockup so it can be shown easier. The downside of this method is that the machine requires a fixed frame so I am still doubting to do this.

Anyway, I will also dismantle my current plotter and recreate it using high quality linear rails that I sourced from the scrapyard. This project will take place before I continue to build the V-plotter.

Do you generate the paths for each color separately? I mean, going into Photoshop, exporting each layer into C, M, Y and K, and then you render each of them in Processing with the script and then you print them separately? Or do you let the script do the color separation in CMYK? I am still trying to wrap my head around the multicolor function of the Drawbot script.

I happen to have bought a Rhino license for Mac which now also supports Grasshopper but I have to update my system from Yosemite to the newest one to make it work. Also, I'm looking into Fusion360, it should also support export for CNC machines. Maybe it can be hacked to do exports for pen plotters. But again, for Fusion360 I also need a system update.

Your pen research is really nice. Right now my Rotring Rapidographs are the best pens I have. After that come the refillable Pilot V[X] Hi-Tecpoint pens, where the [X] displays the pen tip size. I have a 0.7 and 0.5 pen that I refilled with 'Indische Inkt' and am currently plotting a few drawings with that to see how it works out. These pens last ages. Not sure about their pen tips but these are indestructible. Eventually I want to move on to using good quality markers because making big drawings with a 0.7mm pen is going to take lightyears πŸ˜€

DaniK
Beginner
Posts: 42
Permalink
DaniK
Post Re: Drawbot_image_to_gcode_v2
on: July 19, 2019, 12:35
Quote

Hey!

I think for a hanging (gravity) V-Plotter the carriage needs to have some weight, otherwise the pressure on the tip of the pen is not enough to draw a good line. For rollerball pens I even angled the board to draw on almost to 45 degrees to get good friction. So not sure if making the carriage as light as possible is a good way to go. On the other hand I am also no mechanical engineer, so what do I know?! πŸ˜‰

What do you mean by fixed frame? I find the Polagraph so amazing because it is so simple and you just need to stick the two motors on the wall and can go. But I am also a VERY big fan of its "non-precision" πŸ™‚

Regarding the pens, I am still going for the Faber Castells and refill them as long as the pen tips last with Schmincke Aero Professional Acrylic ink. The other pen brands I tested clocked very quickly with it. Also got some empty pens from them recently, but the smallest pen tip size they offer is 0.8mm (I think one pen was also around 2,50 EUR, like the faber castells...but it's empty). That is very wide for my purposes at the moment. But they are maybe of interest to you...for your big drawings, that they don't take ages (my cmyk A2 drawings usually take at least 24hr + sometimes 4 days ;):
https://www.schmincke.de/en/products/acrylic-colours/aero-color-professional.html
When I have tested them out I plan to post the results in the other thread.
That's one downside of the wallplotter...the pen tips are bumping into the drawing board. I anyway use foamcore as drawing underground...but after 2-3 of my A2 CMYK drawings, the tips are usually broken...well I am also obsessed with drawings that consist of tiny pixels and hundred thousands of little lines...so there are millions of tipcrashes into the drawing board when I draw these....
The refillable Rotrings are amazing, I used them for a lot of manual work during my studies, but wouldn't dare to break them with the polargraph. But I think they are ideal for your LotusXY or any plotter where you can control the pressure.
But in general I am still searching for a more ecological responsible solution! That's why I am also looking into normal horizontal plotters now....

I have different workflows for the CMYK drawings. For some I split the channels in Photoshop and then use the old processing script from Dullbits (death to sharpie) (the current version is this Drawbot_image_to_gcode_v2 I think, but It has so many options I don't need) to render out individual line drawings for each pen.
For the pixel or dot or little line drawings I calculate and generate everything directly from the jpg completely in Rhinoceros3D + Grasshopper. I don't think the drawbot script has a multicolour options...it's simply producing a greyscale image with 6 different shades of grey and different drawing patterns I think....or any other colour combination. I am pretty sure it doesn't read the CMYK or RGB channels...it only reads greyscale images...if you feed in a coloured one it only takes the brightness values...as far is I understand it...

DaniK
Beginner
Posts: 42
Permalink
DaniK
Post Re: Drawbot_image_to_gcode_v2
on: July 20, 2019, 08:42
Quote

I just found that, it's made for laser cutting...but should be transferable to pen-plotting as it's basically the same....it also supports raster image import:

http://lasergrbl.com/en/

Ohmarinus
Newbie
Posts: 7
Permalink
Post Re: Drawbot_image_to_gcode_v2
on: July 21, 2019, 16:16
Quote

Ah yes, the pen tip needs pressure in a polargraph.. And the Rotring pens are useless in that sense because they work best when in a vertical position, in a 90ΒΊ angle to the medium. I would have to do some testing. Last week I managed to get some thick-gauge wiring for the stepper motors so I am going to build that polargraph anyway.

I agree with the strange interpretation of the grayscale in the Drawbot script. So this would mean I have to separate the colors beforehand and then generate gcode for each of the CMYK channel and then print it. However sadly the Drawbot script doesn't place all of the separate channels on the same base coordinates so each color layer is out of alignment. This difference will get smaller when the print gets bigger so with a large format polargraph I might be able to get away with it and maybe even have a cool artificial halftone displacement issue as you would sometimes see in the newspapers back in the days if they didn't correctly align each plate (CMYK fringing on the edges of photos, maybe some free moirΓ© effect, etc).

However.... I did manage to do some pretty artsy drawings so far with multicolor. I have programmed in a 'M0' command in the gcode that waits for user input on a switch to the next pen. This makes the printer halt so that I can change the pen. On my plotter controller board there is an LCD screen with a rotary encoder with click function. When I change the pen and click the rotary encoder, the print continues with the rest of the gcode in the next pen color. This is shown in the following album:

LotusXY v0.8b pen plotter - Homemade pen plotter with automated tool changing, multicolor and more.

Preview ('Click after BLACK'):
Image

Right now I have printed a 4th pen holder so I can have four colors ready and I'm not in the process of designing some kind of silicone sock that the pen will drop into to protect the pen from drying out. This silicone sock will replace the cap on the pen while it's waiting to be picked up.

What my goals with the Drawbot processing script are for now is this:
- Make it so that all GCODE for each pen is put into one file
- Have the script add a pen change script in between each toolchange

And finally, design a holder for the LCD2004 + SD card reader to make it a finished machine.

When these things are done I will move on to pen research while building the bigger brother of LotusXY. I'm really just starting in Processing but I've come a long way. I'm not sure if it's possible to make the system do what I want but if I manage to have it generate one full-color file instead of four separate ones, I will probably also be able to reverse the Y-coordinates so that I don't have to flip each image manually.

Big Update;
Whew!

Just sat down for two hours to crunch this script and boyyyyy did I somehow do it? Yeash I definitely did!
I now have one GCODE file with programmed automatic tool changes that counts the pens and saves the toolpaths for each pen.

In the end it puts down the last pen into the last bay again and then the toolhead moves out of the way.

Image

The only thing left to tackle??
Reverse the Y-axis GCODE.
And this is going to be a tough one.

Update #2:
Oh, and here's a time lapse video of the first full colour tryout:

One small mistake with the yellow and the gcode generated an error somehow in three spots where the pen doesn't lift even though I've checked the gcode afterwards to see if I made a mistake but the gcode was perfectly fine. So I suspect there is a hidden character in the gcode file being generated by the processing script that causes the gcode not to register somehow. I have no clue how to fix this as it doesn't even show up when I use my highly sophisticated text editors.

Ohmarinus
Newbie
Posts: 7
Permalink
Post Re: Drawbot_image_to_gcode_v2
on: July 28, 2019, 10:13
Quote

Final Update on the Drawbot script:
So I managed to add/change code in the script that flips the image inside both the preview and the gcode that is generated by loading all the pixels into an array and reversing the position one by one.

Now the images are loading as they should for a cartesian machine AND they are displayed in the preview as they should. Also, the pen changing works, and all the color paths are being output as one single gcode file.

So now that the scripts are working as I want them to (I also added new arrays for four-multicolor-pen changes 'pseudo CMYK' that display the correct colors in the preview), I will start working on the bigger brother of this pen plotter. All of my 0.5mm Rotring pens have been delivered, next week I'll receive the pen cleaning kit and bottles of CMYK ink that work with fountain pens and then I'll be ready to take over the world.

Example of the preview and the gcode preview in Repetier Host that I use to check if my gcode is generated as intended:
Image

DaniK
Beginner
Posts: 42
Permalink
DaniK
Post Re: Drawbot_image_to_gcode_v2
on: August 8, 2019, 15:30
Quote

very cool!

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.041 seconds.