Grids, Origins, Offsets, and Pitch

To help clarify what I mean by ‘the existence of two grids’ in PcbNew, this image should help:
image

Here, we see a grid (dots at grid intersection points), with the open dialogue box showing the so-called User Grid setting.
The visible grid is set to 50 mil (0.050 inches).
The “user grid” is set to 1 inch.
Functionally, I can easily understand that the Footprints of the components can be moved (using the Grab command) and that they will snap to a location on the dotted layout grid nearest to where the mouse button is released. That’s all very intuitive.

But that still doesn’t explain the need for the existence of the “user grid”, and why the “user grid” has dimensions associated with it.

As I mused / tried to relate in an earlier posting: if the “user grid” is a mechanism for setting the location of the Origin for a user-based coordinate system (and possibly for defining the Axes [directions] of a User Coordinate System) that would be an understandable function [i.e., understandable in the context that every CAD system defines an untouchable coordinate frame and measuring system, and that the positional values seen by the User are simply the mathematical transformations of that untouchable internal system. So, some users may want or need to redefine ‘which way is up’ and so forth].

But at this time, to me, the underlying purpose and function(s) of the ‘User Grid’ of PcbNew are not clear, whereas the visible (dotted, layout) grid’s purpose is very obvious.

There is only one grid. That grid has a multitude of preset dimensions that can be chosen, or you can select “User Grid” which is nothing more than custom dimensions that are applied to the grid. The user grid, or “custom” grid, allows you set the dimension for each axis independently.

Does that help?

1 Like

I propose an easy to make experiment. Set the custom grid to lets say x=1, y=5
right click -> grid -> user grid. What do you observe?


I see that this has no observable effect whatsoever; the visible grid (dots) are in the same location, and the snap-to functionality is exactly the same.

Did you really do all the steps i described above? Because i use kicad now for a long time and it always worked like i described above.

Make a screenshot of the full window (such that i can see your top toolbar. There is a drop down menu for grid selection there. It must read “user grid” such that changing something in the dialog you show takes any effect.) You also need to know that you need to press ok in the window you currently opened to see the effect of changing something in it.

The zoom level might also play a role. Kicad hides sub-divisions of the grid if it gets too dense.

Editing the “User Grid” dimensions in that dialog box does not select the user grid, it only sets it’s dimensions. You then need to select “User Grid” as @Rene_Poschl illustrated above.

1 Like

Ah-HA!
OK, I get it now. I didn’t properly understand the instructions, and up until now I had not noticed that User Grid was in fact one of many choices from within the {right mouse-click menu} Grid Select menu. I think this screen shot (with captions) illustrates this succinctly:

The user defined origin works for any grid. Including “KiCad’s predefined, square grids”

Thanks for that clarification.
The dialog box for the User Defined Grid includes a dialog for setting the Origin. So, it seemed that this origin would be linked only to the User Defined Grid, and that all others would be keyed to some ‘universal’ origin.
I can now see that, not only is the Origin not linked to the User Defined grid but that the Origin can be set on-the-fly by choosing Place…Grid Origin from the drop-down toolbar. So the Origin dialog within the User Defined Grid menu is merely a shortcut.
I should note that I’ve also discovered that there can only be one Origin: If you are using one of the non-User-Defined grid systems and alter the Origin, it changes the setting previously made within the User Defined grid dialog. From that perspective, it’s a bit confusing to have that origin-setting shortcut within the User Defined Grid dialog box.

I observe that moving the Origin doesn’t appear to affect the X, Y and dx, dy readouts at the bottom of the windowPcbNew%20grid%20dialog_5. I was expecting that shifting the origin would have precisely that effect.
So, that begs the question: How does shifting the Origin affect the process of laying out the board? Or, posed another way, When and why would I want to shift the Origin? Does it affect the Gerber-file outputs??

Yes the readout is relative to the file format origin (the X and Y values)

The dx and dy readouts are relative to yet another origin. That one is set using the spacebar. (It does not leave a visible mark)

1 Like

I think it’s a misnomer to call that an “origin”, it’s simply a reference point for the measuring tool.

2 Likes

I see that the file-format Origin is permanently in the upper-left corner.

Your mention of using the spacebar to set an (invisible) origin would seem to answer another question I had in mind, being: How do you perform measurements from point-to-point in KiCad (in Solidworks, for example, there is the Evaluate >> Measure function).

So what useful function does setting of the (visible as a bullseye) Origin have?

Don’t worry, you’re not the only one who has been confused about the “grid origin”. It’s actually not an origin at all in the sense of some coordinate system origin. It’s just the point in KiCad coordinate system which is always exactly in a grid point. It kind of sets the grid offset. “Grid offset reference point” could be the most descriptive short phrase for it. But it can be thought of as an “origin” because when you change the grid, you could use the grid origin as the one point from which you could start drawing grid points (or lines).

Ahhhhhhhhh.
Thanks, that’s a much more sensible explanation. And, it’s helpful to know that I am not in the same league as Homer Simpson.
Now, this leads to another question:
If, for example, I’ve dropped in a component Footprint that has a circular feature, and I want to use the center of that circular feature as the “origin” of my grid, are there selection filters that allow for choosing the center of a circle? Or, the midpoint of a line? (etc)

If you mean the one in KiCad v4 Place->Drill and Place Offset, not much. There was a developer discussion about different origins and at least some thought the this “auxiliary origin”, used for some output files, isn’t needed.

@von_Whimhurst Glad to kown you have understood from other users how the grid works.

In some cases it is possible. I use frequently this feature. If the circle is a pad (through-hole or smd) I set the grid origin (the “Grid offset reference point” as @eelik points out) on that pad to make measurements or create zones and place other footprints at a given distance from that pad.

To snap the cursor on the center of the pad I set the magnetic pads under general settings to always. Then I change the grid to a more comfortable user grid for my purposes.

It also works on a rectangular pad or a via.

Eelik:

No, sorry…I didn’t mean the origin associated with the Drill-and-Place Offset. I was referring to the Origin that is set via the drop-down menu, Place >> Grid Origin

  • The former appears (in default colours, at least…) as a red circle with vertical crosshairs
  • The latter appears (default colours) as white with inclined crosshairs that extend outside the circle:
    image

Pedro:

Ah-ha.
Thanks for pointing out the function of the “Magnetic” settings (that is, it operates as a snap-to Filter)

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