Options: Optimizations - pcb2gcode/pcb2gcode GitHub Wiki

Options: Optimizations

These usually don't need to be changed but if pcb2gcode is running to slowly, changing these can make it run faster in exchange for creating less efficient paths. The defaults are pretty good and you probably don't need to adjust any of them.

These are the useful options:

Optimization options, for faster PCB creation, smaller output files, and different algorithms.:
  --optimise [=arg(=2.54e-06 m)] (=2.54e-06 m)
                                        Reduce output file size by up to 40% 
                                        while accepting a little loss of 
                                        precision.  Larger values reduce file 
                                        sizes and processing time even further.
                                          Set to 0 to disable.
  --eulerian-paths [=arg(=1)] (=1)      Don't mill the same path twice if 
                                        milling loops overlap.  This can save 
                                        up to 50% of milling time.  Enabled by 
                                        default.
  --vectorial [=arg(=1)] (=1)           enable or disable the vectorial 
                                        rendering engine
  --tsp-2opt [=arg(=1)] (=1)            use TSP 2OPT to find a faster toolpath 
                                        (but slows down gcode generation)
  --path-finding-limit arg (=1)         Use path finding for up to this many 
                                        steps in the search (more is slower but
                                        makes a faster gcode path)
  --g0-vertical-speed arg (=0.0211667 m s^-1)
                                        speed of vertical G0 movements, for use
                                        in path-finding
  --g0-horizontal-speed arg (=0.0423333 m s^-1)
                                        speed of horizontal G0 movements, for 
                                        use in path-finding
  --backtrack arg (=inf)                allow retracing a milled path if it's 
                                        faster than retract-move-lower.  For 
                                        example, set to 5in/s if you are 
                                        willing to remill 5 inches of trace in 
                                        order to save 1 second of milling time.

--optimise

This reduces file size greatly by removing some of the accuracy in the trace. For example, a curve specified with many points will have some of the points removed so that it's roughly the same shape. It uses the Ramer-Douglas-Peucker algorithm. Default is 0.1 mils.

--eulerian-paths

After computing all the paths, sometimes paths will overlap. pcb2gcode can detect overlapping paths and try to mill only one copy of each path, and then optimize the number of starts so that it will move the mill bit up and down the least number of times possible. This uses Hierholzer's algorithm slightly modified to make sure that milling that is required to occur in a certain direction still happens in that direction. The default is "true".

--vectorial (deprecated and always true)

This options uses the Boost geometry library to generate paths from gerber files instead of the gerbv raster library. It's much faster and it's the only one still developed. The alternative method is no longer supported.

--tsp-2opt

This will cause pcb2gcode to use the 2-opt algorithm to try and further optimize the order of milling. This can decrease the time spent moving between the end of one milling path and the start of the next. The default is "true".

--path-finding-limit

When needing to mill two paths that aren't connected, the mill can lift up from the work, move quickly to a new location, and keep milling. Sometime it would be faster to just mill to there and around any traces in the way. This option controls how much time to spend on looking for that shorter path. The default is 1, to only look at the direct path. To look at more paths, set this number. 50,000 is a good start. Larger numbers run slower but give better results.

--g0-vertical-speed

This is the G0 speed of your machine in the vertical direction. It is used for calculating the optimal path for saving time in milling. The default is reasonable and if you set it incorrectly, at worst your milling might take a little longer because the path won't as short. Most likely it will make no difference.

--g0-horizontal-speed

This is the G0 speed of your machine in the horizontal direction. It is used for calculating the optimal path for saving time in milling. The default is reasonable and if you set it incorrectly, at worst your milling might take a little longer because the path won't as short. Most likely it will make no difference. This assumes that your machine has the same max speed in both the x and y directions and the two are independant, so moving from 0,0 to 0,100 is just as fast as moving from 0,0 to 100,100. (Most CNC machines work like this.) Put the max speed along either x or y.

--backtrack

To make the best path that will mill quickly, pcb2gcode sometimes need to figure out get from milling one part of the board to milling another part of the board. There are two ways to do that:

  1. Lift the tool, move it, and sets it down in a new place, or
  2. Mill a path from one point to the other, going around traces.

There may sometimes be a trade-off because milling across the copper does a little more wear-and-tear on the tool than lifting it so that it doesn't have to mill across a space that doesn't need milling.

This option lets you set how much extra milling of copper you're willing to do to save time using the CNC. For example, 5in/s means that you'd be willing to mill an unnecessary 5 inches of copper away in order to save 1 second on the mill. The default is infinity, which means always try to make the fastest path, even if the mill has to make extra cuts in the board. 0 means to do the least milling possible, even if additional the lifting and lowering of the CNC tool slows down the process.