Created
March 19, 2025 13:23
-
-
Save jschoch/1c0b5067e1df81a98a0870e9fe04883b to your computer and use it in GitHub Desktop.
flatcam_smash.FlatScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# CREATE A NEW FLATCAM TCL SCRIPT | |
# TCL Tutorial here: https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html | |
# | |
# FlatCAM commands list: | |
# AddCircle, AddPolygon, AddPolyline, AddRectangle, AlignDrill, AlignDrillGrid, ClearShell, ClearCopper, | |
# Cncjob, Cutout, Delete, Drillcncjob, ExportGcode, ExportSVG, Exteriors, GeoCutout, GeoUnion, GetNames, | |
# GetSys, ImportSvg, Interiors, Isolate, Follow, JoinExcellon, JoinGeometry, ListSys, MillDrills, | |
# MillSlots, Mirror, New, NewGeometry, Offset, OpenExcellon, OpenGCode, OpenGerber, OpenProject, | |
# Options, Paint, Panelize, Plot, SaveProject, SaveSys, Scale, SetActive, SetSys, Skew, SubtractPoly, | |
# SubtractRectangle, Version, WriteGCode | |
# | |
# | |
# This script expects easyeda's gerber naming conventions, you should just need to update the path where | |
# you extracted the files from the zip | |
# | |
puts "starting" | |
#set PATH ${ROOT_FOLDER}/assets/examples/files | |
set ROOT_FOLDER {C:\\Users\\jesse\\Documents\\gcode\\cnc gcode\\pms7003 board_2023-11-08 } | |
set PATH $ROOT_FOLDER | |
cd $PATH | |
puts "PWD: " | |
puts [pwd] | |
puts "opening gerber" | |
open_gerber Gerber_TopLayer.GTL | |
set name_list [split [get_names] ] | |
# combine excellon | |
puts "isolate top layer" | |
# isolate <str> [-dia <float>] [-passes <int>] [-overlap <float>] [-combine <int>] [-outname <str>] | |
isolate Gerber_TopLayer.GTL -dia 0.25 -passes 1 -overlap -0.98 -combine 1 | |
puts "cnc job top layer" | |
cncjob Gerber_TopLayer.GTL_iso -z_cut -0.05 -z_move 2 -feedrate 1000 -dia 0.25 -spindlespeed 15000 -pp "grbl_11" -feedrate_z 500 | |
puts "writing gcode" | |
write_gcode Gerber_TopLayer.GTL_iso_cnc .\\traces_iso.nc | |
puts "top layer done, cutout next" | |
# cutout | |
# cncjob <str> [-z_cut <float>] [-z_move <float>] [-feedrate <float>] [-tooldia <float>] [-spindlespeed <int>] [-multidepth <bool>] [-depthperpass <float>] [-outname <str>] | |
#cutout <name> [-dia <3.0 (float)>] [-margin <0.0 (float)>] [-gapsize <0.5 (float)>] [-gaps <lr (4|tb|lr)>] | |
cutout Gerber_TopLayer.GTL -dia 0.8 -margin 0.0 -gapsize 0.0 -gaps "tb" | |
puts "cncjob for cutout" | |
cncjob Gerber_TopLayer.GTL_cutout -z_cut -1.6 -z_move 2 -feedrate 300 -dia 0.8 -spindlespeed 15000 -dpp 0.4 -pp "grbl_11" | |
puts "writing gcode for cutout" | |
write_gcode Gerber_TopLayer.GTL_cutout_cnc .\\cutout.nc | |
puts "cutout done, next mill drills and slots" | |
set ex Drill_PTH_Through.DRL | |
set ex2 "Drill_NPTH_Through.DRL" | |
open_excellon $ex | |
if { [file exists $ex2 ] == 1} { | |
puts " NPTH found... joining" | |
open_excellon $ex2 | |
join_excellons "combined_drill" $ex $ex2 | |
milldrills combined_drill -tooldia 0.8 -diatol 10 | |
} else { | |
milldrills $ex -tooldia 0.8 -diatol 10 -outname combined_drill_mill_drills -milled_dias "all" | |
} | |
puts "milldrills done" | |
cncjob combined_drill_mill_drills -z_cut -1.6 -z_move 2 -feedrate 300 -dia 0.8 -spindlespeed 15000 -dpp 0.4 -pp "grbl_11" -feedrate_z 300 | |
write_gcode combined_drill_mill_drills_cnc .\\drill.nc | |
puts "plotting" | |
plot_all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment