Getting polarity of a layer using KiCad's pcbnew Python module

I am trying to get the polarity of a borad’s layer using KiCad’s pcbnew python module but had no luck. Can anyone please help me out with this?

Thanks in advance.

What do you mean by polarity?

1 Like

All layers in pcbnew are positive polarity

2 Likes

Thanks for the updates Seth…!!!

I would still like to know what “polarity” means here.

1 Like

Oh wow, are Kicad made PCBs electron deficient? :astonished:

Well if you don’t design your boards with some positivity then electrons won’t be attracted to it and your device won’t work! That’s like physics 101, duh.

Negative Polarity, dark letters on bright background
Positive Polarity, bright letters on dark background

1 Like

I’m tempted to ask about polar bears, but let’s get serious for a while. I really don’t know what the question meant, and I wonder what Seth meant. I suspected that the OP thought that KiCad has layers as planes (GND and VCC) but wasn’t sure, therefore I asked.

If that was the question - KiCad doesn’t have plane layers, GND plane etc. are made with zones.

There are multiple relevant “polarities” in manufacturing. The OP question is likely asking what is the polarity between KiCAD pcbnew layer and the gerber file created. Positive means that a drawn filled rectangle in KiCAD results in a drawn filled rectangle in the gerber. Negative polarity would mean that a drawn filled rectangle in KiCAD would result in a hole in the gerber file.

“Polarity” can also refer to whether mask data is copied directly to the photographic plate or is inverted when making the plate. If drawing a filled rectangle in the gerber results in a filled rectangle on the plate, then it might be considered positive polarity. If a filled rectangle in the gerber results in a hole on the plate, then it is negative polarity. What makes this even more confusing is that there are different processes that have an inherent polarity. Some form of resist is used in most processes. The resist layer is formed by putting down a resist, exposing the layer through the plate/mask. Then etching away the resist. The resist layer can be positive or negative. Positive resist hardens where unexposed so the resulting resist pattern matches the photographic plate (dark where resist is hardened/kept, light where resist is removed).

There are several processes for getting material down in a pattern:

  1. deposit material everywhere, pattern a resist layer, etch material, remove resist layer
  2. pattern a resist layer, deposit material, remove resist layer

In process 1, material will exist wherever there is hardened resist. In process 2, material will NOT exist wherever there is hardened resist.

As you might discern, whether material is present on the board depends on all three factors mentioned.

  1. Polarity of the mask
  2. Polarity of the resist
  3. Process used for material deposition

All of these are dictated by your manufacturer, so ultimately what you need to know is how to represent the material in the gerber file.

The original question asking about “polarity of layers in KiCAD” is likely referring to only what KiCAD can control, which is what is in the gerber. I interpret the response of “all KiCAD layers are positive” to mean that drawing a filled rectangle in KiCAD results in a filled rectangle in the gerber.

1 Like

Ah I see, I believe the term is whether a drawing artifact is additive or subtractive in the final product.

1 Like

The solder mask layer gets tricky in interpreting the question. It could be considered positive in that a rectangle drawn on the mask layers will show as a rectangle in the gerber file. But these layers are intended to be used as a negative where that same rectangle drawn on the mask layers will be an area where there is not any mask applied to the board. This is industry standard so nothing extraordinary needs to be done when exporting the gerbers unless the board fab doesn’t follow the industry standards.

Hi eelik-

Sorry about that. Was typing on the phone.

I meant that KiCad’s layers are drawn the same as the physical thing they represent.

Of course, in my brevity, I neglected that our mask layers (F.Mask, B.Mask) are negative. They represent the holes in the mask

Agreed. The mask layers are tricky in this regard. In the integrated circuit world, when you fabricate a device, you also send documentation that lists each layer and their expected polarity on the mask. Knowledge of the process is rather important when ordering so that the combination of gerber (equivalent to GDSII in ASIC fabrication), polarity specification, mask and process line up so that you end up with each material in the right pattern on the board.

One could argue that since the products of interest are the apertures, these layers are additive in that respect even though it’s subtractive for the mask material. The fab takes care of that. So all’s right with the world.

One can argue a lot. The fact of the matter is that the plastic film that is the solder mask is the negative of what is drawn on the mask layers within KiCad.

1 Like

And the fab makes a negative of the copper layer to expose the resist. So who cares what happens in the fab as long as you get the tracks and apertures you want.

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