Notifications
Clear all

Custom G Code Help  

  RSS
Brian
(@brian-12)
Reputable Member
Custom G Code Help

I'm looking to add G-Code that will do an absolute move of the Z axis down a specified amount before a Toolchange and the move back up that same amount once the Toolchange is complete before resuming printing. 

The reason I need to do this is because I'm printing parts sequentially and while printing the parts the print head will clear the other parts, it will not clear them if the bed does not lower before a Toolchange.

I've experimented some but I just seem to get a move to a specific height aka 30mm.  But what I want is it to do an absolute move, aka 30mm down from wherever it is, then 30 mm back up before resuming printing. 

Any help is appreciated.

Posted : 26/09/2024 3:43 am
Brian
(@brian-12)
Reputable Member
Topic starter answered:
RE: Custom G Code Help

I misspoke in my previous post, I need a relative move, not absolute.  Sorry for the confusion.

Posted : 26/09/2024 11:01 am
Diem
 Diem
(@diem)
Illustrious Member

G-gode Marlin isn't really a full computer language, it does have variables (look up #number format) but they are not easy to use ... better might be to write a post processing script to search for toolchanges and insert a patch.  As long as your parts are less than half the available build height the procedure should be sraightforward, taller ones may require some complex conditionals.

Cheerio,

Posted : 26/09/2024 5:31 pm
Brian liked
Brian
(@brian-12)
Reputable Member
Topic starter answered:
RE: Custom G Code Help

The good thing is that in the slicer you can insert custom g code at Toolchanges as there's a section for that, I just need to figure out what to put there. 

I've been hesitant to experiment because what I tried the first time crashed the nozzle into the bed as the command I gave it must have been trying to move the z to a position of -30mm vs. just going back up 30mm.  Good thing I was watching to hit the reset button when it happened. 

I've found the Marlin page that describes all of the commands, but I guess I don't fully understand it. 

Posted : 26/09/2024 7:36 pm
Diem
 Diem
(@diem)
Illustrious Member

Bad G-Code can cause serious damage; if you don't understand it be extremely cautious.  Begin with baby steps and move the toolhead well clear of everything before you test them.

Cheerio,

Posted : 26/09/2024 10:14 pm
Brian liked
Share: