blaknite7
Posts: 30
Joined: Fri Aug 22, 2014 6:57 pm

Sharing: Raise3D Pause Script

Rarely do I get to contribute much however I think I have figured out how to do something that hasn't been posted yet, so I wanted to share.

Specifically how to add a pause at a specific layer while using a Raise3D [R3D] printer. This may also be useful to other printers if you have similar printer behavior as the R3D, but you'll have to modify any specific "pause" M-Code commands. If you have this printer you know that there is no firmware support for pausing at a specific height and raise3D recommends you use the feature in ideamaker to pause at a specific height. But, since S3D is awesome I wanted to figure out how to do it...

This script also address another issue not currently addressed by raise3D which is: their pause routine will keep the bed at the same height. Now if you pause at a moderate "Z" height, loading a filament isn't a problem, however if you want to have a pause at a low height (say a few millimeters) than getting filament to load may be an issue because the purge hits the bed immediately due to the close proximity of the nozzle.

Enter "Additional terminal commands for post processing" stage right... Before getting into the actual post processing command, take a look at the desired G-Code we want the machine to run:

Desired G Code: (I am using layer 5 as an example, but it can be any layer you choose)

G91; Relative Positioning
G1 Z50 F1800; Move Bed down 50mm
G90; Absolute positioning
G1 X10 Y10 F5400
M2000; Enter Pause routine for R3D
;Layer 5
G91; Relative Positioning
G1 Z-50 F1800; Move Bed up 50mm
G90; Absolute positioning


So how does this break down: it basically says: Just before layer 5 I want you to move the bed down 50mm and then go to a staging area at location X=10, Y=10 and enter the pause routine in the R3D printer. When the printer is unpaused, the bed will come back the 50mm it dropped and resume the rest of the printing. On the face of it, pretty easy to understand however there are a few hidden idiosyncrasies that you have to account for to make this work...

To get this into the post processor, I've used the replace command to search for a specific layer and to add the G-Code I described above. Before getting into the code you must consider that S3D (in my version 3.1.0) puts a comment for each new layer that looks like this:

; Layer 5, Z=1.02

So when we search in our replace code, we want to make sure that we include the comma [,] in the search. This prevents us from entering the wrong code on a line that starts with "layer 5" for example, we don't want this code on layer 50... There is a consequence to using this technique which is the characters in that line, after the comma, are left behind. If you aren't careful to account for the remaining "z=1.02" this could cause you problems. We are able to fix this by adding a carriage return and comment character [semicolon in this case - ; ] at the end of our replace script.

So when you do all of that, you end up with the following:

{REPLACE "; layer 5," "G91; Relative Positioning\nG1 Z50 F1800; Move Bed down 50mm\nG90; Absolute positioning\nG1 X10 Y10 F5400\nM2000; Enter Pause routine for R3D\n;Layer 5\nG91; Relative Positioning\nG1 Z-50 F1800; Move Bed up 50mm\nG90; Absolute positioning\n; "}
{REPLACE ", Z" "\n; Z"}

A few of there comments to consider:

1. The second "replace" function is not needed, but it searches the rest of the g-code and makes a new line for all of the "Z=[heigh]" comments to make them consistent with the g-code that you've just replaced.
2. The R3D printer does not resume at the same speed in which you paused it from which is why there are speed commands listed in the g-code that is substituted. You should make sure that the code you use, matches the speeds you want (remember mm/min!!!)
3. You are going to have to modify this code on the latest "released" version of touch control... I know what you're thinking, what a "dick to post code that needs to be modified"... but its true. Specifically, the most current version of the touch control doesnt allow a comment on the same line as a command. so this means you need to do one of two things: delete the comments in the replace feature OR add extra "\n" before and after the comments to make them a separate line with only a comment on it. Some beta versions of their firmware suggest the next versions will allow comments on the same line, so hopefully this wont be necessary for long...

I suggest testing your script while you are home on a simple print, like a 20mm cal-cube to verify that it works at the desired layer height AND that it doesnt add your g-code modifications to a similar layer (like layer 50 in this example...).

Best of luck all, I hope you find this as useful as I did!
CompoundCarl
Posts: 2005
Joined: Wed Aug 05, 2015 7:23 am

Re: Sharing: Raise3D Pause Script

Wouldn't it be much easier to just do something like this:

{REPLACE "; layer 5," "M2000\n; layer 5,"}

Basically putting the stuff you want to add before the layer tag. That way you don't have to mess with the second replace command and you also don't screw up the layer comments that are already in the file.
blaknite7
Posts: 30
Joined: Fri Aug 22, 2014 6:57 pm

Re: Sharing: Raise3D Pause Script

CompoundCarl wrote:Wouldn't it be much easier to just do something like this:

{REPLACE "; layer 5," "M2000\n; layer 5,"}

Basically putting the stuff you want to add before the layer tag. That way you don't have to mess with the second replace command and you also don't screw up the layer comments that are already in the file.
that really depends on what you want to do, and at what height... As I mentioned before, if you want the bed to move away from the nozzle because you are pausing at a lower level than you need the other commands both before AND after the M2000 command. if you are going to be pausing at a height that leaves enough room to load new filament, than yes, you can do the simpler replace command as you wrote and can drop the second replace post script.

The second one isn't really necessary... it was mainly there before I was capturing the comma after the layer number but that resulted in the layer 50 and 500...etc being captured. So when i fixed that issue it was still there and I just left it.

