TclCommands MillDrills, Cutout and Panelize - fixed for next version

Issue #561 new
max xam created an issue

Hello Marius.

Max again…sorry

I want to process the drill procedure with the existing tools in the Excelon file.
I start with script file by Lawrence Glaister VE7IT 5 Dec 2018, and inside this he make a proc to ave a string with the listt of tools used:

# proc to build a string that contains a list of the tool numbers defined in the excellon drill file

proc count_tools {} {
  global drill_drlset 
  fptr [open $drill_drl r]
  set retstr ""
  set first 1
  while {[gets $fptr line] > -1} {
    # process lines looking for tools > T0
    if {[regexp {^T(\d$)} $line -> num]} {
      if { $num > 0 } {
        if { $first == 1 } {
          set first 0
        } 
        else {
          append retstr ","
        }
        append retstr $num}
      }
    }
  close $fptr
  return $retstr
}

so i try to use in the following way :

milldrills drill_drl -milled_dias [count_tools] -tooldia 0.1 -outname holes_geo

but it seems the return string cannot work.

Do you have a solution?

Thanks Max

Edit: Cleaned the initial post so it is easier to understand -MStanciu

Comments (65)

  1. Marius Stanciu

    Hi Max,

    The procedure above search the drills file for the format T<number> and creates a string with a comma separated tool numbers. Like: “1,2,3,4”
    In the Tclcommands milldrills and millslots for parameter -milled_dias the value is expected to be a string with a list of comma separated tool diameters. Like: “0.6,0.8,1.2” where the decimal separator is a dot.

    To get this behavior you need a different regex expression and the procedure could look like this:

    proc dia_list {} {
        global drill_drl
        set fptr [open $drill_drl r]
        set retstr ""
        set first 1
        while {[gets $fptr line] > -1} { 
            # process lines looking for tools > T0
            if {[regexp {^T(\d+)[A-Z]{1}([0-9]+\.?[0-9]*|\.[0-9]+)} $line -> ->> num]} {
                if { $num > 0 } {
                    if { $first == 1 } {
                        set first 0
                    } else {
                        append retstr ","
                    }
                    append retstr $num
                }
            }
        }
        close $fptr
        return $retstr
    }
    

  2. max xam reporter

    Hi Marius,

    I change from milldrills to drillcncjob and it seems working,but I am not sure if it’s loading the right preprocessor see below

    drillcncjob drill_drl -drilled_dias [dia_list] -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed 255 -toolchangez 50 toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc

    (G-CODE GENERATED BY FLATCAM vUnstable - www.flatcam.org - Version Date: 2022/3/1)

    (Name: drill_cnc)
    (Type: G-code from Excellon)
    (Units: MM)

    (Created on Venerdì, 28 Gennaio 2022 at 08:54)

    G01 F20.00

    M5
    G00 Z50.0000
    G00 X0.0000 Y0.0000
    T1
    M6
    (MSG, Change to Tool Dia = 0.6000 ||| Total drills for tool T1 = 4)
    M0
    G00 Z50.0000

    …….

    After if from the GUI, I go to select the GCodeEditor of the drillcncjob I have the following error:

    2022-01-28 08:55:37.370898
    Traceback (most recent call last):
    File "/Users/max/flatcam95/appObjects/FlatCAMCNCJob.py", line 493, in <lambda>
    self.ui.editor_button.clicked.connect(lambda: self.app.object2editor())
    File "/Users/max/flatcam95/app_Main.py", line 2679, in object2editor
    self.gcode_editor.edit_fcgcode(edited_object)
    File "/Users/max/flatcam95/appEditors/appGCodeEditor.py", line 670, in edit_fcgcode
    self.build_ui()
    File "/Users/max/flatcam95/appEditors/appGCodeEditor.py", line 145, in build_ui
    self.build_excellon_cnc_tools()
    File "/Users/max/flatcam95/appEditors/appGCodeEditor.py", line 292, in build_excellon_cnc_tools
    self.decimals, float(t_value['offset']) + float(t_value['data']['tools_drill_cutz'])))
    KeyError: 'offset'

    …..and one more thing:

    it’s possible to duplicate the object for example 4 times and aligne them and generate only one gcode ?

  3. Marius Stanciu

    Hi Max,
    Again I have to point out to the importance of checking the used parameters: it is possible that because of a tiny mistake you will not get the desired results.
    In the line:

    drillcncjob drill_drl -drilled_dias [dia_list] -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed 255 -toolchangez 50 toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc
    

    The parameter toolchangexy 0,0 is missing the dash - and therefore is not understood.

    I have upgraded the Tcl command drillcncjob to add to the resulting Gcode the header with the information’s regarding of the used parameters. I have also fixed the KeyError: 'offset' exception error. Plotting should now reflect the tool diameter in the thickness of the travel lines.
    I have also updated the description and examples to show that if the drilled_dias parameter is not used or if it is used with the value 'all' like this: `-drilled_dia ”all” then all the tools are drilled therefore making the dia_list procedure no longer needed.

    it’s possible to duplicate the object for example 4 times and aligne them and generate only one gcode ?

    Yes, you need to use the panelize Tcl command. E.g:

    panel obj_name -rows 1 -columns 4 -spacing_columns 0.4 -spacing_rows 1.3 -box box_obj_name -outname panelized_name
    

  4. max xam reporter

    Hi Marius,

    sorry for the mistake….

    everythings seems to be fixed now, I try use panel command now.

  5. max xam reporter

    Hi Marius,

    the panel command for laser part is working.

    I change back the command from drillcncjob to milldrills, to have a geometry to use with panel, but the

    milldrills drill_drl -milled_dias [dia_list] -tooldia 0.1 -outname holes_geo

    seems don’t read the [dia_list]( drillcncjob is working with dia_list)

  6. Marius Stanciu

    Hello,
    What is not working? From what I see all is exactly as expected and I checked also with a script and I got the expected result.
    It’s the same with this command, you don’t need that procedure, dia_list you could not use the parameter -milled_dias and it will process all the tools inside the Excellon object. All of them will be milled with the -tooldia tool, in you case 0.1mm. If you plot the result you will see that there are smaller paths (circles) inside the Excellon holes (as expected).

    Perhaps you don’t understand what the milldrills command is doing. It allows a user that does not have a drill bit of a certain size, to mill that hole with a smaller milling bit. So instead of drilling you replace that with a milling action, said otherwise, a cutting action.

  7. max xam reporter

    Hello Marius,

    what I want to do is this:

    After laser engraving the pcb painted I use the ferric chloride and after I need to drill and finally cutout with cnc spindle putting the pcb in same position to be aligned. For #1 piece I am able because from excellon file I use drillcncjob with dia_list.

    But I think to use panel command I have to give like input a geometry for this reason I use milldrill, but I need to have all the real tools to be used not only one.

    How can I do?

    I hope to have explained you clearly…

  8. Marius Stanciu

    Hi,
    You can panelize: Gerber, Excellon and Geometry objects.
    If what you want is to make multiple copies of one PCB then you use this plugin (or Tcl command) over the objects that you want panelized. I think that only the CNCJob cannot be panelized.

    If you want to see how it works, try first the plugin in the GUI.

  9. max xam reporter

    Hello Marius,

    from gui interface it seems working, using panelize separetely gerber and excellon and after making cutout and drillcncjob.

    But with the script, the panelize command with excellon seems not working it don’t gives error and don’t produce output.

    See script in attachment.

    P.s.

    The panelized cutout produce one piece instead of two like defined in colums.

  10. Marius Stanciu

    the panelize command with excellon seems not working it don’t gives error

    What kind of error?

  11. max xam reporter

    Good morning Marius,

    everything it’s working fine now, and I find a solution to have multiply cutout but I need your help to calculate an offset parameter see below the code :

    #not used only for visualization

    panel cutout_grb -rows 1 -columns 2 -spacing_columns 2 -spacing_rows 1.3 -box cutout_grb -outname cutout_multi

    panel drill_drl -rows 1 -columns 2 -spacing_columns 2 -spacing_rows 1.3 -box cutout_grb -outname drill_multi

    cutout cutout_grb -dia $cutout_d -margin 0.1 -gapsize $cutout_d -gaps "lr" -outname cutout1_geo

    cutout cutout_grb -dia $cutout_d -margin 0.1 -gapsize $cutout_d -gaps "lr" -outname cutout2_geo

    offset cutout2_geo -x 76.0

    join_geometries cutout_geo cutout1_geo cutout2_geo

    cncjob cutout_geo -dia 1.5 -z_cut -1.8 -z_move 2 -feedrate 100 -feedrate_z 20 -dpp 0.6 -startz 50 -endz 50 -endxy 0,0 -spindlespeed 255 -pp GRBL_11 -outname cutout_cnc

    I generate 2 geometries and I move with offset the 2nd one and after I join the geometries.

    But the offset parameter X 76 ( I have calculated manually) can be taken from some variable ?

  12. Marius Stanciu

    Hi Max,

    You need to give more details on why you are doing the offset.
    Are you trying to panelize this way the cutout geometry?
    In this case no need to blunder with offset’s. Just panelize everything, including the cutout Geometry, having the same box which is mandatory if you want to keep everything in sync. In this case we will have as -box reference the cutout Geometry since it is the one that ‘envelops' the whole layout (copper Gerbers, outline Gerbers, drill objects):

    # the `new` command is always at the beginning of the script to create a blank/clean environment
    new
    
    #set_path /Users/max/Txt/3d_cnc/gerber/
    cd ~/Txt/3d_cnc/gerber/
    
    set cutout_gbr     "cutout.gbr"
    set drill_drl      "drill.drl"
    
    # filename for output gcode for 3D printer (laser etching machine)
    set cutout_fn      "cutout.gcode"
    set drill_fn       "drill_all.gcode"
    #set project_fn    "project.FlatPrj"
    
    set cutout_d       1.5
    
    # all the panels have the same reference (-box parameter), the cutout Geometry object,therefore they stay in sync
    cutout cutout_grb -dia $cutout_d -margin 0.1 -gapsize $cutout_d -gaps "lr" -outname cutout_geo
    # panelize the Cutout Geometry
    panel cutout_geo -rows 1 -columns 2 -spacing_columns 2 -spacing_rows 1.3 -box cutout_geo -outname cutout_geo_panel
    
    # panelizing the cutout Gerber object is no longer needed unless you want to do something else with it
    # panel cutout_grb -rows 1 -columns 2 -spacing_columns 2 -spacing_rows 1.3 -box cutout_geo -outname cutout_multi
    
    # panelize the drill file
    panel drill_drl -rows 1 -columns 2 -spacing_columns 2 -spacing_rows 1.3 -box cutout_geo -outname drill_multi
    
    # create the CNCJob objects which will hold the Gcode, which can then be saved using the `write_gcode` Tcl command
    cncjob cutout_geo -dia 1.5 -z_cut -1.8 -z_move 2 -feedrate 100 -feedrate_z 20 -dpp 0.6 -startz 50 -endz 50 -endxy 0,0 -spindlespeed 255 -pp GRBL_11 -outname cutout_cnc
    drillcncjob drill_multi -drilled_dias "all" -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed 255 -toolchangez 50 -toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc
    
    # optional, plot everything so you can check the result
    plot_all
    
    # write_gcode <name>    <filename>
    write_gcode cutout_cnc  $cutout_fn
    write_gcode drill_cnc   $drill_fn
    

  13. Marius Stanciu

    BTW, if you are going to use a 3D printer that is driven by a Marlin firmware, you will need to use the Marlin preprocessors.

  14. max xam reporter

    Hi Marius,

    The cutout is dividing the 2 pieces, I make 2 times the cutout giving 2 outname, and after I move the 2nd one with offset only on x axis of 76mm.How can calcolate this offset ?

    The cutout with panlize is not dividing the 2 pieces.

  15. Marius Stanciu

    Hello Max,
    I’m afraid that I really don’t understand what you want (say). So I’m going to offer you two choices and you will have to adapt them as you see fit.

    Solution 1:
    The cutout will cut each panel element individually, the elements are separated by a narrow strip of PCB set by the -spacing_columns value.

    # script that create a panel for a drill Excellon file and a cutout Gerber file, the cutout will cut each panel element individually
    
    new
    
    cd "D:\\MEGA\\gerb\\kicad"
    
    set cutout_gbr_file    "usb_isolator-Edge_Cuts.gbr"
    set drill_drl_file           "usb_isolator.DRL"
    
    # filename for output gcode for 3D printer (laser etching machine)
    set cutout_fn      "cutout.gcode"
    set drill_fn       "drill_all.gcode"
    #set project_fn    "project.FlatPrj"
    
    set cutout_d       1.5
    
    # open the files
    open_gerber $cutout_gbr_file -outname cutout_gbr
    open_excellon $drill_drl_file -outname drill_drl
    
    # all the panels have the same reference (-box parameter), the cutout Geometry object,therefore they stay in sync
    cutout cutout_gbr -dia $cutout_d -margin 0.1 -gapsize $cutout_d -gaps "lr" -outname cutout_geo
    # panelize the Cutout Geometry
    panel cutout_geo -rows 1 -columns 2 -spacing_columns 4 -spacing_rows 1.3 -box cutout_geo -outname cutout_geo_panel
    
    # panelizing the cutout Gerber object is no longer needed unless you want to do something else with it
    # panel cutout_gbr -rows 1 -columns 2 -spacing_columns 4 -spacing_rows 1.3 -box cutout_geo -outname cutout_multi
    
    # panelize the drill file
    panel drill_drl -rows 1 -columns 2 -spacing_columns 4 -spacing_rows 1.3 -box cutout_geo -outname drill_panel
    
    # create the CNCJob objects which will hold the Gcode, which can then be saved using the `write_gcode` Tcl command
    cncjob cutout_geo_panel -dia 1.5 -z_cut -1.8 -z_move 2 -feedrate 100 -feedrate_z 20 -dpp 0.6 -startz 50 -endz 50 -endxy 0,0 -spindlespeed 255 -pp GRBL_11 -outname cutout_cnc
    drillcncjob drill_panel -drilled_dias "all" -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed 255 -toolchangez 50 -toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc
    
    # optional, plot everything so you can check the result
    plot_all
    
    # write_gcode <name>    <filename>
    write_gcode cutout_cnc  $cutout_fn
    write_gcode drill_cnc   $drill_fn
    

    Running the above will yield a result like this:

  16. Marius Stanciu

    LE: Can’t add two pieces of code on the same post so I created a second post

    Solution 2:
    A Panel that is separated by a narrow area (set by the -spacing_columns value in this case. The entire panel is cutout in one piece, the user have to cut the panel elements manually.

    # script that create a panel for a drill Excellon file and a cutout Gerber file, the cutout will surround the panel
    
    # initialize and create a new and empty project
    new
    
    cd "D:\\MEGA\\gerb\\kicad"
    
    set cutout_gbr_file    "usb_isolator-Edge_Cuts.gbr"
    set drill_drl_file           "usb_isolator.DRL"
    
    # filename for output gcode for 3D printer (laser etching machine)
    set cutout_fn      "cutout.gcode"
    set drill_fn       "drill_all.gcode"
    #set project_fn    "project.FlatPrj"
    
    set cutout_d       1.5
    
    # open the files
    open_gerber $cutout_gbr_file -outname cutout_gbr
    open_excellon $drill_drl_file -outname drill_drl
    
    # all the panels have the same reference (-box parameter), the cutout Gerber object,therefore they stay in sync
    
    # panelize the Gerber cutout file
    panel cutout_gbr -rows 1 -columns 2 -spacing_columns 4 -spacing_rows 1.3 -box cutout_gbr -outname cutout_gerber_panel
    
    # panelize the drill file
    panel drill_drl -rows 1 -columns 2 -spacing_columns 4 -spacing_rows 1.3 -box cutout_gbr -outname drill_panel
    
    # cutout the Gerber panel
    cutout cutout_gerber_panel -dia $cutout_d -margin 0.1 -gapsize $cutout_d -gaps "lr" -outname cutout_geo
    
    # create the CNCJob objects which will hold the Gcode, which can then be saved using the `write_gcode` Tcl command
    cncjob cutout_geo -dia 1.5 -z_cut -1.8 -z_move 2 -feedrate 100 -feedrate_z 20 -dpp 0.6 -startz 50 -endz 50 -endxy 0,0 -spindlespeed 255 -pp GRBL_11 -outname cutout_cnc
    drillcncjob drill_panel -drilled_dias "all" -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed 255 -toolchangez 50 -toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc
    
    # optional, plot everything so you can check the result
    plot_all
    
    # write_gcode <name>    <filename>
    write_gcode cutout_cnc  $cutout_fn
    write_gcode drill_cnc   $drill_fn
    

    The above script will generate something like this:

  17. Marius Stanciu

    LE: If in the Solution 1 you want the panel elements side-by-side then in all the panel commands you set the -spacing_columns value to 0.0.

  18. max xam reporter

    Hi Marius,

    the right solution for me is #1, it was my mistake i make panel command before cutout so the result was like your solution #2.

    Easy way to fix.

    Thanks a lot for your support, I hope don’t have new idea to submit you

  19. Marius Stanciu

    BTW, in my latest commit I’ve added a new parameter/argument for the command new named -keep_scripts. When this parameter is True then when creating a new project, the script objects will survive the destructive action of the new command (the new Tcl command deletes by default all existing objects).

    This is done so a script that issue the new -keep_scripts True command will renew everything except keeping the script itself alive.

  20. max xam reporter

    Hello Marius,

    I am a little confused about your last new parameter -keep_scripts.

    In this moment I don’t enter any paramter to the command new and like you can see from my script, it is located in the middle after the declaration of some variable with set command.

    It’s better to move the command new at the beginng of the script?

    Actually everythings seems to work properly, only to understand better.

    Thanks

  21. max xam reporter

    Hello Marius,

    see attachment, in gcode generated from drillcncjob there is not any feedrate command, below the code:

    drillcncjob drill_multi -drilled_dias [dia_list] -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed $spindle_power -toolchangez 50 -toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc

  22. max xam reporter

    Hi Marius,

    i have made a pcb with 2 panelized circuits with laser and after with chemical etching.
    After I am starting to drill and the process is drilling the 1st hole in the 1st circuit correctly, and execute the 2nd hole in the 2nd panelized circuit but shifted from the right position about +2mm.

    I attached some pictures to sho the issue.

  23. Marius Stanciu

    Hello Max,

    I am a little confused about your last new parameter -keep_scripts.

    In this moment I don’t enter any paramter to the command new and like you can see from my script, it is located in the middle after the declaration of some variable with set command.

    It’s better to move the command new at the beginng of the script?

    The new Tcl command, by default deletes all loaded objects and resets the Tcl environment variables.
    The answer is yes. It has to be used always at the beginning of a script otherwise whatever was set previously will be reset (variables, etc) and any objects created will be deleted.
    It is used to create a “blank slate”, a vanilla, fresh new project.

    The new parameter -keep_scripts will allow to do anything that a new command does, will delete everything but in this case, with the exception of scripts objects.

  24. Marius Stanciu

    see attachment, in gcode generated from drillcncjob there is not any feedrate command, below the code:

    drillcncjob drill_multi -drilled_dias [dia_list] -drillz -1.7 -travelz 2 -feedrate_z 20 -feedrate_rapid 100 -spindlespeed $spindle_power -toolchangez 50 -toolchangexy 0,0 -startz 50 -endz 50 -pp GRBL_11 -outname drill_cnc

    Issue fixed in the latest commit on my repo.

  25. Marius Stanciu

    i have made a pcb with 2 panelized circuits with laser and after with chemical etching.
    After I am starting to drill and the process is drilling the 1st hole in the 1st circuit correctly, and execute the 2nd hole in the 2nd panelized circuit but shifted from the right position about +2mm.

    I attached some pictures to sho the issue.

    Max, this is another issue that you have but it is a more general one that has to do with how you are using the Tcl commands. I can’t tell you what you are doing wrong except that it looks like when you panelized the Excellon file, the reference -box was not the same as the one for the cutout_geo. Or when you panelize the isolation_geo you did not used the -box reference the cutout_geo.

    Keep in mind that when you are panelizing you have to keep the same reference -box (preferable the cutout_geo: mind you, the single cutout_geo) for all objects that are panelized.

    So the steps are like this:

    • load top_gerber
    • load cutout_gerber
    • load excellon_file
    • create isolation for top_gerber => top_gerber_isolation_geo
    • create cutout from cutout_gerber => cutout_geo
    • create panel for top_gerber_isolation_geo having the reference -box cutout_geo
    • create panel for cutout_geo having the reference -box cutout_geo
    • create panel for excellon_file having the reference -box cutout_geo

    No more messing with offset except after you created the panels, just before you will create the cncjob's.

    Also, if you have CNC working problems please open a new issue so we can keep issues clean and referring to specific problems.

  26. max xam reporter

    Hi Marius

    1- Moved new command at the top odf the script

    2-Now drillcncjob has feedrate correctly

    3-In the script for laser i make join_geometries and after one panel command, is a wrong procedure ? It’s better to do one by one ?

    join_geometries laser_etch_geo trace_iso_geo holes_geo cutout_geo

    panel laser_etch_geo -rows 1 -columns 2 -spacing_columns $space_x -spacing_rows $space_y -box cutout_geo -outname laser_multi

    About the offset,I used before panel with set_origin 10,20 for laser, and set_origin 10+spindle_offset,20+spindle_offset so I will move them after panel.

  27. max xam reporter

    Hi Marius,

    if I have to use the cutout_geo like box for panel , the -dia must be the same ?

    I have used 0.125 for laser and 1.5 for cnc…. maybe this is the cause of the difference ?

  28. Marius Stanciu

    Hi Max,
    Don’t use thr join command unless you actually need it.
    A script is just a sequence of commands and it makes sense to do everything one by one, you minimize the risk of errors and also you make debugging easier.
    Use the set_origin Tcl command after all the panels are ready and just before you start creating the CNCJob objects.

    PS: A suggestion: when you post lines of code (be it script or else) please use the right way and paste it inside a code block. You can add a code block using the symbol <> from the top menu of the box where you are writing messages.

  29. Marius Stanciu

    if I have to use the cutout_geo like box for panel , the -dia must be the same ?

    We are not talking about the tool diameter here. It is about the reference that have to be shared by all objects. If there is no shared reference (given with the -box parameter) then the resulting objects will not be synced. Like it happened for you by drilling in a wrong place.

  30. max xam reporter

    Yes, but I have done 2 script one for laser where the cutout -dia is 0.125 and one for cnc with cutout -dia 1.5, so the reference gerber is the same but the reference geo have different -dia

  31. Marius Stanciu

    If there are two scripts, then they don’t share the same reference so the wrong result was predictable. In that case you will have to find a different solution to sync the two jobs (if possible at all).
    Why don’t you use a single script? You could make the difference between lasered ones and the milled ones through the GCode filename.

  32. max xam reporter

    I do it….

    The only thing is that the drillcncjob at the end go up to move_z and stop there, whilr the cncjob for the cut out it finish going to endz and x0 y0

  33. max xam reporter

    Thanks to you Marius, now with one software I can use laser and cnc with grbl firmware.The laser is 2000mW I use with full power to engraving the paint of the pcb and 50% for wood panel.

  34. Marius Stanciu

    With welcome, it was a lot of work for both of us.

    BTW, in the latest commit I’ve added a new parameter, a Laser minimum power for the drillcncjob and for cncjob Tcl commands (it’s in the GUI also, of course).
    That should allow you to keep a minimum power (not power off completely) for the laser while it is moving and not cutting. That should help prolonging the life of the laser diode by not making a full ON/OFF/ON cycle but ON/almost_OFF/On cycle which reduce the avalanche effect (over current) at the start of the laser diode.

    -las_min_pwr <float>: Used with "laser" preprocessors. States the laser power when not cutting

    You can use this parameter -las_min_pwr with say a value of 10 or something like this so the power is low enough to not create damage in between the cuts and high enough to not power off completely the laser diode.

    Also, when using the drillcncjob and cncjob Tcl commands with a laser preprocessor, now the laser power have to be set using the parameter -las_power instead of -spindlespeed as it was previously.

  35. Marius Stanciu

    The only thing is that the drillcncjob at the end go up to move_z and stop there, whilr the cncjob for the cut out it finish going to endz and x0 y0

    This is fixed in the latest commit in my repo.

  36. max xam reporter

    Hello Marius,

    I upgrade to your last repo, but now it seems that the join_geometries seems not more working.

    join_geometries laser_etch_geo trace_iso_geo holes_geo cutout_geo
    

    I know that you suggested don’t use it, but I don’t want to process 3 files (trace-cut-holes) for laser process.

    I try to make the same operation from gui and it seems that trace_iso_geo generated with isolate has properties Multi-Geo while milldrils and cutout have generated Single-Geo, so my script cannot go on !!!

  37. Marius Stanciu

    Hello Max,
    This has nothing to do with the latest changes. Most likely you set up the isolation with multiple passes and currently the rule is that if you use a single pass in isolation then the Geometry is a singlegeo one and if you set multiple passes then the resulting Geometry object is a multigeo one.
    Can you share the script where the join Tcl command did not work?

  38. max xam reporter

    Hello Marius,

    i have seen in terminal window the following error :

    /Users/max/flatcam95/appObjects/FlatCAMGeometry.py:601: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
      for geo in multigeo_solid_geometry:
    [DEBUG][MainThread] TCL command 'TclCommandCncjob' executed.
    

    Maybe that in meanwhile I have received one upgrade of Mac osx and I have to install again vispy-0.9.4.1.tar.gz ?

  39. Marius Stanciu

    Hi Max,

    Those warnings are because the maintainers of the Shapely package (currently at version 1.8) are planning some breaking changes starting with version 2.0. There will be a merger of another package into Shapely.
    Much of those warnings I already solved but some still can be found.
    For now it’s not a problem but once they are raised it is good to get them fixed, which is not such a big deal.
    In any case in the latest commit I solved some more of them.

  40. max xam reporter

    Hi Marius,

    laser script cannot yet work:

    [SUCCESS] New Project created...Gerber processing. Parsing 851 lines.[WARNING] Gerber X2 format detected. Parsing may not be done correctly.Gerber processing. Joining polygons: 47.Gerber processing. Applying Gerber polarity.New object with name: bottom_traces_grb. 0.110826 seconds executing initialize().[SUCCESS] Opened: bottom_trace.gbrGerber processing. Parsing 26 lines.[WARNING] Gerber X2 format detected. Parsing may not be done correctly.Gerber processing. Joining polygons: 4.Gerber processing. Applying Gerber polarity.New object with name: cutout_grb. 0.013833 seconds executing initialize().[SUCCESS] Opened: cutout.gbrNew object with name: drill_drl. 0.009668 seconds executing initialize().[SUCCESS] Opened: drill.drl[SUCCESS] Done.New object with name: trace_iso_geo. 0.082404 seconds executing initialize().New object with name: holes_geo. 0.004915 seconds executing initialize().New object with name: cutout_geo. 0.000527 seconds executing initialize().[SUCCESS] Rectangular-form Cutout operation finished.[ERROR] An internal error has occurred. See shell.Object (geometry) failed because: merge() missing 1 required positional argument: 'geo_final' 

Traceback (most recent call last):File "/Users/max/flatcam95/appObjects/AppObject.py", line 168, in new_objectreturn_value = initialize(obj, self.app)File "/Users/max/flatcam95/tclCommands/TclCommandJoinGeometry.py", line 65, in initializeGeometryObject.merge(objs, obj_)TypeError: merge() missing 1 required positional argument: 'geo_final'

[SUCCESS] Done.[SUCCESS] Done.[SUCCESS] Done.[SUCCESS] Done.[SUCCESS] Done.[SUCCESS] Origin set...[success] Tcl Origin set by offsetting all loaded objects with : 243.8925, 243.8925
    

    [SUCCESS] New Project created...
Gerber processing. Parsing 851 lines.
[WARNING] Gerber X2 format detected. Parsing may not be done correctly.
Gerber processing. Joining polygons: 47.
Gerber processing. Applying Gerber polarity.
New object with name: bottom_traces_grb. 0.110826 seconds executing initialize().
[SUCCESS] Opened: bottom_trace.gbr
Gerber processing. Parsing 26 lines.
[WARNING] Gerber X2 format detected. Parsing may not be done correctly.
Gerber processing. Joining polygons: 4.
Gerber processing. Applying Gerber polarity.
New object with name: cutout_grb. 0.013833 seconds executing initialize().
[SUCCESS] Opened: cutout.gbr
New object with name: drill_drl. 0.009668 seconds executing initialize().
[SUCCESS] Opened: drill.drl
[SUCCESS] Done.
New object with name: trace_iso_geo. 0.082404 seconds executing initialize().
New object with name: holes_geo. 0.004915 seconds executing initialize().
New object with name: cutout_geo. 0.000527 seconds executing initialize().
[SUCCESS] Rectangular-form Cutout operation finished.
[ERROR] An internal error has occurred. See shell.
Object (geometry) failed because: merge() missing 1 required positional argument: 'geo_final' 

Traceback (most recent call last):
 File "/Users/max/flatcam95/appObjects/AppObject.py", line 168, in new_object
 return_value = initialize(obj, self.app)
 File "/Users/max/flatcam95/tclCommands/TclCommandJoinGeometry.py", line 65, in initialize
 GeometryObject.merge(objs, obj_)
TypeError: merge() missing 1 required positional argument: 'geo_final'

[SUCCESS] Done.
[SUCCESS] Done.
[SUCCESS] Done.
[SUCCESS] Done.
[SUCCESS] Done.
[SUCCESS] Origin set...
[success] Tcl Origin set by offsetting all loaded objects with : 243.8925, 243.8925

  41. Marius Stanciu

    Hi Max,
    I just updated the format of the join_geometry and join_excellon Tcl commands so they are no confusing the user with a different format.
    Now they are used like this:
    join_geometry first_geo "second geo" -outname my_new_merged_geo

    Therefore your script needs to be changed.

  42. Marius Stanciu

    Max, I don’t even bother to read the previous sausage of words. Sorry, use a nice formatting or it gets overlooked.
    You can edit the post and use the Shift + Enter after each line so the lines are nicely in their place.

  43. Marius Stanciu

    I just updated the isolate, cutout and geocutout Tcl commands and they all yield multigeo Geometry objects now. Maybe your script will work now.

  44. Marius Stanciu

    And doing the isolate, milldrills, cutout, merging them with join_geometries and then panelized them with panelize yielded the expected result.

  45. max xam reporter

    Hi Marius,

    I have changed the sintax of join with outname and it’s working everything like before, but in the cncjob it cannot recognize the variable -las_power this is the statement:

    cncjob laser_multi -z_cut $laser_z -z_move $laser_z -feedrate $laser_feed -dia $laser_d -las_min_pwr $laser_min_power -las_power $laser_power -pp GRBL_laser -outname lasercncjob laser_multi -z_cut $laser_z -z_move $laser_z -feedrate $laser_feed -dia $laser_d -las_min_pwr $laser_min_power -las_power $laser_power -pp GRBL_laser -outname lasercncjob laser_multi -z_cut $laser_z -z_move $laser_z -feedrate $laser_feed -dia $laser_d -las_min_pwr $laser_min_power -las_power $laser_power -pp GRBL_laser -outname lasercncjob laser_multi -z_cut $laser_z -z_move $laser_z -feedrate $laser_feed -dia $laser_d -las_min_pwr $laser_min_power -las_power $laser_power -pp GRBL_laser -outname laser
    

    022-01-31 23:42:45.296559
    Traceback (most recent call last):
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 420, in handle_finished
        self.raise_tcl_unknown_error(self.error)
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 263, in raise_tcl_unknown_error
        raise unknown_exception
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 341, in execute_call
        self.output = self.execute(args, unnamed_args)
      File "/Users/max/flatcam95/tclCommands/TclCommandCncjob.py", line 252, in execute
        obj.generatecncjob(use_thread=False, plot=False, **args)
    TypeError: generatecncjob() got an unexpected keyword argument 'las_power'
    

  46. Marius Stanciu

    Hi Max,

    You may have noticed that the issue is fixed but I also upgraded the offset, scale, mirror Tcl commands changing the format. So your script might need to be changed.
    They also now work on a selection of objects not only on one object only, allowing thus a synchronization between them.
    The skew Tcl command upgrade is in the works.

  47. max xam reporter

    Hi Marius,

    I have installed last repo and below my comments:

    1- script for laser is working without any changes

    2-the Tcl commands mirror, this is from long time I forgot to tell you,to flip on X axis you need to set -axis y, while in the Gui is working properly.

    3- in cnc script the panel for cutout is not producing output see the command, before it was working…:

    panel cutout_geo -rows 1 -columns 2 -spacing_columns $space_x -spacing_rows $space_y -box cutout_geo -outname cutout_multi
    

  48. Marius Stanciu

    Hi Max,
    The issues should be fixed in my repo. Can you check if the latest commit works good for you?

  49. max xam reporter

    Hi Marius,

    new issue in cnc script, the panel is working now but the cncjob gives error:

    2022-02-01 21:28:59.986911
    Traceback (most recent call last):
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 420, in handle_finished
        self.raise_tcl_unknown_error(self.error)
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 263, in raise_tcl_unknown_error
        raise unknown_exception
      File "/Users/max/flatcam95/tclCommands/TclCommand.py", line 341, in execute_call
        self.output = self.execute(args, unnamed_args)
      File "/Users/max/flatcam95/tclCommands/TclCommandCncjob.py", line 286, in execute
        self.app.milling_tool.mtool_gen_cncjob(
      File "/Users/max/flatcam95/appPlugins/ToolMilling.py", line 3018, in mtool_gen_cncjob
        segx = data_dict['segx']
    KeyError: 'segx'
    

  50. Log in to comment