TclCommandDrillcncjob fetching tool diameter from "C" member instead of "tooldia"

Issue #568 new
Krzysztof Kluczek created an issue

At TclCommandDrillcncjob.py:151 in 8.994 source tree.

Look like the drill tool structure naming was refactored, but the change was not applied everywhere.

Previously Excellon tool diameters were stored at index “C” (as per NC Drill code naming), but recently this field got renamed to “tooldia”.

TclCommandDrillcncjob.py still uses old naming, crashing the command with “KeyError: ‘C'“ exception, failing the command.
As it is, it’s impossible to select subset of tools for drillcncjob with -drilled-dias currently.

Could you please do a global search for [“C”] and ['C'] and make sure they are either correct or need to be updated to [“tooldia”]?
Seems there are quite a few places using this field, seemingly fetching a diameter from it.

(sadly, I can’t check if this fixes this issue, as I can’t get FlatCam to run from sources under Windows at the moment - some rasterio/GDAL problems)

Comments (3)

  1. Marius Stanciu

    Hi,

    A lot of those issues, including those created by running with Python 3.10 are already solved in my working copy. While there are still issues in my working copy, you can check it out and let me know what issues you find there (check the Issues section for those already known),
    Also, in my working copy if gdal si rasterio packages give you trouble then you could simply not install them and the app will work although the Import Image plugin will no longer be available.
    https://bitbucket.org/marius_stanciu/flatcam_beta/branch/Beta_8.995
    https://bitbucket.org/marius_stanciu/flatcam_beta/get/Beta_8.995.zip
    Thanks,
    Marius

    PS: I only push changes here on the Beta branch when a new release is done.

    LE: the above branch is based on PyQt6 and it is not permitted for PyQt5 and PyQt6 to coexist so either uninstall PyQt5 packages or use a virtual environment.

  2. Krzysztof Kluczek reporter

    Ok, I managed to get the above source zip to run.

    Yet, it crashed on missing key “las_min_pwr” now.

    2022-02-01 19:09:33.275317
    Traceback (most recent call last):
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 420, in handle_finished
        self.raise_tcl_unknown_error(self.error)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 263, in raise_tcl_unknown_error
        raise unknown_exception
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 341, in execute_call
        self.output = self.execute(args, unnamed_args)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommandCncjob.py", line 289, in execute
        local_tools_dict[tool_uid]['data']['tools_mill_min_power'] = args["las_min_pwr"]
    KeyError: 'las_min_pwr'
    

    After commenting the mentioned line out, I’ve got two more internal errors:

    [ERROR] An internal error has occurred. See shell.
    Object (cncjob) failed because: 'int' object is not iterable 
    
    Traceback (most recent call last):
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\appObjects\AppObject.py", line 168, in new_object
        return_value = initialize(obj, self.app)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommandDrillcncjob.py", line 368, in job_init
        ret_val = job_obj.tcl_gcode_from_excellon_by_tool(obj, tools, is_first=True, use_ui=False)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\camlib.py", line 4144, in tcl_gcode_from_excellon_by_tool
        tools = [i for i, j in sorted_tools for k in selected_tools if i == k]
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\camlib.py", line 4144, in <listcomp>
        tools = [i for i, j in sorted_tools for k in selected_tools if i == k]
    TypeError: 'int' object is not iterable
    

    As well as:

    2022-02-01 19:12:20.155387
    Traceback (most recent call last):
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 420, in handle_finished
        self.raise_tcl_unknown_error(self.error)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 263, in raise_tcl_unknown_error
        raise unknown_exception
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommand.py", line 341, in execute_call
        self.output = self.execute(args, unnamed_args)
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\tclCommands\TclCommandCncjob.py", line 140, in execute
        args["z_cut"] = args["z_cut"] if "z_cut" in args and args["z_cut"] else self.app.defaults["geometry_cutz"]
      File "c:\Downloads\marius_stanciu-flatcam_beta-52a0efb62e7d\defaults.py", line 890, in __getitem__
        return self.defaults.__getitem__(item)
    KeyError: 'geometry_cutz'
    

    Rocky road so far. :)

  3. Marius Stanciu

    Hi,

    Well, the Tcl commands is a subject that left to myself I would not have touched in a while. Yet, other users needed them so I started to work on them but it was quite tiresome so some things were not made as was supposed too. Like the key 'geometry_cutz' that should have been modified to 'tools_mill_cutz'. in the process I identified another.
    Regarding the key 'las_min_pwr' I fixed one thing and I botched another. Should be also fixed now.

    For the rest, without knowing what you are doing (the Tcl command with the parameters that you have used) there is not much I can do.

  4. Log in to comment