Setting board origin (NOT plot origin)

I’m using coordinates from the kicad_pcb files in the generation of GCODE for a home built pick & place system. I’d like to set a point on the board (the same point the pick & place is using) as the x = 0, y = 0 origin. The documentation talks about setting the origin but this seems to refer only to the origin as used in the plot files. Right now, the only thing I can think to do is to write a program that will read the file, locate the X,Y coordinates of what I want to use as the origin point, then subtract these values from all X,Y coordinates in the file. Surely there must be an easier way. Right now, the X=0, Y=0 location is in the upper left, even outside the frame drawing.

1 Like

yeah, the center of the pcb-sheet is @ [148.5,105]

Did you try the ‘Place the origin point for drill and place files’ yet?
It’s far down in the right tool menu, right above ‘Set the origin point for the grid’.
Can’t see that any of those have an effect on the readouts though… but they work on the plot/output coordinates if one chooses ‘auxiliary axis as origin’.

You’d just have to find a way to work with the plot output files instead of the .kicad_pcb - which is way worse than what you do now I guess?
What I wonder is, how is this kind of information being communicated to a manufacturer with CAD files - they can’t have all programs installed to be able to read proprietary board files formats or?
Did you research any of that?

I did try setting that origin point but, as you noted, it doesn’t have any effect on the displayed readouts and, (sadly) it has no effect on the board output file - only gerbers & drill files. The only reason I’m not working with the gerbers is that when I started using KiCad I needed capabilities that weren’t there in pcbnew so I wrote a library aimed towards processing the *.kicad_pcb output file to do what I needed. I was hoping not to have to dig into gerbers as far as trying to extract data from them (I just view them to make sure they’re what I think they should be). However, it may be time to cross that bridge. Besides posting here I’ve also been Googling like crazy and am not the first to face this issue. There have been “feature requests” filed but it looks like nothing has come of it for now.

Yeah, looks like it.
Have you seen this? http://www.compuphase.com/visualplace/visualplace_en.htm
Freeware, doesn’t seem to cost anything and should do what you want (don’t know if your PnP can read it though).

The blokes over at Firepick must have similar problem(s), but can’t find any obvious solution mentioned by skimming over their google-group… https://groups.google.com/forum/#!topic/firepick/bBWKLeqelAE

Wow - I was completely unaware of either of these two links. There looks to be so much cool looking stuff there that you have probably set my project back by at least several days! The first link looks really promising, but even if there’s nothing there that I can use, I had already decided to add (yet another) function to the library that will post-process the *.kicad_pcb file to do what I need. I can see this happening again on future designs so I might as well resolve it now.

Sorry, btw… stumbled across another project which seems to work from KiCAD sources


Maybe they got some piece of software that you can reuse for your purpose?

[edit]
Also run across this in my mailbox today… seems to touch your field
https://groups.google.com/d/msg/firepick/Fkh5mN-2YQ8/BTyyENCAEAAJ

… As I said, Gerber is first, Eagle specific will come later. There are benefits of importing Eagle files directly (along with other native formats for CAD packages) in that you get to skip a few steps and you get more data, but that is phase 2. Phase 1 is import Gerber and put down paste.
For PnP, OpenPnP currently supports importing centroids from Eagle mountsmd.ulp output and KiCAD .pos files. Both are pretty simple whitespace delimited text files. I don’t know of any single standard .pnp file. If you do, please let me know and I’ll be happy to support it. …

Just tried to export some .pos file, but it tells me I don’t have any machine placeable parts, gotta look now into that as my footprints are all ‘homebrew’, which means I’m missing some attributes there.

And to answer my own question, in the footprint editor > footprint properties dialog I had to change ‘Attributes’ from ‘Normal’ to ‘Normal+Insert’.

This causes an addition in the .mod file for the footprint at line 3 from this:

(module R_0805 (layer F.Cu) (tedit 55BC8353)
(descr “SMT capacitor, 0805”)
(fp_text reference REF** (at -0.4445 0 90) (layer Cmts.User)
(effects (font (size 0.2 0.2) (thickness 0.02)))

to this:

(module R_0805 (layer F.Cu) (tedit 55BC8353)
(descr “SMT capacitor, 0805”)
(attr smd)
(fp_text reference REF** (at -0.4445 0 90) (layer Cmts.User)
(effects (font (size 0.2 0.2) (thickness 0.02)))

Sorry - I didn’t realize there had been another post until I just checked. I got an email the first time, but not this time.

Anyway, I did implement the code necessary to calculate the correct X,Y locations in GCODE and just verified that it seems to be driving the pick & place correctly. This got rather complex because there are now three points to consider: the point that KiCad considers the origin ('way out in the middle of nowhere - why I don’t know), the arbitrary point on the board that I’ve chosen to be the origin for the pick & place, and finally, the coordinates of the part that is going to be placed. Didn’t help much that the Y axis increases in the “down” direction rather than the “up” direction like every other CAD/CAM program I’ve seen (including the mill software). But - it’s done.

I’m aware of, and tracking, many of the new pick & place offerings and they seem quite sophisticated. Very impressive for what it looks like they will cost. However, even the cheapest looks to be well over $1K and probably outside the budget for a hobbyist or small startup.