Coordinate system, grid and origins in Pcbnew (especially version 5.99)

Introduction

This article descibes the situation in 5.99 (nightly builds) and later 6.0; many details are applicable to v5.1. 5.99 is still under heavy development and details may change.

KiCad is a CAD system with 2D data which needs coordinates to mark locations of items. In theory it’s possible to have a CAD system which relies completely on constraints, not coordinates, but KiCad can’t be like that. There must be an internal coordinate system and all explicitly defined locations must fit to that system.

The layout editor has a resolution of 1 nanometer; that’s the smallest difference in X or Y direction which two locations can have. It also has an internal 0,0 origin for the coordinate system which is the “Page origin” – the upper left corner of the page area which you see when you open Pcbnew.

In the internal coordinate system X increases from left to right, which is normal, but Y increases from top to bottom. The reason is historical. The Y axis direction has been very annoying for some users, it hasn’t been possible to change it, and what the user has always seen and used is the internal coordinate system.

Configurable origin and axis direction

From version 6 onwards, and already in 5.99 nightly builds, it’s possible to configure both the visible origin point and the axis directions.

It is important to know that these affect only the visible coordinates in the graphical user interface. The internal coordinate system and different kinds of file outputs aren’t affected.

These can’t be configured in version 5.

Different origins

Page origin and internal origin

This is the same as the internal origin of Pcbnew’s coordinate system. Pcbnew has a concept of “page” even though the layout isn’t primarily for printing to a paper.

By default the page origin is used as the visible coordinates origin. Internal X-coordinate value grows from left to right and Y-coordinate value grows from top to bottom. Page origin cannot be changed.

Drill/Place file origin

This has also been called “Auxiliary axis origin” or “Aux origin”.

This is a point which users can set. Earlier (in v5 and before) it has been possible to use it as an origin point when exporting certain files, but now it’s possible to use it as the origin point for the visual coordinates. Select Place -> Drill/Place File Origin (in v6) or Drill and Place Offset (in v5).

image

Grid origin

KiCad uses a concept of Grid. One grid is active at any given time. When items are placed or moved the cursor usually snaps to grid points but not outside them. It would be very inconvenient if the internal system with 1nm resolution would be used for item placement. It’s better to use a grid with for example 0.1mm or 10mil resolution.

If the user keeps the same fine pitch grid all the time the concept of independent grid origin isn’t necessarily needed. But let’s suppose we use 10x10mm grid and want to place an item to each grid point. By default the grid starts from the internal 0,0 origin, so we have grid points in e.g. 100,100 110,100 120,100 etc. What if we want to start from 101,101 but use 10x10mm grid? That’s where the movable grid origin comes in handy. If we open View -> Grid Properties we can set the point from which the grid is defined and being drawn. It’s the one point of the coordinate system which is always on the grid by definition. It’s not any coordinate origin, relative or non-relative, by nature, but it can be used as such.

image


There’s one danger when changing the grid origin. As you can see in the illustrations above, the items which were positioned using the old grid origin are out of grid after changing the origin, and vice versa. If you have designed a board with certain grid and change the origin, you should change it back after you have used it for some certain need. Otherwise you will have difficulties, most of the items being out of the grid.

Local or User origin and coordinates

KiCad has a handy way to make measurements and see positions of items relative to some coordinate point without changing the coordinate system. Just press the spacebar on the keyboard. It sets the “Local origin” (sometimes called “User origin”). It’s a temporary point and meant to be used as a quick helper, not as a permanent reference point. It can be very useful when measuring distances and placing items.

5 Likes