FlatCam 8.994 BETA crushes on drill slots or holes

Issue #619 new
alxkos.mail created an issue

Hey, searched for solution, the issue is known, and even saw the commit made, but still crushes

Here is a simple project with only slots (cutted from my bigger project), trying to mill the slots the app crashes.

Please help! Cannot finish my work without it…

Thanks

Comments (19)

  1. Marius Stanciu

    Hi,

    I assume that you are trying to use the Milling Plugin from my fork. That was fixed in my last commit.
    But you can also mill slots using the Utilities from the Excellon Properties Tab (left side of the screen).

    Click on it, select above the tool that needs to be milled, modify the milling diameter to fit your tool and click Mill Slots button. BTW, the ‘Mill Slots’ button will not be enabled unless the tool is selected in the Tools Table and the selected tool has slots.

    Best regards,
    Marius

  2. Danylo Ulianych

    I’m having the same issue using the master branch latest commits. When I select PTH or NPTH, it does nothing when I click “Generate CNCJob object” in the Drilling tool. The console shows the error message in the lower left corner: “An internal error has occurred. See shell”.

    Ubuntu 22.04, Python 3.9. I’ve set up the requirements as described in #626.

    Update 1

    I found similar issues #599 and #611. The proposed fix worked for PTH but not for NPTH (mounting holes). In NPTH I’m getting another issue:

    Traceback (most recent call last):
      File "/home/dizcza/tools/flatcam/appObjects/AppObject.py", line 162, in new_object
        return_value = initialize(obj, self.app)
      File "/home/dizcza/tools/flatcam/appTools/ToolDrilling.py", line 1803, in job_init
        tool_points += points[tool]
    KeyError: 3
    

    There are 2 circular and 1 oval mounting holes in NPTH. The Drilling tool parses the file as follows:

    I don’t know what a Slot in FlatCam is but maybe this causes the issue. Because I debugged the offending line and found that the length of the points list is only 2, not 3. Excellon Path optimization is set to TSA. “MetaHeuristic” has the same issue. “Basic” fails with the log message described in one of the issues I linked.

  3. Marius Stanciu

    Hi,
    The mentioned Shell is not the Unix Shell but the TCL Shell from within the app (Menu → Tools → Command Line (Shorcut Key: “S”).

    Try the slightly updated 8.994 version from here: https://bitbucket.org/marius_stanciu/flatcam_beta/branch/Beta

    Or, if you feel brave, try on the same repo the branch:
    https://bitbucket.org/marius_stanciu/flatcam_beta/branch/Beta_8.995
    that has many fixes but some missing functionality but quite a lot of fixes.
    My truly latest commits are though in this branch:
    https://bitbucket.org/marius_stanciu/flatcam_beta/branch/gerber_editor_upgrade

    Pay attention to the requirements.txt file.
    Starting with 8.995 I use PyQt6.

  4. Marius Stanciu

    Hello,

    Beta 8.995 require a virtual environment where you install all the requirements. That is so it does not interfere with whatever packages you might have installed as main Python toolchain. If you do that, and run the app from that virtual environment, it should run without errors.

    Regarding your errors, please post a link with the file you are using and which fails and let me know what version you are using, I'll try to relate it.

  5. Danylo Ulianych

    @Marius regarding Beta 8.995 installation. I cannot create issues on your fork, so I’m posting it here. Of course, I created a new conda env for this.

    Issue 1

    I was facing a problem installing gdal from the requirements.txt file. Please be aware that the users should install gdal version that matches the system package GDAL. It’s easy the check:

    $ gdal-config --version
    3.4.1
    $ pip install gdal==3.4.1
    

    With this fix, the installation succeeded.

    Issue 2

    Launching FlatCam.py throws

    $ python FlatCAM.py 
    Traceback (most recent call last):
      File "/home/dizcza/Downloads/flatcam_beta/FlatCAM.py", line 8, in <module>
        from appMain import App
      File "/home/dizcza/Downloads/flatcam_beta/appMain.py", line 44, in <module>
        import qdarktheme.themes.dark.stylesheet as qdarksheet
    ModuleNotFoundError: No module named 'qdarktheme.themes'
    

    but I did install the package. Then I followed suggestions in https://aur.archlinux.org/packages/flatcam-qt6

    diff --git a/appMain.py b/appMain.py
    index d93eba3c..1f58a6cc 100644
    --- a/appMain.py
    +++ b/appMain.py
    @@ -40,10 +40,6 @@ import socket
    
     import tkinter as tk
    
    -import qdarktheme
    -import qdarktheme.themes.dark.stylesheet as qdarksheet
    -import qdarktheme.themes.light.stylesheet as qlightsheet
    -
     # ####################################################################################################################
     # ###################################      Imports part of FlatCAM       #############################################
     # ####################################################################################################################
    @@ -612,22 +608,7 @@ class App(QtCore.QObject):
                 self.options[def_key] = deepcopy(def_val)
    
             # self.preferencesUiManager.show_preferences_gui()
    -
    -        # Set global_theme based on appearance
    -        if self.options["global_appearance"] == 'auto':
    -            if darkdetect.isDark():
    -                theme = 'dark'
    -            else:
    -                theme = 'light'
    -        else:
    -            if self.options["global_appearance"] == 'default':
    -                theme = 'default'
    -            elif self.options["global_appearance"] == 'dark':
    -                theme = 'dark'
    -            else:
    -                theme = 'light'
    -
    -        self.options["global_theme"] = theme
    +        self.options["global_theme"] = 'light'
    
             self.app_units = self.options["units"]
             self.default_units = self.defaults["units"]
    @@ -636,18 +617,6 @@ class App(QtCore.QObject):
                 self.decimals = int(self.options['decimals_metric'])
             else:
                 self.decimals = int(self.options['decimals_inch'])
    -
    -        if self.options["global_theme"] == 'default':
    -            self.resource_location = 'assets/resources'
    -        elif self.options["global_theme"] == 'light':
    -            self.resource_location = 'assets/resources'
    -            qlightsheet.STYLE_SHEET = light_style_sheet.L_STYLE_SHEET
    -            self.qapp.setStyleSheet(qdarktheme.load_stylesheet('light'))
    -        else:
    -            self.resource_location = 'assets/resources/dark_resources'
    -            qdarksheet.STYLE_SHEET = dark_style_sheet.D_STYLE_SHEET
    -            self.qapp.setStyleSheet(qdarktheme.load_stylesheet())
    -
             # ###########################################################################################################
             # ####################################### Auto-complete KEYWORDS ############################################
             # ######################## Setup after the Defaults class was instantiated ##################################
    

    and with these changes, I’m getting Issue no. 3

    Issue 3

    Launching FlatCam shows “a critical error” popup with the following traceback:

    2023-01-16 11:02:43.222451
    Traceback (most recent call last):
      File "/home/dizcza/Downloads/flatcam_beta/FlatCAM.py", line 161, in <module>
        fc = App(qapp=app)
      File "/home/dizcza/Downloads/flatcam_beta/appMain.py", line 910, in __init__
        splash_pix = QtGui.QPixmap(self.resource_location + '/splash.png')
    AttributeError: 'App' object has no attribute 'resource_location'
    

    I gave up on this step :) I’ve done it pretty far though.

  6. Marius Stanciu

    Hi,
    The error you got in Issue 3 is because you commented out relevant code, specifically this:

            if self.options["global_theme"] == 'default':
                self.resource_location = 'assets/resources'
            elif self.options["global_theme"] == 'light':
                self.resource_location = 'assets/resources'
                qlightsheet.STYLE_SHEET = light_style_sheet.L_STYLE_SHEET
                self.qapp.setStyleSheet(qdarktheme.load_stylesheet('light'))
            else:
                self.resource_location = 'assets/resources/dark_resources'
                qdarksheet.STYLE_SHEET = dark_style_sheet.D_STYLE_SHEET
                self.qapp.setStyleSheet(qdarktheme.load_stylesheet())
    

    It looks like the developer of the pyqtdarktheme made some changes in the last version so in order for this to work, use the version 1.1.1 of this module. That is the reason for your Issue 2.

    I will test your file and come back with the results.

  7. Marius Stanciu

    BTW, use the latest sources, I just fixed a decoding error in the Excellon Parser.
    Otherwise here is how your file GCode looks like using the default params/settings:

  8. Danylo Ulianych

    I confirm that your Beta 8.995 works with pyqtdarktheme==1.1.1.

    Regarding the NPTH, I don’t see any command to drill the bottom oval-shaped hole. Here is the pic

  9. Danylo Ulianych

    I also got a segfault trying to open a project from beta 8.994. Had I clicked “proceed”, I wouldn’t mind a segfault. But I hit Cancel.

  10. Marius Stanciu

    The “oval hole” is not a hole that can be drilled using the Drilling Tool. It is a so-called “slot” which can be milled using a milling bit, essentially a cutting action.
    This can be done from the Excellon Properties Tab, click the Utilities button which will expand a section. Click on the Tool that has the slots in the Tools Table above and have it selected. In the previously expanded Utilities section, now the Milling Slot button is enabled and the field to enter the diameter of the milling bit.
    By clicking the “Mill Slots” button it will create a geometry that has to be processed as usual.

  11. Danylo Ulianych

    Dear me! You’ve added the auto-leveling feature with heatmaps for MACH3! That’s precisely what I’ve been looking for! I was feeling sick today thinking that I’ll need to implement such a feature on my own since I’ve found no solutions for MACH3 heatmaps. How does the machine save the output txt file - are there any instructions one needs to follow in their UI window to save the heatmap? (Save for enabling a digital probing pin in the settings.).

    And please share an example of such a txt heatmap file. Or post a link if it’s already on the web.

    Thanks.

  12. Danylo Ulianych

    BTW, Levelling Grid mode & Voronoi method does not work:

    CNCJobObject.generate_voronoi_geometry_2() --> module 'numpy' has no attribute 'float'
    

    But Bilinear seems to work fine. Also, in order to change from the Voronoi to Bilinear, I need to select Manual and then back to Grid. Otherwise, the radiobuttons for Voronoi and Bilinear are greyed out.

  13. Marius Stanciu

    That is not finished yet, and whatever data that is generated it’s not applied on the GCode at the moment. It is work in progress.

  14. Danylo Ulianych

    I’d really like to see it going. What’s the status you’ve already implemented? Please point me to the relevant code in your fork, I’ll have a look. As I need to do pcb milling this week (for the first time in my life), I need to come up with an ad hoc solution. It’s sad that the machine we have (MACH3) is a bit worn-out and the Z precision is really out of luck. Maybe I’ll just measure each corner of the 70x90 cm board manually and write down the Z positions. But I still need a (rough and crude) script to optimize the output CNC for the Z level I’ll be measuring.

    Can you also point to resources/code/discussions on how the Z leveling heatmap is applied to the actual CNC code elsewhere? I cannot find it open source. I know that cnc-3018 pro supports Z heatmap adjustment but could not find the relevant scripts either.

  15. Marius Stanciu

    Hi,
    Sorry but I put a pause on the development since the summer, I hope to resume it in a few months.
    One other thing is that I started this Autolevelling Tool a while back so I too have to reacquaint with the code I’ve written.

    Basically the grid/Voronoi is nearly there in generating a matrix of Z points, the bilinear is still not implemented. Looks like since last time I worked on it, the dependencies modules (Foronoi) were updated and some breaking changes has risen (the one you mentioned) - numpy was updated too and the numpy float type (np.float) was removed.

    In the branch that is current:
    https://bitbucket.org/marius_stanciu/flatcam_beta/branch/gerber_editor_upgrade

    I have added modifications that allow the generation of the MACH3 probing GCode. But now this Levelling Tool will not be enabled unless the Geometry (and therefore the succeeding CNCJob) are generated with segmented geometry set here (default values are 0.0 which by default do not allow levelling):

    If you click the Add Probe Points button with the Plot Probing Points checkbox On you get a image like this:

    and by clicking the Save Probing GCode button and saving a Probing GCode file which can be used in Mach3 and with the end command M40, Mach3 will automatically save a “heatmap” file.

    And this is the point where we stop for the time being as the app needs more development.

  16. Danylo Ulianych

    I see. So I’ll still need to find a way to apply the saved heatmap then…

    I found this tool useful https://www.autoleveller.co.uk/. It does a decent job but it’s on Windows (I could not install it on Linux).

    Anyway, glad that Flatcam is not stuck in development.

  17. Log in to comment