You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

    Testing on Turkey Slices


    To define the effectiveness of the CNC and discover possible faults, we test ARTS 2.0 on turkey slices.

    Since Lightburn is not made for milling with spindle, the G-code has to be post-processed through a python code as per now.

    G-code post processing
    def post_process_gcode(input_file, output_file):
        add_custom_command = True
        add_M5_before_M9 = True
    
        # Open the input file in read mode
        with open(input_file, 'r') as f:
            lines = f.readlines()
    
        # Open the output file in write mode
        with open(output_file, 'w') as f:
            for line in lines:
                # Check if the line is a rapid move command (G0) with Z10
                if add_M5_before_M9 == False:
                    f.write(line)
                elif line.startswith('G0') and 'Z10' in line:
                    # Change rapid move command to linear move (G1) with Z10
                    modified_line = line.replace('G0', 'G1')
                    if(add_custom_command==True):
                        for newline in lines:
                            if newline.startswith('G1'):
                                spindle_speed = "S" + newline.split('S', 1)[-1].strip()  # Extracting all characters after "S" including "S"
                                print(spindle_speed)
                                break
                        #modified_line+=spindle_speed
                        modified_line = "M3" + "\n" + modified_line.strip() + spindle_speed + "\n"
                        print(modified_line)
                    f.write(modified_line)
                    add_custom_command = False
    
                elif line.startswith('G1') and 'S' in line:
                    no_spindle_g1 = newline.split('S', 1)[0].strip() + "\n" # Extracting all characters after "S" including "S"
                    f.write(no_spindle_g1)
                # Check if the line is a spindle stop command (M5) or spindle start command (M3)
                elif line.startswith('M5') or line.startswith('M3'):
                    # Ignore these commands until M9
                    pass
                # Check if the line is the spindle stop command (M9)
                elif line.startswith('M9'):
                    # Add M5 before M9
                    if add_M5_before_M9:
                        f.write('M5\n')
                        add_M5_before_M9 = False
                    # Write the line as it is
                    f.write(line)
                else:
                    # Write the line as it is
                    f.write(line)
    
    # Example usage
    if __name__ == "__main__":
        input_file = 'Cutting_samples_2S_100p.gc'
        output_file = 'PP_Cutting_samples_2S_100p.gc'
        post_process_gcode(input_file, output_file)
        print("G-code post-processing complete!")
    
    


    Summary

    Slice Settings Status Comments Future change
    1

    Speed: 10mm/s

    Power: 100%

    Failure Too fast. Slow down
    2

    Speed: 2mm/s

    Power: 100%

    Failure Did not cut all the way through.  Lower the spindle.


      Slice 1

      CNC cut too fast. Mill pushed the slice around slightly.


      Image 

      Slice 2

      Samples had a difficulty coming loose. 

      Mill pushed the slice around slightly.


      Image 




      • No labels