I am also on the R3D forum and Jetguy brought up another point. apparently some peoples version of the firmware on their board has a timeout feature, so after a couple minutes the stepper motors will release (while in the pause) and resuming has given people some registration issues (X-Y axes being off by 2-3 MM). Nothing that we can do about it here, but people should know the risk exists.
CompoundCarl
Posts: 2005
Joined: Wed Aug 05, 2015 7:23 am

Re: Sharing: Raise3D Pause Script

blaknite7 wrote:that really depends on what you want to do, and at what height... As I mentioned before, if you want the bed to move away from the nozzle because you are pausing at a lower level than you need the other commands both before AND after the M2000 command. if you are going to be pausing at a height that leaves enough room to load new filament, than yes, you can do the simpler replace command as you wrote and can drop the second replace post script.
It doesn't matter if you need to put commands before, after, or on both sides of the M2000. Putting everything you need to insert before the layer comment is going to be much easier and won't screw up the layer comments. The command you posted will break the layer tag in half, which there is no reason to do. It's just a comment, so it doesn't matter if you have everything before or after it.

So using this instead would be much better and won't screw up the gcode file:

{REPLACE "; layer 5," "G91; Relative Positioning\nG1 Z50 F1800; Move Bed down 50mm\nG90; Absolute positioning\nG1 X10 Y10 F5400\nM2000; Enter Pause routine for R3D\nG91; Relative Positioning\nG1 Z-50 F1800; Move Bed up 50mm\nG90; Absolute positioning\n; layer 5,"}
blaknite7
Posts: 30
Joined: Fri Aug 22, 2014 6:57 pm

Re: Sharing: Raise3D Pause Script

CompoundCarl wrote:
It doesn't matter if you need to put commands before, after, or on both sides of the M2000. Putting everything you need to insert before the layer comment is going to be much easier and won't screw up the layer comments. The command you posted will break the layer tag in half, which there is no reason to do. It's just a comment, so it doesn't matter if you have everything before or after it.

So using this instead would be much better and won't screw up the gcode file:

{REPLACE "; layer 5," "G91; Relative Positioning\nG1 Z50 F1800; Move Bed down 50mm\nG90; Absolute positioning\nG1 X10 Y10 F5400\nM2000; Enter Pause routine for R3D\nG91; Relative Positioning\nG1 Z-50 F1800; Move Bed up 50mm\nG90; Absolute positioning\n; layer 5,"}

I get you now, I misunderstood your comment before. :oops: Yes, that should work without breaking the layer commands and you can drop the second replace. Thanks for the refinement. :)
blaknite7
Posts: 30
Joined: Fri Aug 22, 2014 6:57 pm

Re: Sharing: Raise3D Pause Script

Here is the updated post script:

{REPLACE "; layer 5," "G91; Relative Positioning\nG1 Z50 F1800; Move Bed down 50mm\nG90; Absolute positioning\nG1 X10 Y10 F5400\nM2000; Enter Pause routine for R3D\nG91; Relative Positioning\nG1 Z-50 F1800; Move Bed up 50mm\nG90; Absolute positioning\n; layer 5,"}

Turns out that messing with the layer text will prevent the touch-display from giving you a percentage complete based on what layer you are on... If you keep the layer comments as intend this feature still works on the touch display.
smeek
Posts: 11
Joined: Wed May 17, 2017 9:39 am

Re: Sharing: Raise3D Pause Script

Hello, pretty new to 3D printing but learning. Big fan of S3D so far. Can someone share a post script that would work for an Anet A8 for changing color filament. I found a couple examples but didn't work for me so probably for different firmware. I just want to pause the print after layer 4, move the X over to home position without changing Z, allow me to change and purge the filament. No need to disable any motors since I can manually change out the filament. Then resume print with layer 5 exactly where it left off. Thanks!
checktest
Posts: 19
Joined: Sat Sep 19, 2015 6:20 pm

Re: Sharing: Raise3D Pause Script

I've been trying to figure this out as well on my Raise3D N2 for Simplify3D v4, since S3D's slicer prints my part in 33 minutes, while IdeaMaker takes 53 minutes. That's a big deal, since I'm trying to print quite a lot of these.

I've tried the code below, and on layer 7 it homes X and Y, raises 50 mm, and pauses just fine. However, on the second and third pauses, it goes to X0 Y0, raises 50, but then lowers 50 again before it pauses. Any ideas what I might be doing wrong?

{REPLACE "; layer 7," "G91\nG1 Z50 F1800\nG90\nG1 X0 Y0 F5400\nM2000\nG91\nG1 Z-50 F1800\nG90\n; layer 7,"}
{REPLACE "; layer 10," "G91\nG1 Z50 F1800\nG90\nG1 X0 Y0 F5400\nM2000\nG91\nG1 Z-50 F1800\nG90\n; layer 10,"}
{REPLACE "; layer 13," "G91\nG1 Z50 F1800\nG90\nG1 X0 Y0 F5400\nM2000\nG91\nG1 Z-50 F1800\nG90\n; layer 13,"}
sylus28
Posts: 6
Joined: Thu Feb 18, 2016 10:15 am

Re: Sharing: Raise3D Pause Script

this is my script for Raise3D
{REPLACE "; process PAUSE" "M2000\n"; process PAUSE"} ;pause @ height and change filament
and process
https://youtu.be/jtwYaZCO0Xo
for multipause process should be rename as is PAUSE;1 PAUSE;2......

Return to “General Discussion and Tips”