Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Referencing other filament-specific gcode files?

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    3
    6
    226
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • paralepsisundefined
      paralepsis
      last edited by

      I've taken the time to convert to volumetric printing and am taking advantage of the filament capabilities of RRF to have per-filament diameter, extrusion mult., retraction, advance, etc. This has pulled much of the filament-specific code out of my sliced gcode files, which is awesome. I have stock calibration gcode files I can just run; I can swap a filament mid-print and immediately adjust my configuration to be right for the new filament, and there's just one place where all this information is being maintained.

      I'd like to keep going with this, and specifically I'd like to be able to define per-filament temperatures. I print primarily in PETG, and I've found it necessary to use a different temperature for initial layers than for latter ones. Thus I cannot simply use a single execution of M703 to do the job.

      It feels like I could use gcode metacommands to do what I want, if I could insert them at start of layers. I could do this by having a specific macro file and using M98 to call it. However, ideally I would do this in a filament-specific manner as M703 does.

      The most obvious thing I could do is misuse M703 somehow and use it as a per-layer macro rather than its original intention, but that just feels awful. I guess I'm really wishing that there were an M704 that would execute a generic, filament-specific macro, which I could then use for this purpose.

      Are there other solutions that come to mind?

      Thanks!

      Railcore II 300XL w/ Duet 3 & RRF 3.5rc4, Makerbot R2X w/ Duet 2 WiFi & RRF 3.4

      1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        Look into M505

        https://duet3d.dozuki.com/Wiki/Gcode#Section_M505_Set_configuration_file_folder

        Lets you change between completely separate system folders

        Z-Bot CoreXY Build | Thingiverse Profile

        paralepsisundefined 1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD
          last edited by OwenD

          I think we will soon have the ability to pass parameters to macros which will make this sort of thing easier.
          At present I think you're going to have to use the "on layer change" function of your slicer to call one or more macros and do the logic there.
          In Prusa slicer you can use conditions to call different macros depending on the layer height.
          Here I've used the filament type to build the file path.
          You would need two macros for each filament which is messy.

          ;set temp per filament
          {if layer_num < 2} 
          M98 P"[filament_type]_1st_layer.g"
          {else} 
          M98 P"[filament_type]_2nd_layer.g"
          {endif}
          

          Output is

          ;set temp per filament - layer 0
           M98 P"ABS_1st_layer.g"
          
          ;set temp per filament - layer 1
          M98 P"ABS_1st_layer.g"
          

          Probably better to call a single macro and do your conditional logic in there.

          in the Prusa slicer layer change

          M98 P"set_[filament_type].g"
          

          in set_PLA.g

          if job.layer < 2
          	G10 S195 R80
          else
          	G10 S180 R80
          

          edit: You could of course call M703 and do the logic in there
          I use this in my start gcode

          T[current_extruder] ; select tool 
          G10 S0 R0 T[current_extruder] ; Set temps to zero to stop slicer adding them
          M106 P[current_extruder] S0 ;Start with fan off
          M701 S"[filament_type]"; define filament 
          ; All retraction and temp settings done in 0:/filaments/[filament_type]/config.g
          M703 ; load config file for [filament_type]
          
          paralepsisundefined 1 Reply Last reply Reply Quote 1
          • paralepsisundefined
            paralepsis @Phaedrux
            last edited by

            @Phaedrux Oh that's interesting but also heavyweight! I'll have a look.

            Railcore II 300XL w/ Duet 3 & RRF 3.5rc4, Makerbot R2X w/ Duet 2 WiFi & RRF 3.4

            paralepsisundefined 1 Reply Last reply Reply Quote 0
            • paralepsisundefined
              paralepsis @OwenD
              last edited by

              @OwenD Thanks. Yes, I was thinking I would initiate from the PrusaSlicer layer change custom code. I may just have to look for creative ways to store a variable or something...

              Railcore II 300XL w/ Duet 3 & RRF 3.5rc4, Makerbot R2X w/ Duet 2 WiFi & RRF 3.4

              1 Reply Last reply Reply Quote 0
              • paralepsisundefined
                paralepsis @paralepsis
                last edited by

                @paralepsis Ah, M28 looks like it might be better, can write the name of the filament-specific layer.g into a known location? This sort of thing.

                Thanks all for your thoughts!

                Railcore II 300XL w/ Duet 3 & RRF 3.5rc4, Makerbot R2X w/ Duet 2 WiFi & RRF 3.4

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA