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

Macro for cleaning and purging nozzle

Scheduled Pinned Locked Moved
Gcode meta commands
2
54
6.1k
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
    fcwilt @Exerqtor
    last edited by 10 Jun 2022, 22:59

    @exerqtor said in Macro for cleaning and purging nozzle:

    @fcwilt
    Yeah it's getting more and more tempting, not gonna lie!

    I saw your syntax profile has some minor bugs that should be pretty easy to iron out i guess. Don't know how "translateable" the syntax highlighting part is from the DWC sourcecode over to that of EditPad though.

    Actually I was mistaken. It's the DWC Editor that has it wrong. It threw me off for a bit because mine worked differently. A little more study shows mine is correct - or at least "less wrong".

    Consider this from the DWC editor:

    DWC Highlite Issue 1.png

    The text global.g_tool_exists is the name of a variable and should be all one color - the color assigned to variables.

    But the global part seems to be treated the same as if. Both assigned the color for reserved words.

    The 0 seems to be treated as a number even though it is part of the variable name

    The exists seems to be treated as a function even thought it is part of the variable name.

    Now here it is in EditPad Pro

    FCW Highlite Example 1.png

    In the second line you can see exists is recognized as a function but works fine as part of the variable name

    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

    undefined 1 Reply Last reply 11 Jun 2022, 06:48 Reply Quote 0
    • undefined
      Exerqtor @fcwilt
      last edited by Exerqtor 6 Nov 2022, 07:16 11 Jun 2022, 06:48

      @fcwilt said in Macro for cleaning and purging nozzle:

      @exerqtor said in Macro for cleaning and purging nozzle:

      @fcwilt
      Yeah it's getting more and more tempting, not gonna lie!

      I saw your syntax profile has some minor bugs that should be pretty easy to iron out i guess. Don't know how "translateable" the syntax highlighting part is from the DWC sourcecode over to that of EditPad though.

      Actually I was mistaken. It's the DWC Editor that has it wrong. It threw me off for a bit because mine worked differently. A little more study shows mine is correct - or at least "less wrong".

      Consider this from the DWC editor:

      DWC Highlite Issue 1.png

      The text global.g_tool_exists is the name of a variable and should be all one color - the color assigned to variables.

      But the global part seems to be treated the same as if. Both assigned the color for reserved words.

      The 0 seems to be treated as a number even though it is part of the variable name

      The exists seems to be treated as a function even thought it is part of the variable name.

      Now here it is in EditPad Pro

      FCW Highlite Example 1.png

      In the second line you can see exists is recognized as a function but works fine as part of the variable name

      Hm yeah i see what you mean, i must admit i prefer the way it's shown in DWC though.

      The operators are different in DWC too:
      Operator.png

      While in EditPad they are all one color.

      Given that you're an actual programmer, have you taken a look at the DWC source code for any "pointers"?

      undefined 1 Reply Last reply 11 Jun 2022, 08:19 Reply Quote 0
      • undefined
        fcwilt @Exerqtor
        last edited by 11 Jun 2022, 08:19

        @exerqtor said in Macro for cleaning and purging nozzle:

        Hm yeah i see what you mean, i must admit i prefer the way it's shown in DWC though.

        You don't mind that one thing, a variable name, is incorrectly identified and has colors applied to it for four different things - reserved word, variable name, numeric value and function?

        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

        undefined 1 Reply Last reply 11 Jun 2022, 08:33 Reply Quote 0
        • undefined
          Exerqtor @fcwilt
          last edited by Exerqtor 6 Nov 2022, 08:33 11 Jun 2022, 08:33

          @fcwilt
          Clearly not to the extent it does you 🀣

          For the record:
          @chrishamm said in Making Notepad++ look like DWC g-code editor?:

          @exerqtor You can have a look at https://github.com/Duet3D/DuetWebControl/tree/master/src/components/dialogs/FileEditDialog for details about the syntax parsing/highlighting in DWC. Because the current CodeMirror component is rather outdated now, I may eventually replace it with something else in v3.5.

          So that behaviour might be something that get's reworked in v3.5.

          undefined 1 Reply Last reply 11 Jun 2022, 08:41 Reply Quote 0
          • undefined
            fcwilt @Exerqtor
            last edited by 11 Jun 2022, 08:41

            @exerqtor said in Macro for cleaning and purging nozzle:

            So that behaviour might be something that get's reworked in v3.5.

            That is interesting. Thanks for the info.

            It does need to be worked on, as it failing to correctly analyze the code and to properly highlight the syntactical elements.

            I could create a scheme which duplicated the way the DWC editor works - but then they would both be wrong.

            And then that would be two things that needed fixing instead of just one! πŸ€• πŸ€• >> πŸ˜‚ πŸ˜‚

            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

            undefined 1 Reply Last reply 11 Jun 2022, 08:48 Reply Quote 0
            • undefined
              Exerqtor @fcwilt
              last edited by Exerqtor 6 Nov 2022, 09:12 11 Jun 2022, 08:48

              @fcwilt
              Yeah i totally agree with what your saying.

              And just to clarify i prefer how it LOOKS in DWC, as it makes it easier for my peasant brain to break up/visualise the different parts of the code.

              I think we have a somewhat different view of this since you actually know what you're looking at, while i'm trying to make best of what i'm seeing based on self thought knowledge learned by trial and error.

              undefined 1 Reply Last reply 11 Jun 2022, 09:41 Reply Quote 0
              • undefined
                fcwilt @Exerqtor
                last edited by 11 Jun 2022, 09:41

                @exerqtor said in Macro for cleaning and purging nozzle:

                And just to clarify i prefer how it LOOKS in DWC, as it makes it easier for my peasant brain to break up/visualise the different parts of the code.

                You don't have a "peasant" brain - that much is obvious.

                But can you explain how applying four different colors, three of them wrong, to that one variable name helps you?

                The goal is to identify syntactical elements as clearly as possible without overly cluttering the display with too many colors.

                For example, RRF has a handful each of reserved words and functions. You wouldn't want to color each reserved word or function differently. All reserved words should be of one color, all functions of perhaps another color.

                These are the elements I am currently identifying (sorry it's so small - it's a screen shot):

                FCW Syntactical Elemements.png

                Notice that I am picking out three types of numbers: hexadecimal, float and integer. Now the syntax editor allows assigning a different color to every identified kind of element but the default palette colors them all the same - to reduce clutter.

                You have a large selection of palettes to chose from - and you can create your own:

                Syntax Editor Palettes.png

                So between being able to design you own syntax identification scheme and your own palette you should be happy as a clam at high tide! 😁

                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

                undefined 2 Replies Last reply 11 Jun 2022, 10:35 Reply Quote 0
                • undefined
                  Exerqtor @fcwilt
                  last edited by 11 Jun 2022, 10:35

                  But can you explain how applying four different colors, three of them wrong, to that one variable name helps you?
                  The goal is to identify syntactical elements as clearly as possible without overly cluttering the display with too many colors.

                  Probably me looking at it in the wrong light with the if global.g_tool_0_exists example from the get-go so to say πŸ˜… I get what you mean now!

                  For example, RRF has a handful each of reserved words and functions. You wouldn't want to color each reserved word or function differently. All reserved words should be of one color, all functions of perhaps another color.
                  These are the elements I am currently identifying (sorry it's so small - it's a screen shot):

                  And it's no problem with small text (yet), i'm still relatively young and my eyesight haven't went all to shit yet lol.

                  For instance, in DWC declaring a variable or global shows the global/var in yellow and the variable that's getting created as white.
                  But with your syntax scheme all they are put in one color, is that also "correct" so to say? (trying to get a grasp of things here, so sorry if the questions are odd at times).

                  Shouldn't / couldn't there be a element in the syntaxing scheme called Variable type that makes global/var definable as it's own color.

                  I think that would make spotting an error like forgetting to put a space between var/global and the variable itself way more easy to spot, for trouble shoting etc.

                  So between being able to design you own syntax identification scheme and your own palette you should be happy as a clam at high tide!
                  Frederick

                  Regarding the color palette, i'm at full tilt playing with it as we speak, trying it out. I'm about to jump the gun on acquiring a license so i can play with it more.

                  __

                  EditPad, syntaxing & highlightingspeak aside (we should much rather start a thread in "General Discussion" or "Third-party software" for that subject and reference this thread so we don't clutter it up to muchπŸ˜‚).

                  I've made v2.0 of the macro with left/right purge position done conditionally (in EditPadπŸ˜…) :
                  nozzle_scrub_v2.0.g

                  undefined 1 Reply Last reply 11 Jun 2022, 13:34 Reply Quote 1
                  • undefined
                    Exerqtor @fcwilt
                    last edited by 11 Jun 2022, 11:00

                    @fcwilt
                    I created a new thread for the EditPad syntaxing and coloring discussion 😁

                    1 Reply Last reply Reply Quote 1
                    • undefined Exerqtor referenced this topic 11 Jun 2022, 11:14
                    • undefined Exerqtor referenced this topic 11 Jun 2022, 11:17
                    • undefined
                      fcwilt @Exerqtor
                      last edited by 11 Jun 2022, 13:34

                      @exerqtor said in Macro for cleaning and purging nozzle:

                      For instance, in DWC declaring a variable or global shows the global/var in yellow and the variable that's getting created as white.

                      But with your syntax scheme all they are put in one color, is that also "correct" so to say? (trying to get a grasp of things here, so sorry if the questions are odd at times).

                      Shouldn't / couldn't there be a element in the syntaxing scheme called Variable type that makes global/var definable as it's own color.

                      You certainly could do it that way. That is one of the grand things about EditPad - giving you access and the tools to control the syntax highlighting.

                      I took the simple approach and used global and var as the identifier that indicated a variable name was about to follow. And that meant the same color for both parts.

                      But you will notice that I have a separated Variable Declaration from Variables so it's just a question of changing Variable Declaration part. It may need to be two parts - one to find and color global and var - the other to find and color the name that follows.

                      There are things in the syntax coloring editor called sub-schemes - I have looked at them yet and what they are for.

                      With regular expressions you can do an awful lot, far more than I can do without more study.

                      I've made v2.0 of the macro with left/right purge position done conditionally (in EditPadπŸ˜…) :
                      nozzle_scrub_v2.0.g

                      I will take a look.

                      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

                      undefined 1 Reply Last reply 11 Jun 2022, 13:56 Reply Quote 0
                      • undefined
                        Exerqtor @fcwilt
                        last edited by Exerqtor 6 Nov 2022, 13:57 11 Jun 2022, 13:56

                        @fcwilt

                        Found a bug that's been driving me crazy and polished the rest a bit, so now i think it's more or less done:
                        nozzle_scrub_v2.1.g

                        Been tested both cold and hot, and now finally works like expected 😁😁

                        undefined 1 Reply Last reply 11 Jun 2022, 14:20 Reply Quote 0
                        • undefined
                          fcwilt @Exerqtor
                          last edited by 11 Jun 2022, 14:20

                          @exerqtor said in Macro for cleaning and purging nozzle:

                          @fcwilt

                          Found a bug that's been driving me crazy and polished the rest a bit, so now i think it's more or less done:
                          nozzle_scrub_v2.1.g

                          Been tested both cold and hot, and now finally works like expected 😁😁

                          Glad to hear you got it sorted - knew you would - good job.

                          Returning to what I mentioned in the near past: an example of using conditional code, instead of math, to make code comprehension a bit easier. Basically it computes and saves the two X positions that are used once before the loop and in the loop itself.

                          ; Position for wipe. Either left or right of brush based on var.pos to avoid unnecessary travel after purging
                          var pos1 = 0
                          var pos2 = 0
                          if var.pos = 0
                          set var.pos1 = var.brush_start
                          set var.pos2 = var.brush_start + var.brush_width
                          else
                          set var.pos1 = var.brush_start + var.brush_width
                          set var.pos2 = var.brush_start
                          G1 Z{var.brush_top + var.clearance_z} F{var.prep_spd_z}
                          G1 X{var.pos1} F{var.prep_spd_xy}
                          ; Move in to the brush.
                          G1 Y{var.brush_front + (var.brush_depth / 2)}
                          ; Move nozzle down into brush.
                          G1 Z{var.brush_top} F{var.prep_spd_z}
                          ; Perform wipe. Wipe direction based off pos for cool random scrubby routine.
                          while true
                          G1 X{var.pos2} F{var.wipe_spd_xy}
                          G1 X{var.pos1}
                          if iterations = var.wipe_qty + 1
                          break

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

                          undefined 1 Reply Last reply 11 Jun 2022, 16:27 Reply Quote 0
                          • undefined
                            Exerqtor @fcwilt
                            last edited by 11 Jun 2022, 16:27

                            @fcwilt
                            You couldn't be more correct!
                            nozzle_scrub_v2.2.g

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