Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Randomizing print location?

    General Discussion
    7
    15
    141
    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.
    • zapta
      zapta last edited by

      I am printing now repeatedly the same object and it's getting harder and harder to remove it, as if there is some impact on the contact area on the bed (PEI sheet).

      Is there a way to introduce some GCODE randomness such that each print will at a slightly different location? A bed saver if you like.

      (Currently I rotate the magnetic bed cover by 90degrees every few prints).

      1 Reply Last reply Reply Quote 0
      • A Former User
        A Former User last edited by

        (interesting, keeping an eye on this)

        1 Reply Last reply Reply Quote 0
        • mrehorstdmd
          mrehorstdmd last edited by

          I have been interested in some randomizing function for a while. I want to select gcode files at random to run on my sandtable.

          https://drmrehorst.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • bot
            bot last edited by

            Couldn't you just change where you want it to print by manually setting the origin to a different spot?

            *not actually a robot

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

              @bot, do you mean moving in the slicer? I uploaded the model once to duet and it works so my preference is to stick to this gcode file and keep printing it.

              bot 1 Reply Last reply Reply Quote 0
              • A Former User
                A Former User last edited by

                Are you running RRF2 or RRF3? The latter may allow you to find some pseudo random variables in the object model stuff and apply a work offset before printing?

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

                  @zapta I meant like, after you home your X/Y axes, you can move them to any point on the bed, and use G92 to define that point as something else. This way you can offset the print any direction arbitrarily by offsetting the coordinates.

                  *not actually a robot

                  1 Reply Last reply Reply Quote 0
                  • Danal
                    Danal last edited by Danal

                    Yes, easily, manually before a print.

                    • G10 L2 P2 Xnn Ynn ; Set the offset. nnn can be positive or negative numbers.
                    • G55 ; Turn on the offset by enabling Work Coordinate System 2 (the P2 in the above command)
                    • G54 ; Turn off the offset by going back to WCS 1

                    Example: If an object with a "footprint" of 50x50 was printing in the middle of a 300x300 bed, it would have about 125mm all around it.

                    G10 L2 P2 X-50 Y50
                    G55

                    From the console. The numbers could be +/- roughly 125... but don't cut it too close...

                    Delta / Kossel printer fanatic

                    zapta 1 Reply Last reply Reply Quote 0
                    • zapta
                      zapta @Danal last edited by

                      @Danal, any idea how to set the x/y offset randomly for each print?

                      @bearer, I am using RRF2 but it's on my TODO to switch to RFF3.

                      Danal 1 Reply Last reply Reply Quote 0
                      • mrehorstdmd
                        mrehorstdmd last edited by

                        What type of filament are you printing with? How about cleaning the bed between prints? Maybe lowering the bed temperature would do the job. I print PETG on a 45C bed. Prints stick fine while printing and come off pretty easily when the bed cools.

                        https://drmrehorst.blogspot.com/

                        1 Reply Last reply Reply Quote 0
                        • Danal
                          Danal @zapta last edited by Danal

                          @zapta said in Randomizing print location?:

                          @Danal, any idea how to set the x/y offset randomly for each print?

                          @bearer, I am using RRF2 but it's on my TODO to switch to RFF3.

                          Sure.

                          Almost all slicers allow for an automated post-process script. Put

                          G10 L2 P2 Xrandom Yrandom 
                          G55
                          

                          (literally random, as shown) in the start gcode (and G54 in your end gcode if you wish).

                          Then, invoke a post-processing script in your choice of languages that include a random function, and decent string searching.

                          Example Python:

                          import random
                          with open('[this will vary by slicer]', 'r') as input_gcode_file:
                              gcode = input_gcode_file.read()
                          gcode = gcode.replace('Xnnn', 'X'+str(random.randint(-10,10)))
                          gcode = gcode.replace('Ynnn', 'Y'+str(random.randint(-10,10)))
                          with open('[this will vary by slicer]', 'w') as output_gcode_file:
                              output_gcode_file.write(gcode)
                          

                          It could be done in PERL, Basic, whatever. And, Python programmers who are reading this, forgive me, there are about a million other more "Python-ish" ways to do it, the above is very brute force and therefore more readable for non-Python people.

                          (Code is untested; should work!)

                          Delta / Kossel printer fanatic

                          1 Reply Last reply Reply Quote 1
                          • A Former User
                            A Former User last edited by

                            Post processing doesn't solve the desire to upload the file once and just keep reprinting it.

                            1 Reply Last reply Reply Quote 0
                            • Danal
                              Danal last edited by

                              Absolutely true. Randomizing repeated prints that repeat in the printer will require random() in the printer. Sort of obvious when phrased that way.

                              Although... why repeat in the printer? Why not have the gcode sitting somewhere that you can 'push one button' or 'run one command' and the g-code is processed (random offset) again, pushed to the printer, and a print kicked off.

                              Lot's of ways to get things done.

                              Delta / Kossel printer fanatic

                              deckingman 1 Reply Last reply Reply Quote 0
                              • deckingman
                                deckingman @Danal last edited by deckingman

                                @Danal said in Randomizing print location?:

                                Lot's of ways to get things done.

                                Yup. Another one would be to use a print surface that doesn't wear out. (I expect this will lead to a lot of incoming from the PEI fan club so I'll don my tin hat now).

                                Ian
                                https://somei3deas.wordpress.com/
                                https://www.youtube.com/@deckingman

                                1 Reply Last reply Reply Quote 1
                                • dc42
                                  dc42 administrators last edited by

                                  If running RRF 3.01RC you could generate two pseudo-random numbers from the object model and those in a G10 L2 P1 command to adjust the X and Y workplace coordinate offsets.

                                  Here are some ideas for generating pseudo-random numbers from the number of seconds that the Duet has been running:

                                  sin(radians(state.upTime))
                                  cos(radians(state.upTime*3))
                                  mod(state.upTime,15)

                                  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

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