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

    Spirograph emulator with Duet2

    Scheduled Pinned Locked Moved
    CNC
    7
    62
    1.9k
    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.
    • o_lampeundefined
      o_lampe @mrehorstdmd
      last edited by

      @mrehorstdmd I guess, the homing sequence is never the same, depending on the starting points of the axis'. When you call random afterwards, the seed will be different.

      1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @mrehorstdmd
        last edited by

        @mrehorstdmd the MCU in Duet 2 doesn't have a true random number generator so it will use the system tick counter as the seed. The tick counter increments at 120MHz once the processor clock has been set up. So even a small change in the timing of e.g. reading config.g from the SD card or homing the axes would change the seed. Let me know if you don't find it to be random, in which case I could look at using the CPU temperature to contribute to the seed too.

        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

        mrehorstdmdundefined 2 Replies Last reply Reply Quote 0
        • mrehorstdmdundefined
          mrehorstdmd @dc42
          last edited by

          @dc42 Thanks! I will try it out and see if I can get it working.

          https://drmrehorst.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • o_lampeundefined
            o_lampe @mrehorstdmd
            last edited by

            @mrehorstdmd A SCARA arm in the center would be nice, but I don't know if RRF supports the 360° working area? @dc42 @JoergS5 ?
            alt text
            The design is 7 years old, I wonder if there are improved designs available, a counterweight would be nice IMHO.

            1 Reply Last reply Reply Quote 0
            • mrehorstdmdundefined
              mrehorstdmd @dc42
              last edited by mrehorstdmd

              @dc42 I'm having some trouble figuring out how to randomly select a file from the /gcodes/ folder. Do I have to put the files names in that folder in an array, or is there a way to declare the contents of the /gcodes/ folder as an array? I currently have about 200 gcode files stored in the /gcodes/ folder, and I add more files to it as I generate them.

              I typically run a macro at the end of the config.g file, like this:

              M98 P"/macros/macro01"
              

              And that macro file looks like this (though much longer):

              ; file name: macro01
              M98 P"/gcodes/wipe_03.gcode"
              M98 P"/gcodes/file_04.gcode"
              G04 S60
              M98 P"/gcodes/wipe_01.gcode"
              M98 P"/gcodes/file_02.gcode"
              G04 S60
              M98 P"/gcodes/wipe_02.gcode"
              M98 P"/gcodes/file_06.gcode"
              .
              .
              .
              

              Should macro01 file look like this:

              ; file name: macro01
              var myfile = {"file_01", "file_02", "file_03", "file_04", "file_05", "file_06"}
              M98 P"/gcodes/^myfile[random 6]^.gcode"
              G04 S60
              M98 P"/gcodes/^myfile[random 6]^.gcode"
              .
              .
              .
              
              

              It seems like I'll quickly run out of line length if I try to put all 200 file names in the variable declaration.

              Another idea- rename all the files in the gcodes folder with simple numeric names:
              1.gcode, 2.gcode.... 212.gcode

              Then in the macro file, select a random pattern file like this:

              M98 P"/gcodes/^{random(212)}^.gcode"
              

              Sorry if this stuff is too basic. I've been away from programming for a looooong time.

              https://drmrehorst.blogspot.com/

              o_lampeundefined 1 Reply Last reply Reply Quote 0
              • o_lampeundefined
                o_lampe @mrehorstdmd
                last edited by

                @mrehorstdmd said in Spirograph emulator with Duet2:

                M98 P"/gcodes/^{random(212)}^.gcode"

                Basically, that's what I'd try too.
                But I'd check, if the file (still) exists before I call M98. Unless you only put files in the gcode directory after you tested it. It would be a PITA to e.g. rename files 123-212 , just because file 122 turned out to be problematic or ugly or boring.

                Alternatively you could edit the unwanted file and only leave the end code. The worst that can happen is running two wipe-file in a row.

                mrehorstdmdundefined 1 Reply Last reply Reply Quote 0
                • mrehorstdmdundefined
                  mrehorstdmd @o_lampe
                  last edited by mrehorstdmd

                  @o_lampe Thanks. All the files are tested, so not an issue. I'll be able to access the machine this afternoon and will try out the random selection. I'm not too sure about the syntax. I've been testing the syntax via the console on my 3D printer and it doesn't look promising. If I enter M98 p"{random(55)}^.gcode" it returns {random(55)}^.gcode not found. It isn't converting the expression to a random number, or even treating it as an expression, just a string of characters. I've tried a few variations on the syntax and none have worked so far.

                  When I run echo random(416) on the console, it returns a random number (sometimes 3 digits), so I know random is working the way it should. Maybe I need to set a variable to a random value, and use that variable in the M98 command.

                  Renaming the files is pretty easy- I used Bulk Rename Utility. It takes just a couple seconds to set it up.

                  https://drmrehorst.blogspot.com/

                  ironhydroxideundefined 1 Reply Last reply Reply Quote 0
                  • ironhydroxideundefined
                    ironhydroxide @mrehorstdmd
                    last edited by

                    @mrehorstdmd said in Spirograph emulator with Duet2:

                    If I enter M98 p"{random(55)}^.gcode" it returns {random(55)}^.gcode not found. It isn't converting the expression to a random number, or even treating it as an expression, just a string of characters. I've tried a few variations on the syntax and none have worked so far.

                    you need to complete the quotation, then append the value, then continue the quotation.

                    M98 P""" <-gives you M98 "
                    ^{random(55)} appends the result of the random 55
                    ^".gcode""" appends the string .gcode"

                    Leaves you with
                    M98 P"randomnumber.gcode"

                    I was wrong,
                    After some testing it seems here's the syntax.

                    M98 P{random(55)}^".gcode"

                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @ironhydroxide
                      last edited by dc42

                      @ironhydroxide the correct syntax is:

                      M98 P{random(55)^".gcode"}

                      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

                      ironhydroxideundefined mrehorstdmdundefined 2 Replies Last reply Reply Quote 1
                      • ironhydroxideundefined
                        ironhydroxide @dc42
                        last edited by

                        @dc42 Thanks for that correction.

                        Tested with my system and it seemed to work the other way (though likely can cause problems when getting more complex)

                        1 Reply Last reply Reply Quote 0
                        • mrehorstdmdundefined
                          mrehorstdmd @dc42
                          last edited by mrehorstdmd

                          @dc42 I have drawing files in /gcodes/draw/ and wipe files in /gcodes/wipe/ folders. All files are renamed with numeric names and gcode extension, like "16.gcode".

                          I have tried about 50 variations on:

                          M98 P{/gcodes/draw/random(214)^".gcode"}
                          and get various error messages, mostly about expecting a string at one column or another.

                          How do I specify the folder to find the target files? Is this syntax documented somewhere?

                          Thanks!

                          m98 P"/gcodes/draw/^{random(22)}^.gcode"
                          Warning: Macro file /gcodes/draw/^{random(22)}^.gcode not found
                          ok
                          M98 P"/gcodes/draw/{random(55)^".gcode"}
                          Warning: Macro file /gcodes/draw/{random(55)^ not found
                          Error: Bad command: gcode"}
                          ok
                          M98 P{/gcodes/draw/{andom(55)^".gcode"}
                          Error:  at column 7: M98: expected an expression
                          ok
                          M98 P{/gcodes/draw/{random(55)^".gcode"}
                          Error:  at column 7: M98: expected an expression
                          ok
                          M98 P{/gcodes/draw/random(55)^".gcode"}
                          Error:  at column 7: M98: expected an expression
                          ok
                          M98 P "/gcodes/draw/{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcode"}
                          ok
                          M98 P "/gcodes/draw/{random(55)^.gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P {/gcodes/draw/random(55)^.gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P{random(55)^".gcode"}
                          Warning: Macro file 39.gcode not found
                          ok
                          M98 P /gcodes/draw/{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcodes/draw/{random(55)^".gcode"}
                          ok
                          M98 P "/gcodes/draw/{random(55)^".gcode"}"
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcode"}"
                          ok
                          M98 P "/gcodes/draw/{random(55)^".gcode"
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcode"
                          ok
                          M98 P "/gcodes/draw/{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcode"}
                          ok
                          M98 P /gcodes/draw/{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcodes/draw/{random(55)^".gcode"}
                          ok
                          M98 P "/gcodes/draw/{random(55)^".gcode"}"
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcode"}"
                          ok
                          M98 P "/gcodes/draw/"^{random(55)^".gcode"}"
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P /gcodes/draw/^{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          Error: Bad command: gcodes/draw/^{random(55)^".gcode"}
                          ok
                          M98 P {/gcodes/draw/random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P {0:/gcodes/draw/random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P "0:/gcodes/draw/"^{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P "0:/gcodes/draw/"{random(55)^".gcode"}
                          Error:  at column 6: M98: expected a string expression
                          ok
                          M98 P"0:/gcodes/draw/"{random(55)^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/ not found
                          ok
                          M98 P{0:/gcodes/draw/random(55)^".gcode"}
                          Error:  at column 8: M98: expected '}'
                          ok
                          M98 P"{0:/gcodes/draw/random(55)"^".gcode"}
                          Warning: Macro file {0:/gcodes/draw/random(55) not found
                          ok
                          M98 P"0:/gcodes/draw/{random(55)"^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/{random(55) not found
                          ok
                          M98 P"0:/gcodes/draw/{random(55)}"^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/{random(55)} not found
                          ok
                          M98 P"0:/gcodes/draw/{random(55)}"^".gcode"
                          Warning: Macro file 0:/gcodes/draw/{random(55)} not found
                          ok
                          M98 P"0:/gcodes/draw/"{random(55)}"^".gcode"
                          Warning: Macro file 0:/gcodes/draw/ not found
                          Error: Bad command: gcode"
                          ok
                          M98 P"0:/gcodes/draw/"^{random(55)}"^".gcode"
                          Warning: Macro file 0:/gcodes/draw/ not found
                          Error: Bad command: gcode"
                          ok
                          M98 P"0:/gcodes/draw/"^{random(55)}^".gcode"
                          Warning: Macro file 0:/gcodes/draw/ not found
                          ok
                          M98 P"0:/gcodes/draw/"^{random(55)^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/ not found
                          ok
                          M98 P"0:/gcodes/draw/"^"{random(55)^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/ not found
                          Error: Bad command: gcode"}
                          ok
                          M98 P"0:/gcodes/draw/^"{random(55)^".gcode"}
                          Warning: Macro file 0:/gcodes/draw/^ not found
                          ok
                          
                          

                          https://drmrehorst.blogspot.com/

                          dc42undefined 1 Reply Last reply Reply Quote 0
                          • dc42undefined
                            dc42 administrators @mrehorstdmd
                            last edited by

                            @mrehorstdmd try this:

                            M98 P{"/gcodes/draw/"^random(214)^".gcode"}

                            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

                            mrehorstdmdundefined 1 Reply Last reply Reply Quote 1
                            • mrehorstdmdundefined
                              mrehorstdmd @dc42
                              last edited by

                              @dc42 That's it! Thanks!

                              https://drmrehorst.blogspot.com/

                              1 Reply Last reply Reply Quote 0
                              • o_lampeundefined
                                o_lampe
                                last edited by

                                The Slim Delta is alive and I could reach areas outside of the triangle.
                                The problem is, how do I tell RRF that it mustn't foul the towers?
                                I know there are people using that for their leadscrew area and such, but I couldn't find it in the Wiki.
                                far_out.jpg

                                o_lampeundefined 1 Reply Last reply Reply Quote 0
                                • o_lampeundefined
                                  o_lampe @o_lampe
                                  last edited by

                                  Just found out that M599 can define keep out zones. But searching for "keep out" in the Wiki gave no result...
                                  Bad news is, it only works on Duet3 boards due to RAM restrictions.

                                  Guess I can build a few sandify patterns, that match such an odd working area, but wipe-patterns usually apply to rectangular or polar areas only

                                  droftartsundefined 1 Reply Last reply Reply Quote 0
                                  • droftartsundefined
                                    droftarts administrators @o_lampe
                                    last edited by

                                    @o_lampe said in Spirograph emulator with Duet2:

                                    The problem is, how do I tell RRF that it mustn't foul the towers?

                                    As far as I'm aware there's no way for the firmware to do that. I guess you need to control that when slicing. I'd say it was rare to design a machine with the axes inside the build area.

                                    @o_lampe said in Spirograph emulator with Duet2:

                                    Just found out that M599 can define keep out zones.

                                    Currently only one keep out zone is supported, and the job will be aborted with an error message if the toolhead tries to move inside that zone.

                                    Ian

                                    Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                    o_lampeundefined 1 Reply Last reply Reply Quote 0
                                    • o_lampeundefined
                                      o_lampe @droftarts
                                      last edited by o_lampe

                                      @droftarts said in Spirograph emulator with Duet2:

                                      I'd say it was rare to design a machine with the axes inside the build area.

                                      You're right, but I wanted the footprint of the table aka delta tower-triangle to be small.

                                      I got a nice 38cm dia glasstable with a predrilled footprint of 320mm. I'll have to place the towers accordingly.
                                      VidaXL.jpg

                                      @droftarts said in Spirograph emulator with Duet2:

                                      Currently only one keep out zone is supported

                                      Guess, I have to write a postprocessor which takes care of three keepout zones and doesn't quit the job.

                                      mrehorstdmdundefined 1 Reply Last reply Reply Quote 0
                                      • mrehorstdmdundefined
                                        mrehorstdmd @o_lampe
                                        last edited by

                                        @o_lampe What do you plan to use to generate the drawing and erase pattern files? Maybe the keepout areas can be defined there.

                                        You can do all sorts of stuff with post processors. I use a PERL post processor to set the speed of moves on my table. It steps through the pattern file and determines whether each line of gcode draws on the table or moves the ball along the edges. If it's edge motion, it executes it at high speed (usually 1000 mm/sec), and if it's drawing on the table it executes at a lower speed (to preserve detail in the drawing).

                                        https://drmrehorst.blogspot.com/

                                        o_lampeundefined 1 Reply Last reply Reply Quote 0
                                        • o_lampeundefined
                                          o_lampe @mrehorstdmd
                                          last edited by

                                          @mrehorstdmd Currently I'm using Sandify, but I can also produce gcode from .dxf files. With inkscape I could theoreticaly use any bitmap to generate patterns and I could manually drag every knot of a path out of the zones.
                                          I used it frequently, when my K40 laser was new.

                                          I haven't thought to look elsewhere, but if others (CNC or laser scene? ) have the same problem with keep out zones, I'd be happy to know.
                                          Is the PERL post processor open source? I'm looking for a good starting point to write my own.(open file, modify gcode lines, write new file)

                                          mrehorstdmdundefined 1 Reply Last reply Reply Quote 0
                                          • mrehorstdmdundefined
                                            mrehorstdmd @o_lampe
                                            last edited by mrehorstdmd

                                            @o_lampe Here's my PERL script for dual speed operation. I used a LOT of notes to make it easy for me to modify or fix because I don't do a lot of programming and have to relearn it for each project.

                                            This is how it is invoked:

                                            E:\Downloads>perl -w dual_speedify_v2.pl
                                            
                                            Warning- there's no error trapping, so be careful when you answer
                                            the questions that will follow. Use at your own risk!
                                            
                                            Type the name of the sandify pattern file:
                                            250519_01.gcode
                                            Enter the drawing speed in mm/sec
                                            150
                                            Enter the edge speed in mm/sec
                                            1000
                                            Enter the minimum X value of the pattern.
                                            0
                                            Enter the maximum X value of the pattern.
                                            590
                                            Enter the minimum Y value of the pattern.
                                            0
                                            Enter the maximum Y value of the pattern.
                                            980
                                            Enter the home position X ordinate.
                                            590
                                            Enter the home position Y ordinate.
                                            0
                                            
                                            Processing is complete.
                                            
                                            The dual speed output file is called 250519_01_9000_60000.gcode
                                            
                                            Check the output file to make sure it does what you think it will.
                                            
                                            

                                            And the attached file is the result. 250519_01_9000_60000.gcode ]

                                            https://drmrehorst.blogspot.com/

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