Scope of modal commands called from within macros



  • Hello,

    is there somewhere an overview which modal commands like e.g. G54, G90, G91... are limited in their effect to the macro scope and which are global?
    Currently when testing 2.03RC1 it caught me by surprise that G54, G55.... are not restricted to the macro scope. I thought this was the case with 2.02 but I might be wrong...

    Regards,
    Marc


  • administrators

    G53 has modal scope of the current line of GCode.

    When running macros, the following parameters are saved at the start and restored at the end: movement absolute/relative mode, extrusion absolute/relative mode, feed rate (G1 F parameter), and volumetric extrusion on/off. In the forthcoming 2.03RC1 firmware also the inches/mm setting.

    I can add to this list if there is general agreement on what items to add.

    HTH David



  • Thank you for the clarification. I think generally it is hard to define which should be modal and which not for all cases. What about an additional g-code that limits all modal commands on a line to the scope of a macro.
    Or even more advanced mechanisms where the user can start and stop a new scope similar to C/C++ (e.g. Gxx.1 starting and Gxx.2 stopping a scope and even a Gyy in front of a modal command to render it global)?


  • administrators

    You can already declare local scopes using the M120 and M121 commands. The values saved and restored are the same ones as for macros.

    Do you think the current workplace number (selected by G54, G55 etc.) should be saved and restored too? On the plus side, you would be able to reserve certain workplace coordinate numbers for use by particular macros, knowing that at the end of the macro you would be back in the original workplace number. On the minus side, you would not be able to have a macro that switches to a different workplace number and leaves the system in that workplace when you exit the macro. I think I'll start a new thread about this.


 

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