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

Feedrate reformatting post script

Scheduled Pinned Locked Moved
3D Printing General Chat
3
7
310
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
    justinkg
    last edited by 29 Nov 2023, 14:55

    I am looking for help with writing a post process script to adjust the formatting of the feedrate call outs from PrusaSlicer.

    Right now the format is like this:
    1 G1 E.1 F2400
    2 ;TYPE:Skirt/Brim
    3 ;WIDTH:1.7
    4 G1 F4799.988
    5 G1 X487.836 Y463.711 E.82895

    But this causes issues where my machine doesn't recognize the G1 F4799.988 command and maintains the feed rate of F2400 from line 1.

    I need it to look something like this (which comes from Simplify3D, but I want to use organic tree supports).

    6 G1 Z0.900 F1800
    7 G1 X483.600 Y469.844 F21000
    8 G1 X490.044 Y463.400 E4.6282 F3600
    9 G1 X549.956 Y463.400 E35.0570

    Any help would be appreciated.

    undefined undefined 2 Replies Last reply 29 Nov 2023, 14:59 Reply Quote 0
    • undefined
      jay_s_uk @justinkg
      last edited by 29 Nov 2023, 14:59

      @justinkg it would be better to tell us what firmware you are running so the "bug" can be addressed rather than trying to fix the output.
      Lots of people use prusaslicer.
      A sample gcode file would also b e helpful

      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

      1 Reply Last reply Reply Quote 0
      • undefined
        justinkg
        last edited by 29 Nov 2023, 16:03

        The machine uses a yaskawa controller and apparently how it interprets the gcode is part of the firmware. No way for me to change anything in there. The slicer firmware is RepRap/Sprinter.

        undefined 1 Reply Last reply 29 Nov 2023, 16:28 Reply Quote 0
        • undefined
          jay_s_uk @justinkg
          last edited by 29 Nov 2023, 16:28

          @justinkg oh, so nothing to do with RRF. You're just after general help. gotcha

          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

          1 Reply Last reply Reply Quote 0
          • undefined Phaedrux moved this topic from Gcode meta commands 29 Nov 2023, 18:03
          • undefined
            justinkg
            last edited by 29 Nov 2023, 18:14

            Yeah. From what I can gather. I need to write a script to go through the entire gcode and automate moving the feedrate to the end of the following line. I am going to try to write it in python, but its been a while.

            1 Reply Last reply Reply Quote 0
            • undefined
              OwenD @justinkg
              last edited by 29 Nov 2023, 19:30

              @justinkg
              Just a guess as I have no experience with Yaskawa controllers.
              However some CNC controllers accept a feed rate command on its own
              So try changing
              G1 F3600
              to
              F3600

              1 Reply Last reply Reply Quote 0
              • undefined
                justinkg
                last edited by justinkg 30 Nov 2023, 14:04

                I was able to write a script in python that does what I want. Posting it here for others to reference if needed.

                import sys
                import re

                flag = False

                out = open('YOUR FILE NAME HERE'+'_adjusted'+'.gcode', 'w')

                with open('YOUR FILE NAME HERE.gcode') as f:
                for r in f:
                if re.search('G1 F', r):
                feedrate = r[3:]
                flag = True
                print(r[:-1] + ' ' + feedrate) # get rid of new line
                elif flag:
                r = r[:-1] + ' ' + feedrate
                out.write(r)
                flag = False # Reset flag
                else:
                out.write(r)
                flag = False # Reset flag

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