macros wishlist



  • Good day!
    I would like to ask you to add several features to the future changes in the firmware.

    1. Calling end.g macro after printing, by analogy with start.g
    2. The ability to call macros in time after a certain event, for example, a tool change, a layer change, etc.
      Usage example:
      When changing tools, my printer executes code for preparing a new one. Part of the code is cleaning the nozzles.
      Printing is resumed with a new tool, but plastic leakage is possible from the nozzle of the old one, even with a properly configured retract.
      Ideally, we set the after_change_T0.g macro for self-cleaning nozzles, in the form (pseudocode):

    Call_macro macros \ selfclean.g 10
    Call_macro macros \ selfclean_deep.g 30
    Call_macro macros \ selfclean.g 60

    Time in seconds.

    The printer, after changing the tool, after a specified time causes macros.

    Anticipating proposals with a decrease in the temperature of the inactive nozzle - cooling / heating of the nozzles takes a very long time (up to 2-3 minutes for 1 tool change), while changing the tool without changing the temperature takes a few seconds, and plastic leakage from the unused nozzle is small and stops after 1 -2 minutes completely.

    As a result, printing speed without changing the temperature on complex, multi-color models is several times higher than the classic version with cooling / heating.


  • administrators

    Hi,

    1. There is already stop.g, however it is executed only if your GCode files has an M0 command at the end.

    2a. There are already tool change macro files, see https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Tool_change_files.

    2b. The easiest way to get a macro called at layer change is to configure your slicer layer change script to execute e.g. M98 P"layer_change.g".




    M0: Stop or Unconditional stop

    Parameters

    This command can be used without any additional parameters.
    Hnnn Keep heaters on
    

    Example

    M0
    

    The firmware finishes any moves left in its buffer, then it executes the macro file cancel.g if present, if the axes are homed and if a print is being cancelled. Otherwise stop.g is run before all motors are put into idle mode. If no H1 parameter is present, the heaters are turned off too. See also M1, M112.*****

    What if I don’t want to call cancel.g?
    And do not want to turn off stepper motors?

    2a, 2b - tfree1.g, tpre1.g and tpost1.g are called only 1 time at the time of the change.
    The idea is to call a macro after a specified time after the event.


  • administrators

    @anidal said in macros wishlist:

    What if I don’t want to call cancel.g?
    And do not want to turn off stepper motors?

    File cancel.g is only called (instead of stop.g) if M0 is issued while the print is paused.

    M0 does not turn off the stepper motors. The stepper motors will go into idle hold automatically (i.e. still powered but at reduced current) after 30 seconds of inactivity.



    1. Ок, I try to test M0 function.
      2a,2b - Is there any hope?

  • administrators

    @anidal said in macros wishlist:

    2a, 2b - tfree1.g, tpre1.g and tpost1.g are called only 1 time at the time of the change.
    The idea is to call a macro after a specified time after the event.

    Do you mean that a certain time after a tool change occurred, the print would be interrupted and a macro executed?



  • Yes, the current print (after the completion of the next movement) is interrupted, the macro is executed and the print continues.
    As if in the existing print code manually would insert a few more lines.



  • There is a nuance with the movement of the filament, if the macro will execute extrusion / retract commands. I do not have enough knowledge to offer the best solution to this problem.



  • @anidal

    If I understand correctly, you want to call macro a certain time after a tool change event.

    Have you looked at the G4 pause command? It does of course mean that the machine would sit idle during the pause but you could use that in tool change macro.

    Or do you want to be able to have a macro called automatically some time after an event while continuing other tasks in the mean time? Effectively acting as a timed interrupt? This of course would be very problematic because there could be serious consequences depending on what processes were running at the time of the interrupt.

    Edit. It would probably be better if you explain exactly what it is that you want to achieve.



  • @deckingman said in macros wishlist:

    Or do you want to be able to have a macro called automatically some time after an event while continuing other tasks in the mean time? Effectively acting as a timed interrupt? This of course would be very problematic because there could be serious consequences depending on what processes were running at the time of the interrupt.
    Edit. It would probably be better if you explain exactly what it is that you want to achieve.

    Automatically, of course. You can manually insert the code in any editor, but the whole essence of 3d printing is in automation.
    I do not see a problem in the macro call. If a macro call is simply inserted into a ready-made g-code, is it called without problems?
    The motion queue is important, and it is clear that the macro will not be called at exactly 10,000 seconds.

    A typical macro that I would like to call is 3-4 movement commands in absolute coordinates, to the nozzle cleaning device of excess plastic, and, possibly, the retract command for the active nozzle, to avoid plastic loss at the time of cleaning.


  • administrators

    That would be possible to do. But wouldn't if be better to synchronise it to e.g. a layer change? If the print is interrupted in the middle of printing a curved outer perimeter, then it's likely that a small blemish would result.



  • @anidal said in macros wishlist:

    Automatically, of course. You can manually insert the code in any editor, but the whole essence of 3d printing is in automation.......................

    Sorry but I didn't expect to get into an argument when I simply asked a question. Best of luck............



  • @dc42 said in macros wishlist:

    That would be possible to do. But wouldn't if be better to synchronise it to e.g. a layer change? If the print is interrupted in the middle of printing a curved outer perimeter, then it's likely that a small blemish would result.

    Layer change and tool change can be separated by minutes. And the macro call will be late.



  • @deckingman said in macros wishlist:

    Sorry but I didn't expect to get into an argument when I simply asked a question.

    What a dispute, a detailed answer to the question - does not mean a dispute.


  • administrators

    @anidal said in macros wishlist:

    @dc42 said in macros wishlist:

    That would be possible to do. But wouldn't if be better to synchronise it to e.g. a layer change? If the print is interrupted in the middle of printing a curved outer perimeter, then it's likely that a small blemish would result.

    Layer change and tool change can be separated by minutes. And the macro call will be late.

    Why is it particularly after a tool change (but not immediately after) that you want to do the nozzle cleaning? If you need to prime and clean the nozzle, that can be done in the tpost file. If you want to clean the nozzle at intervals, that can be done in the layer change script - unless you want to do it more often than that.



  • @anidal said in macros wishlist:

    Ок, I try to test M0 function.

    @dc42 said in macros wishlist:

    File cancel.g is only called (instead of stop.g) if M0 is issued while the print is paused.

    Good day!
    I checked the behavior of the M0 function and the macro stop.g
    At a regular print end, stop.g is called if it exists. The behavior is correct.
    But now when you stop printing, the same stop.g is also called! this behavior is completely wrong.
    Event completion of printing and manual stop are 2 different events.
    If you manually stop the printer, you do not need to turn off the printer, and upon completion of printing it may be required.

    Please add a macro end.g to finish printing.


  • administrators

    To stop a print manually, use Pause then Cancel.



  • @dc42 said in macros wishlist:

    To stop a print manually, use Pause then Cancel.

    yes,i do it and stop.g engaged! Not a cancel.g! it is mistake, i think.



  • Can you confirm that cancel.g exists?



  • @phaedrux said in macros wishlist:

    Can you confirm that cancel.g exists?

    I check it today.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.