Welcome! Log In Create A New Profile

Advanced

Subprograms using Marlin ?

Posted by bowzee 
Subprograms using Marlin ?
January 09, 2014 06:13PM
I am trying to make a filled square using Marlin, and it is/was my understanding that it can be implemented using some code similar to this:

G90
G0 X0 Y0
G1 X20 Y0
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M98 P101
M30

O101
G91
G1 X0 Y1
G1 X-20 Y0
G1 X0 Y1
G1 X20 Y0
G90
M99

but this does not work. Is this an issue with Marlin? Is there any other easy way do do the same thing?
Re: Subprograms using Marlin ?
January 11, 2014 09:35AM
I don't know of any printer firmwares that implement subprograms like that. One problem is that reprap printers parse gcode line by line, so you would need to store the whole file on SD card to be able to do it. RepRapPro have implemented similar functionality using the same commands but they have done it in a non-standard way.

In general the Gcode used by 3d printers is a quite limited subset of the complete GCode spec.

One way to use such Gcode with existing printer firmwares is to do a macro expansion on the host side, before sending to the printer, with a bit of Python for example.


What is Open Source?
What is Open Source Hardware?
Open Source in a nutshell: the Four Freedoms
CC BY-NC is not an Open Source license
Re: Subprograms using Marlin ?
January 11, 2014 11:42AM
bobc, thank you for the reply.

I use the Repetier Host, so it would be more adequate to say that subprogram treatment should be a functionality of either this program or of a (possibly written in Python) pre-processor? I guess that I will search for these solutions then!

Regards
Re: Subprograms using Marlin ?
January 13, 2014 10:27PM
in repetier host under g-code menu there are several sets of command sections for start gcode, ending gcode, layer change for example to add special code into. if this is at the beginning of print then start gcode would be a place to look at.
Re: Subprograms using Marlin ?
April 12, 2020 02:50PM
Marlin has had this functionality for a while. But it isn't always working. In fact, I'm debugging it now…

Inside your G-code file you simply have a line like this to run another file:

M32 P !/FOLDER/FILE.GCO#
Sorry, only registered users may post in this forum.

Click here to login