Problems with gerber offset when converting to gcode…


#1

Sorry if this gets long. I think this is half going to be a tip post and then I’m going to ask for some help. I’m closing in on the setup I want to quickly iterate boards for home production…

  • I’ve got a cheap T8 cnc machine from banggood which I intend to use only for drilling/cutting
  • I’ve gott a pretty decent chemical ething process for the rest.

I got that cnc to mill pcb’s but got the toner transfer method working pretty well for two-sided pcbs before it arrived so I’m sticking with that to reduce the mess and all the work . However, I’d like to be drilling automatically.

My idea is to drill first and then align two sides of toner transfer using the already drilled holes. So workflow is to create a pcb in kicad. I then use a python script to output gerbers, then pcb2gcode to generate gcode. This I’m now going to send to the cnc with bCNC. So I have this master script that just looks like this:

#!/bin/bash

# This generates gerbers and drill files
../kicad-python-scripts/generate-gerbers.py ../../vco555-3/vco555.kicad_pcb .

# Generate gcode using pcb2gcode
pcb2gcode

export PYTHON=python2
/Users/viktor/dev/projects/bCNC/bCNC drill.ngc

From this I can make changes in pcbnew and just rerun and 2 seconds later I have bCNC open with the changes loaded, ready to send to the cnc. However, I’m having problems with offset, the gcode I get looks like this:

I can find no setting in pcb2gcode to input any offset in the generation from drl to gcode. I’ve tried just setting the “origin point for drill and place files” but that doesn’t even make difference. This is my pcb in kicad:

It looks to me that origin is still on top left of the A4 or whatever that is… I’m not sure where the best in the pipe to fix this or where to investigate…

Any help highly appreciated!


#2

Two seconds later I find this:

–zero-start
set the starting point of the project at (0,0). With this option, the projet will be between (0,0) and (max_x_value, max_y_value) (positive values)

Not sure I understand that text, but it seem to be doing something decently to what I want (maybe):


#3

Use also need to enable “Use auxiliary axis as origin” when generating gerbers and “Drill origin : auxiliary axis” when generating drill file.


#4

Use also need to enable “Use auxiliary axis as origin” when generating gerbers and “Drill origin : auxiliary axis” when generating drill file.

@bobc

Any idea what that looks like in the python bindings?

I’ve got:

# Fabricators need drill files.
# sometimes a drill map file is asked (for verification purpose)
drlwriter = EXCELLON_WRITER(board)
drlwriter.SetMapFileFormat(PLOT_FORMAT_PDF)

mirror = False
minimalHeader = False
offset = wxPoint(0, 0)
# False to generate 2 separate drill files (one for plated holes, one for non plated holes)
# True to generate only one drill file
mergeNPTH = False
drlwriter.SetOptions(mirror, minimalHeader, offset, mergeNPTH)

metricFmt = True
drlwriter.SetFormat(metricFmt)

genDrl = True
genMap = True
print 'create drill and map files in %s' % pctl.GetPlotDirName()
drlwriter.CreateDrillandMapFilesSet(pctl.GetPlotDirName(), genDrl, genMap)

(courtesy someone here)


#5

Good question, you can get the aux origin with board.GetAuxOrigin(), and there appears to be a property of EXCELLON_WRITER that is the offset, I’m not sure of the right Python syntax to access that, but maybe

drlwriter.m_Offset = board.GetAuxOrigin()


#6

Awesome, thx!

# drlwriter.SetOptions(mirror, minimalHeader, offset, mergeNPTH)
drlwriter.SetOptions(mirror, minimalHeader, board.GetAuxOrigin(), mergeNPTH)

#7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.