BETA: Toolchange always enabled - breaks GRBL support - fixed for next version

Issue #461 new
Dr. med. Jan Schiefer created an issue

Regardless if I only have one single tool or if I have “Tool change Z“ enabled or disabled the toolchange GCODE is always insered into my gcode.

This breaks GRBL controllers with only a single tool and manual toolchange.

This bug has benn introduced to the code in the last month.

(CODE GENERATED BY FLATCAM v8.994 - www.flatcam.org - Version Date: 2020/11/7)



(Name: clapposc-F_Cu.gbr_iso_combined_cnc)(Type: G-code from Geometry)(Units: MM)

(Created on Sonntag, 08 November 2020 at 17:27)



(This preprocessor is used with a motion controller loaded with GRBL firmware.)(It is configured to be compatible with almost any version of GRBL firmware.)



(TOOL DIAMETER: 0.4982 mm)(Feedrate_XY: 120.0 mm/min)(Feedrate_Z: 60.0 mm/min)(Feedrate rapids 1500.0 mm/min)



(Z_Cut: -0.0899 mm)(DepthPerCut: 0.045 mm <=>2 passes)(Z_Move: 2.0 mm)(Z Start: None mm)(Z End: 3.0 mm)(X,Y End: None mm)(Steps per circle: 64)(Steps per circle: 64)(Preprocessor Geometry: GRBL_11_no_M6)  IT IS THE SAME WITH ALL PREPROCESSORS



(X range:    0.2836 ...   51.7164  mm)(Y range:  -35.7164 ...   -0.2836  mm)



(Spindle Speed: 1000.0 RPM)G21G90G17G94




G01 F120.00

/////////////////// UNNECESSARY CODE STARTS HERE



M5G00 Z1.0000G00 X0.0000 Y0.0000           

T1<--- THIS BREAKS SINGLE-TOOL GRBL-MACHINES

(MSG, Change to Tool Dia = 0.4982)M0 <--- THIS BREAKS SINGLE-TOOL GRBL-MACHINESG00 Z1.0000 

/////////////////// UNNECESSARY CODE ENDS HEREM03  S1000.0G4 P1.0G01 F120.00G00 X0.2836 Y-1.0330
()


Comments (15)

  1. Marius Stanciu

    Hi,
    This is not a bug but a feature introduced on purpose. Unfortunately, due of the GRBL limitations, it made FlatCAM beta GCode incompatible with GRBL controllers which is another thing.
    I will try to find a way to disable this for the case of GRBL code.

  2. Dr. med. Jan Schiefer reporter

    Thank you!

    Unfortunately I’m not the Python guy, so I cannot submit a patch myself.

    I’m hoping for a quick and easy fix.

  3. DJ legion

    HI, I have the same problem with the latest download. It no longer works with my Workbee CNC using Duet controller. I will have to go back a version.

  4. Cyrill S. Kouzmine

    Try to use ‘Toolchange manual’ preprocesor with pause/resume and ‘(MSG…’ commands. I this case there are no any ‘T1' commands And if you have only one tool also you don’t have pause-change-resume cycles.

    Works fine wih grbl1.1f.

  5. Alan Wood

    Albeit a dated thread but connected - is there a Config setting / switch that removes the M0 or a switch to remove the tool change sequence completely ?

    Alan

  6. Marius Stanciu

    Hi,
    Nothing changed from the above, I’ve put development on hold for the time being. If there were any other solutions I would have mentioned them.
    BR,
    Marius

  7. Alan Wood

    Hi Marius, good to hear from you and I hope all is well.

    Reason for the post was regarding the Prefs/Geometry/Geometry Options the Tool Change and Enable Dwell tick boxes.

    Tool change seems to be there in the resulting code all the time even if the boxes are not ticked.

    Not a big issue in that I can edit the resulting code.

    Keep safe and kind regards

    Alan

  8. John

    I recently got a 3018 CNC, and FlatCAM is clearly the best software I’ve found so far, so this bug has basically made the software useless for me. Since this bug has been here for years, and development is on hold, it’s either fix it, edit every gcode file I output, or stop using FlatCAM before I really start to like it. SO… here’s a quick and dirty fix.

    This is found in “camlib.py” starting on line 3155. There are a couple of options I can think of, like appending a condition to the second if statement to rule out GRBL machines, but since I’m not familiar with the code, I’m just going to comment out the gcode I don’t want.

    From this:

    for tool in tools:
    
                # Only if tool has points.
                if tool in points:
                    # Tool change sequence (optional)
                    if toolchange:
                        gcode += "G00 Z%.4f\n" % toolchangez
                        gcode += "T%d\n" % int(tool)  # Indicate tool slot (for automatic tool changer)
                        gcode += "M5\n"  # Spindle Stop
                        gcode += "M6\n"  # Tool change
                        gcode += "(MSG, Change to tool dia=%.4f)\n" % exobj.tools[tool]["C"]
                        gcode += "M0\n"  # Temporary machine stop
                        if self.spindlespeed is not None:
                            # Spindle start with configured speed
                            gcode += "M03 S%d\n" % int(self.spindlespeed)
                        else:
                            gcode += "M03\n"  # Spindle start
    
                    # Drillling!
                    for point in points[tool]:
                        x, y = point.coords.xy
                        gcode += t % (x[0], y[0])
                        gcode += down + up_to_zero + up
    
            gcode += t % (0, 0)
            gcode += "M05\n"  # Spindle stop
    
            self.gcode = gcode
    

    to this:

    for tool in tools:
    
                # Only if tool has points.
                if tool in points:
                    # Tool change sequence (optional)
                    if toolchange:
                        # gcode += "G00 Z%.4f\n" % toolchangez
                        # gcode += "T%d\n" % int(tool)  # Indicate tool slot (for automatic tool changer)
                        # gcode += "M5\n"  # Spindle Stop
                        # gcode += "M6\n"  # Tool change
                        # gcode += "(MSG, Change to tool dia=%.4f)\n" % exobj.tools[tool]["C"]
                        # gcode += "M0\n"  # Temporary machine stop
                        if self.spindlespeed is not None:
                            # Spindle start with configured speed
                            gcode += "M03 S%d\n" % int(self.spindlespeed)
                        else:
                            gcode += "M03\n"  # Spindle start
    
                    # Drillling!
                    for point in points[tool]:
                        x, y = point.coords.xy
                        gcode += t % (x[0], y[0])
                        gcode += down + up_to_zero + up
    
            gcode += t % (0, 0)
            gcode += "M05\n"  # Spindle stop
    
            self.gcode = gcode
    

    I’m not home at the moment, so I haven’t had a chance to try it out, but I’m quite confident it will work, because it prevents the program from EVER adding these lines to the gcode, so if you don’t use GRBL or have multiple machines, take appropriate measures to make sure you don’t break a feature you sometimes find useful.

  9. Log in to comment