coddingtonbear / barbari

Automates Flatcam generation of G-code for my (and maybe your) PCB milling process
10 stars 3 forks source link

FlatCAM version? #7

Closed ondras12345 closed 1 year ago

ondras12345 commented 1 year ago

Hi, I haven't been able to make FlatCAM work with TCL scripts. I have installed from https://bitbucket.org/jpcgt/flatcam/downloads/FlatCAM_beta_8.994_sources.zip I have generated a script for a simple board:

barbari build-script test/gerber simple

And tried to run it in FlatCAM. However, I got the following output:

FlatCAM 8.994 - Type >help< to get started

Gerber processing. Parsing 26 lines.
Gerber processing. Joining polygons: 4.
Gerber processing. Applying Gerber polarity.
New object with name: edge_cuts. 0.028851 seconds executing initialize().
[SUCCESS] Opened: /home/ondra/temp/barbari/test/gerber/RPi-eth-override-Edge_Cuts.gbr
Gerber processing. Parsing 71 lines.
Gerber processing. Joining polygons: 7.
Gerber processing. Applying Gerber polarity.
New object with name: f_cu. 0.021785 seconds executing initialize().
[SUCCESS] Opened: /home/ondra/temp/barbari/test/gerber/RPi-eth-override-F_Cu.gbr
New object with name: drill. 0.005774 seconds executing initialize().
[SUCCESS] Opened: /home/ondra/temp/barbari/test/gerber/RPi-eth-override.drl
Gerber processing. Parsing 323 lines.
Gerber processing. Joining polygons: 40.
Gerber processing. Applying Gerber polarity.
New object with name: b_cu. 0.073606 seconds executing initialize().
[SUCCESS] Opened: /home/ondra/temp/barbari/test/gerber/RPi-eth-override-B_Cu.gbr
New object with name: edge_cuts_aligndrill. 0.001483 seconds executing initialize().
[SUCCESS] Done.
ERROR Report: 'ExcellonObject' object has no attribute 'drills'
Python traceback: <class 'AttributeError'>
  File "/home/ondra/temp/FlatCAM_beta_8.994_sources/tclCommands/TclCommandMillDrills.py", line 96, in execute > if not obj.drills:
  File "/home/ondra/temp/FlatCAM_beta_8.994_sources/tclCommands/TclCommand.py", line 343, in execute_call > self.output = self.execute(args, unnamed_args)
    while executing
"milldrills edge_cuts_aligndrill -tooldia 1.5 -milled_dias 3.4 -outname edge_cuts_aligndrill_path"
[SUCCESS] TCL script file opened in Code Editor and executed.

Have you encountered this issue before? How did you fix it? I tried to google it, but there were 0 results.

I know this is most likely a bug in FlatCAM and not barbari, feel free to close this issue.

coddingtonbear commented 1 year ago

Probably not a bug in FlatCAM, and, if I had to guess, would instead just be that we're generating TCL commands that only a different version of FlatCAM understands.

I wonder if you've tried installing directly via the Beta branch here: https://bitbucket.org/jpcgt/flatcam/src/Beta/ instead of downloading the package linked above -- it might be that that the version number 8.994 has been unchanged between the "Beta" branch and some other branch, and that instead you're running the code against a different version of FlatCAM than intended.

ondras12345 commented 1 year ago

I believe the Beta branch is (was) where all development is taking place and the version number 8.994 was left unchanged since the release zip I linked. That's why I wanted to know which version you were running. I will try installing from the tip of the Beta branch (ebf5cb9) and see how it goes. Thank you for your helping me out.

I think it is likely a bug in the version of FlatCAM I am running, as it seems to run most of the script just fine and displays an internal error when trying to run this one command (which is documented in the internal help system). However, it is most likely fixed in the new version.

ondras12345 commented 1 year ago

Almost there. Commit ebf5cb9e. I needed to patch a few things:

git clone https://bitbucket.org/jpcgt/flatcam.git flatcam-git
cd flatcam-git
git checkout Beta  # ebf5cb9e
python3 -m venv venv
. ./venv/bin/activate
# do NOT run setup_ubuntu.sh, it runs pip install with sudo
pip3 install -U pip
sed 's/^gdal/#gdal/' -i requirements.txt  # failed to install
sed 's/vispy/vispy==0.7/' -i requirements.txt  # AttributeError: module 'vispy.visuals.markers' has no attribute '_marker_dict'
sed 's/shapely>=1.7.0/shapely~=1.7/' -i requirements.txt  # fixes gerber drawing
pip3 install -r requirements.txt

However, I am still getting an error when executing drillcncjob: https://bitbucket.org/jpcgt/flatcam/issues/599/excellon-object-error https://bitbucket.org/jpcgt/flatcam/issues/611/internal-error-while-generating-cnc-object

I needed to add -opt_type T to fix it.

drillcncjob drill -drilled_dias 0.85 -drillz -2.5 -travelz 2 -feedrate_z 50 -spindlespeed 12000 -outname drill_drilled_0 -opt_type T

Since barbari does not generate that flag by default, I assume it is working with the default -opt_type B for you. Could you please share which exact commit on the Beta branch you installed FlatCAM from?