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

Macro to assist with using object cancellation

Scheduled Pinned Locked Moved
Beta Firmware
6
18
940
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.
  • undefined
    ChrisP @dc42
    last edited by ChrisP 5 Feb 2020, 15:06 2 May 2020, 15:00

    @dc42 said in Macro to assist with using object cancellation:

    Were you printing that file when you ran the macro? Object names are only added to the list as the machine starts printing them.

    At the time I ran the macro and the M409 I'm pretty certain that at least 1 layer of all four objects had been printed. However, its a quick print so I'll try again just to double check...

    @bot said in Macro to assist with using object cancellation:

    If that is the case, would it be possible to add support for pre-labeling the objects in the header/comment area of the Gcode file? That way, you could start a print and cancel an object right away even if that object had not been "encountered" yet by the gcode interpreter.

    Assuming that objects just get added to the object list as/when they are first encountered, this should be easy to do with a post process. What would be neat is if running a simulation (or post-print) could then prepend this to the g-code file.

    edit: I've just checked and yes, I get the same results as above even after n>0 layers of all parts have been printed.

    undefined 1 Reply Last reply 2 May 2020, 15:50 Reply Quote 0
    • undefined
      dc42 administrators @ChrisP
      last edited by 2 May 2020, 15:50

      Thanks. It sounds to me that DCS isn't yet passing the comments on to RRF.

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      undefined 1 Reply Last reply 2 May 2020, 17:12 Reply Quote 0
      • undefined
        ChrisP @dc42
        last edited by ChrisP 5 Feb 2020, 17:40 2 May 2020, 17:12

        @dc42 said in Macro to assist with using object cancellation:

        Thanks. It sounds to me that DCS isn't yet passing the comments on to RRF.

        One for @chrishamm, I guess then.

        To get around this issue, I post-processed the file to replace PrusaSlicer's labels with M486 commands and can now see them fine in the OM 🙂
        However, the macro still has an issue as I get the following error when I run it:
        2020-05-02.png

        I've made sure that all the lines are inset correctly and I've also found that if I insert an extra echo iterations on line 6 then that line works but subsequent ones fail and terminate the macro
        2020-05-02 (2).png
        If I then comment the last 3 lines, but leave my addition, I see the expected output in the console, so the issue seems to be when "iterations" is used as an argument.

        Is this perhaps another issue with the way DCS is passing the comments?

        undefined 1 Reply Last reply 4 May 2020, 11:28 Reply Quote 0
        • undefined
          OwenD
          last edited by 3 May 2020, 01:18

          I found that if you pass M291 using anything but the S3 parameter, or use M117, then you get that error about iterations being called while not being in a loop.

          This is my code which works.
          Cura calls all supports "NON MESH" so I haven't worked out how to post process to identify what support goes with what object yet

          if !{state.status="processing"}
          M291 P"Not printing" R"Error" S1 T7
          abort "Not printing"
          if {job.layer<2}
          M291 P"Not all objects may be detected yet. Continue?" R"Warning" S3
          G4 S0.5
          if {(#job.build.objects=null) || (#job.build.objects=0)}
          M291 P"No objects detected. Check slicer or wait till end of first layer" R"Error" S2
          ;abort "No objects"
          ;if {(job.build.currentObject=null) || (job.build.currentObject=-1)}
          ; M291 P"Current print move is not a print object" R"Not a print object" S2
          ; abort "not a print object"
          echo #job.build.objects
          while iterations < #job.build.objects
          if job.build.objects[ iterations ].cancelled
          echo "Obect " ^ iterations ^ already cancelled
          continue
          M291 P{(job.build.objects[iterations].name)} R"Delete?" S3
          ;M486 P{iterations}
          G4 S1
          echo "Finished"
          undefined 1 Reply Last reply 3 May 2020, 08:29 Reply Quote 0
          • undefined
            ChrisP @OwenD
            last edited by 3 May 2020, 08:29

            @OwenD
            Interesting. What's your Duet setup? For now I was just starting with @dc42's macro as I assumed it should work for at least whatever setups he has. Have you tried this one & did it work for you?

            undefined 1 Reply Last reply 3 May 2020, 09:02 Reply Quote 0
            • undefined
              OwenD @ChrisP
              last edited by 3 May 2020, 09:02

              @ChrisP said in Macro to assist with using object cancellation:

              @OwenD
              Interesting. What's your Duet setup? For now I was just starting with @dc42's macro as I assumed it should work for at least whatever setups he has. Have you tried this one & did it work for you?

              Board: Duet 2 WiFi (2WiFi)
              Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.01-RC11 (2020-04-30b3)
              Duet WiFi Server Version: 1.23
              Duet Web Control 2.1.6

              I have run it and it works.
              I'm just running a test with supports (sliced in Cura)
              I'm not sure if I can identify the supports and as they'll be outside the X,Y of the object it might fail.
              Will report back shortly

              1 Reply Last reply Reply Quote 0
              • undefined
                OwenD
                last edited by OwenD 5 Mar 2020, 10:05 3 May 2020, 10:04

                As I suspected, in Cura at least the supports aren't identified as objects by RRF
                That will require some post processing to get working (or the Cura devs to change their code)
                However the code does cancel the obects.
                NOTE: THERE WAS A SYNTAX ERROR IN THE ABOVE CODE

                Corrected code here

                if !{state.status="processing"}
                M291 P"Not printing" R"Error" S1 T7
                abort "Not printing"
                if {job.layer<2}
                M291 P"Not all objects may be detected yet. Continue?" R"Warning" S3
                G4 S0.5
                if {(#job.build.objects=null) || (#job.build.objects=0)}
                M291 P"No objects detected. Check slicer or wait till end of first layer" R"Error" S2
                ;abort "No objects"
                ;if {(job.build.currentObject=null) || (job.build.currentObject=-1)}
                ; M291 P"Current print move is not a print object" R"Not a print object" S2
                ; abort "not a print object"
                while iterations < #job.build.objects
                echo "check object " ^ iterations + 1
                if job.build.objects[ iterations ].cancelled
                echo "Obect " ^ iterations ^ "already cancelled"
                G4 S2
                continue
                M291 P{(job.build.objects[iterations].name)} R"Delete?" S3
                M486 P{iterations}
                G4 S2
                echo "Finished"

                objects_cura.jpg

                1 Reply Last reply Reply Quote 0
                • undefined
                  ChrisP
                  last edited by 3 May 2020, 10:10

                  I have just tried @dc42's macro with my system setup in standalone mode rather than the D3+SBC setup I tried yesterday and can confirm that it works fine & as intended.
                  So I guess that's a bug in the way DCS handles the "iterations" variable in meta commands?

                  @OwenD
                  Thanks for sharing your macro, it covers off a couple of edge cases from a user perspective when displaying details 👍

                  undefined 1 Reply Last reply 3 May 2020, 10:23 Reply Quote 0
                  • undefined
                    OwenD @ChrisP
                    last edited by 3 May 2020, 10:23

                    @OwenD
                    Thanks for sharing your macro, it covers off a couple of edge cases from a user perspective when displaying details 👍

                    No Problem.
                    My macro won't work as it should until there's a third option for M291 that will allow us to skip over objects.
                    At present you can't cancel object two until you have done object one.

                    1 Reply Last reply Reply Quote 1
                    • undefined
                      chrishamm administrators @ChrisP
                      last edited by chrishamm 5 Apr 2020, 11:29 4 May 2020, 11:28

                      @ChrisP This will be fixed in the next versions. For now, you can work-around this problem by putting iterations into curly brackets. Something like job.build.objects[{iterations}].x[0] should work.

                      The next DCS version will send whole line comments to RRF, too.

                      Duet software engineer

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