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

    Cura work-around

    Scheduled Pinned Locked Moved
    Third-party software
    7
    66
    3.3k
    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.
    • jens55undefined
      jens55
      last edited by

      I have an issue with Cura that is driving me slowly insane and I am wondering if there might be a suggestion on how to work around the issue:
      When slicing a model with Cura, before any init gcodes or anything else, Cura inserts a Tn command (where n is the first called extruder for the model) . This is non-negotiable with Cura - it is impossible to remove that initial Tn code unless I edit the g-code file that Cura generates.
      A Jubilee printer can not mount a tool before it is homed so Tn causes all kinds of errors. I was able to circumvent this by issuing a G28 in the Duet start.g file that is executed before the actual g-code file is run.
      So now I have a setup that homes the axis and then loads tool n .... but at this point no temperatures for Tn have been specified by Cura - this happens next.
      The problem is that I would like to setup my tool changer scripts to purge the tool when it is selected but since Cura doesn't specify a temperature when it selects the tool, I get no extrusion/purge because the tool is cold in the beginning.
      My work-around for that is to call for a T-1 which deselects and parks the tool.
      Well Cura then calls an M104 and M109 to set the temperature of the extruder that is now no longer selected. At this point Duet says 'I need to heat up something but I don't know what since no tool is selected so I will select the first tool and mount it'. The first available tool isn't necessarily the tool that Cura would like to use when it starts printing which screws things up again.
      At this point we have a temperature and a tool but because the tool is mounted before it has a chance to heat up, it again doesn't purge.
      The only option that is left is to somehow call another T-1 followed by Tn which now mounts a tool that is hot from before and actually does a purge.
      My head is spinning and trying to think through all this is doing my poor brain no good.
      I am thinking/hoping that other people with tool changers must have these issues while using Cura and there is hopefully a very easy solution for the issue that I have been unable to figure out so far.

      botundefined fcwiltundefined dc42undefined 3 Replies Last reply Reply Quote 0
      • botundefined
        bot @jens55
        last edited by

        The best and easiest workaround might actually be to modify the cura source and build it yourself. This depends on how easy it is to set the project up for compilation. But, once you can build and run cura on your own, it should be dead-simple to find where it inserts that Tn command and remove it, or modify it to your needs.

        *not actually a robot

        jens55undefined 1 Reply Last reply Reply Quote 0
        • fcwiltundefined
          fcwilt @jens55
          last edited by

          @jens55

          I think we discussed this before?

          Could you define a dummy tool?

          Or you can do what I do regards temperatures by not using the slicer to control temperatures. Instead I use the Filament feature of the DWC.

          Frederick

          Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

          jens55undefined 2 Replies Last reply Reply Quote 0
          • jens55undefined
            jens55 @fcwilt
            last edited by

            @fcwilt, we discussed part of this before when it was suggested to use the start.g file.
            Could you tell me more on the dummy tool idea?
            I have never used the filament features of DWC. Do you happen to have a link to more details on that feature?

            fcwiltundefined 1 Reply Last reply Reply Quote 0
            • jens55undefined
              jens55 @bot
              last edited by

              @bot, while that is likely the best solution, it is also well beyond my comfort zone or knowledge level. I wouldn't even know where to start 😞

              botundefined 1 Reply Last reply Reply Quote 0
              • botundefined
                bot @jens55
                last edited by bot

                @jens55 This page appears to have lots of instructions. I would skip the first part about docker, and down to the native compiling instructions for windows or macos. See if you can follow those instructions and get to a point where you can build it.

                This shouldn't require any special programming knowledge or anything. You may have to fumble around a bit, but if you get stuck perhaps someone could help.

                A lot of the difficulty will be in ensuring you have all the dependencies, in the correct versions, and making sure cmake sees all of this but it's really not tooooooo bad.

                *not actually a robot

                jens55undefined 1 Reply Last reply Reply Quote 0
                • jens55undefined
                  jens55 @bot
                  last edited by

                  @bot, you are right, building the package doesn't seem unsurmountable .... but modifying the source code ??? That seems like a real rabbit hole that can only lead to major issues.
                  I will look through the files in a bit more detail to see if there is a chance of me figuring out what to do.

                  botundefined 1 Reply Last reply Reply Quote 0
                  • jens55undefined
                    jens55 @fcwilt
                    last edited by

                    @fcwilt, I found some more detail on the 'filaments' features and will look into that. Thanks !

                    fcwiltundefined 1 Reply Last reply Reply Quote 0
                    • fcwiltundefined
                      fcwilt @jens55
                      last edited by

                      @jens55 said in Cura work-around:

                      @fcwilt, we discussed part of this before when it was suggested to use the start.g file.

                      Could you tell me more on the dummy tool idea?

                      I would but it just pop into my mind while reading your post. I thought if you could define a dummy tool then it could bypass the tool loading feature and not cause a problem because the printer wasn't homed.

                      I have never used the filament features of DWC. Do you happen to have a link to more details on that feature?

                      As to the Filament feature:

                      Filament Feature.jpg

                      When you add a filament the DWC creates a folder for that filament and in that folder it creates three empty files for you to fill in as desired/needed.

                      • load.g
                      • unload.g
                      • config.g (not to be confused with the main config.g)

                      There are three M commands for those files.

                      • M701 runs load.g
                      • M702 runs unload.g
                      • M703 runs config.g

                      I don't use the load/unload files, just the config one.

                      Here is a simplified version of one of my filament config files:

                      M291 R"PLA - Amazon - Copper" P"Configuring..." T0
                      
                      M221 S100 D0   ; set extrusion multiplier
                      G10 S190 R0    ; set extruder temps
                      M140 S60 R0    ; set bed temps
                      
                      M291 R"PLA - Amazon - Copper" P"Configuring - Done" T1
                      

                      The only code I have in my slicer "user" code is M98 P"print_begin.g" and M98 P"print_end.g". That code goes in the obvious places in the slicer.

                      And in those files I have the commands needed to prepare to print and to finish a print.

                      Here is a simplified version of print_begin.g:

                      ; Cura (Repeteir flavor - no temps) inserts the following around the call to this file
                      
                      ;M109 S0                        ; set extruder temp and wait (no wait with S0)
                      ;M82                            ; absolute E moves
                      ;M98 P"print_begin.g"           ; invokes this file
                      ;G92 E0                         ; set E position
                      ;G92 E0                         ; set E position again (have no idea why)
                      ;G1 F1800 E-1                   ; do initial retract
                      
                      ; select tool and configure based on filament selected
                      
                      T0				; select tool 0 so extruder commands below will work
                      M703			        ; configure selected filament (sets bed/extruder temps, extrusion multiplier)
                      
                      ; the following are some "sanity" checks to verify all is good to proceed - they can be whatever is needed/wanted
                      
                      ; check for selected filament
                      
                      if move.extruders[0].filament = ""
                        M291 R"No Filament Selected" P"Cannot Continue" S2 T0
                        abort
                      
                      ; check bed heater active temp setting
                      
                      if heat.heaters[0].active = 0 
                        M291 R"Bed Heater Active Temp = 0" P"Cannot Continue" S2 T0
                        abort
                      
                      ; check extruder heater active temp setting
                      
                      if heat.heaters[1].active = 0 
                        M291 R"Extruder Heater Active Temp = 0" P"Cannot Continue" S2 T0
                        abort
                      
                      ; setup to print
                      
                      G90			; absolute moves
                      G1 Z100     F1200	; position for cleaning
                      G1 X0 Y-145 F6000	; position for cleaning
                      
                      M116		        ; wait for temps to reach set points
                      
                      M83		        ; insure extruder relative mode
                      G92 E0		        ; reset the extruder logical position
                      G1 E20 F120             ; prime the extruder
                      M400			; wait for extruding to finish
                      G92 E0			; reset the extruder logical position
                      
                      M291 R"Clean Nozzle and Bed" P"Click OK to begin printing" S3 T0
                      
                      G1 E-0.1 F120           ; retract to control oosing
                      M400		        ; wait for extruding to finish
                      G92 E0	                ; reset the extruder logical position
                      
                      M98 P"mesh_load.g"      ; load height map as needed
                      

                      The key is the T0/M703 are the start. M703 runs the config file for the current selected filament and sets things up as wanted/needed

                      You could insure that homing is done before the T0 and avoid that issue.

                      Frederick

                      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                      1 Reply Last reply Reply Quote 0
                      • fcwiltundefined
                        fcwilt @jens55
                        last edited by

                        @jens55 said in Cura work-around:

                        @fcwilt, I found some more detail on the 'filaments' features and will look into that. Thanks !

                        Whoops - I just finished posting some info on how I do it.

                        Frederick

                        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                        jens55undefined 2 Replies Last reply Reply Quote 0
                        • botundefined
                          bot @jens55
                          last edited by

                          @jens55 Yeah, don't worry you basically won't need to know any programming.

                          Once you have the source code in a state where you can build it and get the program working. Then, you just have to ctrl+F in the entire codebase (ctrl+shift+f in visual studio) and look for something like "tool change."

                          If that doesn't turn up what you want, you can use a few different approaches. Good codebases will be fairly easy to understand, even if you don't know what the code is doing. The functions should be named in a descriptive manner ie: toolChange() or tool_initialize() or something. There will also be comments.

                          Once you find the place where this happens it will be as simple as replacing a few characters with blank spaces, or removing a line, or adding to it.

                          *not actually a robot

                          resamundefined jens55undefined 2 Replies Last reply Reply Quote 0
                          • resamundefined
                            resam @bot
                            last edited by

                            @jens55 are you using the DuetRRF plugin by any chance?
                            https://github.com/Kriechi/Cura-DuetRRFPlugin

                            Should be easy to add a few lines of code to filter/search/replace the gcode commands in the file before uploading it to your printer.
                            Here might be a good entry point if you know a little bit of Python: https://github.com/Kriechi/Cura-DuetRRFPlugin/blob/6ea133110c3b7e7f142f83247ca03a019676d27e/DuetRRFOutputDevice.py#L264

                            1 Reply Last reply Reply Quote 1
                            • jens55undefined
                              jens55 @fcwilt
                              last edited by

                              @fcwilt said in Cura work-around:

                              @jens55 said in Cura work-around:

                              @fcwilt, I found some more detail on the 'filaments' features and will look into that. Thanks !

                              Whoops - I just finished posting some info on how I do it.

                              Thanks, any input is appreciated and you have given me some more info I didn't have before!

                              1 Reply Last reply Reply Quote 0
                              • jens55undefined
                                jens55 @fcwilt
                                last edited by

                                @fcwilt, a couple (or more) quick questions on the filament system overall concept:

                                Suppose I have a model sliced with Cura and four different filaments defined PLA-Black, PLA-Red', PLA-White and PLA-Green.

                                Do I manually load all the filaments into all the tools or do I just load the first filament to heat up the tool?

                                How do I deal with the requirement to have no tool selected in order to home the printer? This is currently done in start.g .... I would have to unload the filament in order to allow homing which I suppose I can also do in start.g
                                Depending on how long the homing takes, couldn't the tool cool enough to no longer allow extrusion?

                                What is the difference between me manually setting T0 temperature in DWC and me loading a filament - isn't it basically the same? In either case I wait til the nozzle is up to temperature, unload the filament or deselect the tool and then start the Cura print file.

                                I am not seeing the advantage here if all I do is set a temperature and not bother with load.g and unload.g. I suppose if you have more commands in the filament gcode files then it would make sense but for just the temperature?

                                Am I missing something?

                                1 Reply Last reply Reply Quote 0
                                • jens55undefined
                                  jens55 @bot
                                  last edited by

                                  @bot, I thought through your suggestion but decided that it isn't feasible for me. It's been probably a decade since I had a quick look at Visual C and am currently running Linux so I'd have to find some build environment under Linux. I am also anything but fluent in C or C++ or anything else for that matter. Last but not least, I would have to re-learn the whole mess every three or so months when a new version of Cura is released. Unfortunately at my age, my brain does not retain knowledge like this over 3 months of not touching things.
                                  Thank you for your input though, it is an interesting idea and I wish I was able to implement it.

                                  resamundefined jay_s_ukundefined 2 Replies Last reply Reply Quote 1
                                  • resamundefined
                                    resam @jens55
                                    last edited by

                                    @jens55 did you see my post above? no recompile needed, no difficult C knowledge either, just a bit of simple Python that should be easily google-able if you ever have seen a programming language.

                                    Cura even has a built-in Search-Replace PostProcessing plugin script, though I'm not sure if it can access the very early setup commands.

                                    fcwiltundefined jens55undefined 2 Replies Last reply Reply Quote 1
                                    • fcwiltundefined
                                      fcwilt @resam
                                      last edited by

                                      @resam said in Cura work-around:

                                      Cura even has a built-in Search-Replace PostProcessing plugin script, though I'm not sure if it can access the very early setup commands.

                                      Yes it works for that.

                                      Frederick

                                      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                                      1 Reply Last reply Reply Quote 0
                                      • jay_s_ukundefined
                                        jay_s_uk @jens55
                                        last edited by

                                        @jens55 on my toolchanger, i run all the prep stuff as part of start.g
                                        So G32 etc,
                                        Then who cares what tool cura picks as the printer is ready

                                        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                        fcwiltundefined jens55undefined 3 Replies Last reply Reply Quote 0
                                        • jens55undefined
                                          jens55 @resam
                                          last edited by

                                          @resam, yes I did see your post but to be honest I don't know how the DuetRRF plugin (which I use) could be used to help. At first I thought you meant to tell me about the search and replace post processing plugin which I could probably use somehow but again I would have substantial difficulty trying to limit the search/replace to just the very few lines at the beginning of the Cura print code. I am no wizard with regular expressions so I would be looking for a single code block of multiple lines and replacing that. Since the block is likely to change based on slicer settings, it would probably be easier to just edit the code manually which is certainly doable but would be very annoying to do with every re-slice of the model.
                                          It is something I want to try to see just what is involved with it but I am still trying to sort out the filament system and what it can do for me.

                                          1 Reply Last reply Reply Quote 0
                                          • fcwiltundefined
                                            fcwilt @jay_s_uk
                                            last edited by

                                            @jay_s_uk said in Cura work-around:

                                            @jens55 on my toolchanger, i run all the prep stuff as part of start.g
                                            So G32 etc,
                                            Then who cares what tool cura picks as the printer is ready

                                            Do you include anything in your start.g that Cura's code may override, such as a temperature setting?

                                            Just curious.

                                            Frederick

                                            Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

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