Thingiverse

Sequential Batch 3D Printing using Automatic Print Ejection by replayreb
by Thingiverse
Last crawled date: 4 years, 1 month ago
UPDATE #2 6/27/2018: This is working so well that I wanted to queue several batch files at the same time to print overnight and today while I was at work (a batch file for the batch files if you will) so I modified the batch_print.exe script so if you answer "Yes" to the first question to print multiple copies of the same model, it will now save the batch gcode file with the syntax "numberofcopiesX_selectedfile.gcode".
For example, one of my lightsaber batch files was saved as "20X_papermate_luke_esb.gcode". Then I ran batch_print.exe again and this time answered "No" to the first question which prompted me to add files one at a time so I selected these previously generated multiple print batch files:
20X_papermate_luke_esb.gcode
20X_papermate_vader_esb.gcode
20X_papermate_vader_rotj.gcode
That generated one huge gcode file called "batch_print.gcode" to print all 60 models. It's been printing perfectly for 24 hours.
UPDATE #1 6/26/2018: I discovered another benefit of automatic print ejection today. I was at work but monitoring the print job from my phone via my OctoPi and webcam and when the batch print job finished I was able to log into my PC via VNC and generate another batch job and start printing it remotely without physically being there because the print bed was already clear.
(Original post)
I just started printing lightsaber pen tops to sell online:https://www.ebay.com/itm/323325040048https://www.etsy.com/listing/588930944/lightsaber-pen
I've tried printing multiple copies at the same time but they don't turn out near as nice or as strong as when I print them one at a time. It takes about thirty minutes to print each one which means I have to be constantly on call to remove the previous model after it prints and manually start printing the next one. I came up with a solution but it only works with small models with a small base that can be easily popped off the bed. I wrote a Winbatch script that prompts you to select a gcode file and asks how many copies you want to print. Then it takes that gcode file and pastes multiple copies of it into another file and inserts some gcode in between the copies called eject.gcode. All that eject.gcode does is home the print head, raise the Z-axis a couple of millimeters and move the print head to knock the printed model off the bed. Although I have compiled the Winbatch script into an executable you can download for use, it is not a turn-key solution; It requires some understanding of gcode and being able to manipulate or trick your printer into printing on the back edge of the bed so the model falls off and won't interfere with the print head when printing the next model.
The Details
I normally print these on a piece of painter's tape but the tape wears and tears after a few prints not to mention knocking off the print loosens the tape from the bed. I've had success in the past printing on a mirror scuffed up with sandpaper so I sanded the area on the mirror where the model was going to be printing. UPDATE: I've since stopped batch printing on a sanded mirror as the PETG was adhering a little too well; PETG sticks just fine to a smooth mirror and pops off more easily. I needed to print on the very back of the print bed but didn't want to have to go through and reposition every single one of my lightsaber models not to mention Cura's positioning isn't very precise unless the model is centered. My CR-10S has a 300mm x 300mm size bed so what I did was create a machine setting in Cura copying all of my CR-10S settings over except making the print bed size on my mock "Batch Print" printer 150mm x 580mm. That way when I load a normally centered .stl model in Cura and generate the gcode using the fake printer settings, it prints on my CR-10S about a quarter of the way over from the left side of the bed on the X-axis and all the way on the back edge of the bed on the Y-axis. When the print is done, the print head homes then raises the print head about 2mm on the Z-axis and moves the print head to knock the model off the bed. Then the next print starts. I also inserted some M109 and M190 commands in the eject gcode to keep the nozzle and bed heated so you'll need to remove or customize those commands for your printer. Like I said, this will only work with models with a small base but still tall enough for the head to knock over. Maybe this method will be useful to someone who wants to print I don't know multiple game board pieces or bolts or whatever one right after the other.
Here is my eject.gcode. You'll need to tweak it for your printer. I would first remove or comment out the temperature commands and run the code by itself to see where the print head ends up.
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
Here is the entire contents of my batch_print.exe script so you know there's nothing nefarious in it. The eject.gcode and batch_print.exe need to be in the same directory.
same=AskYesNo("Batch Print", "Do you want to print multiple copies of the same model?")
If same == @NO then goto skip
copies=AskLine("Batch Print", "How many copies do you want to print?", "1")
gcode=AskFileName("Select G-code File", "", "gcode files|*.gcode|", "", 1)
pos=StrIndexNC(gcode, "\", 0, @BACKSCAN)
oldname=StrSubWild(gcode, "*.gcode", pos+1)
newname=StrCat(copies, "X_", oldname)
newpath=StrReplace(gcode, oldname, newname)
batch_file=FileOpen(newpath, "WRITE")
FileClose(batch_file)
For n = 1 to copies
FileAppend(gcode, newpath)
FileAppend("eject.gcode", newpath)
next n
exit
:skip
batch_file=FileOpen("batch_print.gcode", "WRITE")
FileClose(batch_file)
:add
gcode=AskFileName("Select G-code File", "", "gcode files|*.gcode|", "", 1)
FileAppend(gcode, "batch_print.gcode")
FileAppend("eject.gcode", "batch_print.gcode")
more=AskYesNo("Batch Print", "Do you want to add another model?")
If more == @YES then goto add
After running my little batch program the resultant batch_print.gcode file looks something like this:
M190 S85.000000
M109 S255.000000
;Sliced at: Mon 25-06-2018 20:09:43
;Basic settings: Layer height: 0.2 Walls: 1.2 Fill: 100
;Print time: 32 minutes
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15 ;move the platform down 15mm
G1 F3600
;Put printing message on LCD screen
M117 Printing...
;Layer count: 299
;LAYER:0
M107
G0 F3600 X72.340 Y276.185 Z0.200
;TYPE:SKIRT
G1 F1200 X73.253 Y275.952 E0.03071
G1 X73.891 Y275.845 E0.05180
G1 X74.447 Y275.795 E0.06999
G1 X75.000 Y275.774 E0.08803
G1 X75.623 Y275.797 E0.10835
G1 X76.577 Y275.917 E0.13969
G1 X77.238 Y276.064 E0.16177
G1 X78.200 Y276.375 E0.19472
G1 X79.191 Y276.836 E0.23035
G1 X79.922 Y277.293 E0.25845
(truncated)
G91
G0 Z10 ;move head up 10mm
G28 X0 ;move X to min endstop
G90 ;absolute positioning
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
M190 S85.000000
M109 S255.000000
;Sliced at: Mon 25-06-2018 20:09:43
;Basic settings: Layer height: 0.2 Walls: 1.2 Fill: 100
;Print time: 32 minutes
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15 ;move the platform down 15mm
G1 F3600
;Put printing message on LCD screen
M117 Printing...
;Layer count: 299
;LAYER:0
M107
G0 F3600 X72.340 Y276.185 Z0.200
;TYPE:SKIRT
G1 F1200 X73.253 Y275.952 E0.03071
G1 X73.891 Y275.845 E0.05180
G1 X74.447 Y275.795 E0.06999
G1 X75.000 Y275.774 E0.08803
G1 X75.623 Y275.797 E0.10835
G1 X76.577 Y275.917 E0.13969
G1 X77.238 Y276.064 E0.16177
G1 X78.200 Y276.375 E0.19472
G1 X79.191 Y276.836 E0.23035
G1 X79.922 Y277.293 E0.25845
(truncated)
G91
G0 Z10 ;move head up 10mm
G28 X0 ;move X to min endstop
G90 ;absolute positioning
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
etc.
etc.
etc.
https://www.youtube.com/watch?v=I69kK5qjOQI
For example, one of my lightsaber batch files was saved as "20X_papermate_luke_esb.gcode". Then I ran batch_print.exe again and this time answered "No" to the first question which prompted me to add files one at a time so I selected these previously generated multiple print batch files:
20X_papermate_luke_esb.gcode
20X_papermate_vader_esb.gcode
20X_papermate_vader_rotj.gcode
That generated one huge gcode file called "batch_print.gcode" to print all 60 models. It's been printing perfectly for 24 hours.
UPDATE #1 6/26/2018: I discovered another benefit of automatic print ejection today. I was at work but monitoring the print job from my phone via my OctoPi and webcam and when the batch print job finished I was able to log into my PC via VNC and generate another batch job and start printing it remotely without physically being there because the print bed was already clear.
(Original post)
I just started printing lightsaber pen tops to sell online:https://www.ebay.com/itm/323325040048https://www.etsy.com/listing/588930944/lightsaber-pen
I've tried printing multiple copies at the same time but they don't turn out near as nice or as strong as when I print them one at a time. It takes about thirty minutes to print each one which means I have to be constantly on call to remove the previous model after it prints and manually start printing the next one. I came up with a solution but it only works with small models with a small base that can be easily popped off the bed. I wrote a Winbatch script that prompts you to select a gcode file and asks how many copies you want to print. Then it takes that gcode file and pastes multiple copies of it into another file and inserts some gcode in between the copies called eject.gcode. All that eject.gcode does is home the print head, raise the Z-axis a couple of millimeters and move the print head to knock the printed model off the bed. Although I have compiled the Winbatch script into an executable you can download for use, it is not a turn-key solution; It requires some understanding of gcode and being able to manipulate or trick your printer into printing on the back edge of the bed so the model falls off and won't interfere with the print head when printing the next model.
The Details
I normally print these on a piece of painter's tape but the tape wears and tears after a few prints not to mention knocking off the print loosens the tape from the bed. I've had success in the past printing on a mirror scuffed up with sandpaper so I sanded the area on the mirror where the model was going to be printing. UPDATE: I've since stopped batch printing on a sanded mirror as the PETG was adhering a little too well; PETG sticks just fine to a smooth mirror and pops off more easily. I needed to print on the very back of the print bed but didn't want to have to go through and reposition every single one of my lightsaber models not to mention Cura's positioning isn't very precise unless the model is centered. My CR-10S has a 300mm x 300mm size bed so what I did was create a machine setting in Cura copying all of my CR-10S settings over except making the print bed size on my mock "Batch Print" printer 150mm x 580mm. That way when I load a normally centered .stl model in Cura and generate the gcode using the fake printer settings, it prints on my CR-10S about a quarter of the way over from the left side of the bed on the X-axis and all the way on the back edge of the bed on the Y-axis. When the print is done, the print head homes then raises the print head about 2mm on the Z-axis and moves the print head to knock the model off the bed. Then the next print starts. I also inserted some M109 and M190 commands in the eject gcode to keep the nozzle and bed heated so you'll need to remove or customize those commands for your printer. Like I said, this will only work with models with a small base but still tall enough for the head to knock over. Maybe this method will be useful to someone who wants to print I don't know multiple game board pieces or bolts or whatever one right after the other.
Here is my eject.gcode. You'll need to tweak it for your printer. I would first remove or comment out the temperature commands and run the code by itself to see where the print head ends up.
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
Here is the entire contents of my batch_print.exe script so you know there's nothing nefarious in it. The eject.gcode and batch_print.exe need to be in the same directory.
same=AskYesNo("Batch Print", "Do you want to print multiple copies of the same model?")
If same == @NO then goto skip
copies=AskLine("Batch Print", "How many copies do you want to print?", "1")
gcode=AskFileName("Select G-code File", "", "gcode files|*.gcode|", "", 1)
pos=StrIndexNC(gcode, "\", 0, @BACKSCAN)
oldname=StrSubWild(gcode, "*.gcode", pos+1)
newname=StrCat(copies, "X_", oldname)
newpath=StrReplace(gcode, oldname, newname)
batch_file=FileOpen(newpath, "WRITE")
FileClose(batch_file)
For n = 1 to copies
FileAppend(gcode, newpath)
FileAppend("eject.gcode", newpath)
next n
exit
:skip
batch_file=FileOpen("batch_print.gcode", "WRITE")
FileClose(batch_file)
:add
gcode=AskFileName("Select G-code File", "", "gcode files|*.gcode|", "", 1)
FileAppend(gcode, "batch_print.gcode")
FileAppend("eject.gcode", "batch_print.gcode")
more=AskYesNo("Batch Print", "Do you want to add another model?")
If more == @YES then goto add
After running my little batch program the resultant batch_print.gcode file looks something like this:
M190 S85.000000
M109 S255.000000
;Sliced at: Mon 25-06-2018 20:09:43
;Basic settings: Layer height: 0.2 Walls: 1.2 Fill: 100
;Print time: 32 minutes
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15 ;move the platform down 15mm
G1 F3600
;Put printing message on LCD screen
M117 Printing...
;Layer count: 299
;LAYER:0
M107
G0 F3600 X72.340 Y276.185 Z0.200
;TYPE:SKIRT
G1 F1200 X73.253 Y275.952 E0.03071
G1 X73.891 Y275.845 E0.05180
G1 X74.447 Y275.795 E0.06999
G1 X75.000 Y275.774 E0.08803
G1 X75.623 Y275.797 E0.10835
G1 X76.577 Y275.917 E0.13969
G1 X77.238 Y276.064 E0.16177
G1 X78.200 Y276.375 E0.19472
G1 X79.191 Y276.836 E0.23035
G1 X79.922 Y277.293 E0.25845
(truncated)
G91
G0 Z10 ;move head up 10mm
G28 X0 ;move X to min endstop
G90 ;absolute positioning
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
M190 S85.000000
M109 S255.000000
;Sliced at: Mon 25-06-2018 20:09:43
;Basic settings: Layer height: 0.2 Walls: 1.2 Fill: 100
;Print time: 32 minutes
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15 ;move the platform down 15mm
G1 F3600
;Put printing message on LCD screen
M117 Printing...
;Layer count: 299
;LAYER:0
M107
G0 F3600 X72.340 Y276.185 Z0.200
;TYPE:SKIRT
G1 F1200 X73.253 Y275.952 E0.03071
G1 X73.891 Y275.845 E0.05180
G1 X74.447 Y275.795 E0.06999
G1 X75.000 Y275.774 E0.08803
G1 X75.623 Y275.797 E0.10835
G1 X76.577 Y275.917 E0.13969
G1 X77.238 Y276.064 E0.16177
G1 X78.200 Y276.375 E0.19472
G1 X79.191 Y276.836 E0.23035
G1 X79.922 Y277.293 E0.25845
(truncated)
G91
G0 Z10 ;move head up 10mm
G28 X0 ;move X to min endstop
G90 ;absolute positioning
;*****
;* BEGIN EJECT GCODE *
;***
M109 S255.000000 ;Keep nozzle heated
M190 S85.000000 ;Keep bed heated
;Set absolute postioning
G90
;Home
G28 X0 Y0 Z0
;Raise head slightly and line up with model
G0 Z2
G1 X95 Y200 F9000
;Move to rear to knock off model
G1 X95 Y300 F9000
;Raise head to clear clamp
G0 Z10
;*****
;* END EJECT GCODE *
;*****
etc.
etc.
etc.
https://www.youtube.com/watch?v=I69kK5qjOQI