How to generate a cutout/void inside a zone?

Holà,

I have the task to generate a circle inside a zone for an optical alignment purpose. Precisely a dot of soldermask in the middle of the crosshair.

I could also imagine to build a zone polygon with a round dent, duplicate and mirror it and then align them both together that the circle is generated, but how to generate round areas in a polygon?

Is that possible in Kicad (in our company unfortunately we only have v6 at the moment)?

Thanks for the attention :hugs:

Could you place a footprint that comprises the circle you want onto the zone rather than trying to incorporate it into the zone?

1 Like

That’s what I would do. Place a fiducial. They are placed exactly for this purpose: optical alignment

As said before, using a footprint may be the best option here, and fiducials are standard footprints used for alignment marks. You can use them, or study and modify them for your own needs.

But it can also be done directly.

  1. Draw some zones on different layers. (I have F.Cu and B.Cu in the screenshot).
  2. PCB Editor / Place / Draw Circle and draw a circle.
  3. Select the circle right click and from the context menu: Create from Selection / Create Rule area from selection

Rule area’s can be used in many different ways, and they can be active on more then one layer as you can see in the screenshot. You can also give it a name and then use it to apply custom (text based) rules to that specific area.

There is a limitation though. At the moment you create a rule area from the circle in step 2, it transforms the boundary into a polygon.

Is this optical alignment something you/ya’ll use for your own purposes, do you have explicit requirements for it, or do you just think this a good way to do it? Graphical shapes aren’t exported to position files, footprints are, if an assembly house wants a fiducial they probably want the fiducial in the position file. Otherwise alignment is more difficult to do.

You can stop here provided a circle is on Margin layer:
Circle

Ah, the margin layer. I keep forgetting about that because I don’t use it myself I guess.
I do see some strange behavior here. I did some experiments, and sometimes it cuts out the whole circle, other times it cuts out the circle on F.Cu, but only cuts a narrow slot on B.Cu.

Is this normal behavior or a bug?

Application: KiCad PCB Editor x86_64 on x86_64

Version: 8.0.4-8.0.4-0~ubuntu20.04.1, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.10.1
	HarfBuzz 2.6.4
	FontConfig 2.13.1
	libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

Platform: Linux Mint 20.3, 64 bit, Little endian, wxGTK, X11, xfce, x11
OpenGL: AMD, AMD RENOIR (DRM 3.42.0, 5.15.0-117-generic, LLVM 12.0.0), 4.6 (Compatibility Profile) Mesa 21.2.6

Build Info:
	Date: Jul 17 2024 01:37:21
	wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.71.0
	OCC: 7.6.3
	Curl: 7.68.0
	ngspice: 42
	Compiler: GCC 9.4.0 with C++ ABI 1013

Build settings:

I think it is a bug.
Your zones have specified net or no net?
Who knows - may be a decision if zone island has a connection with correct net pad is problematic where no net is searched :slight_smile:

Yes, both zones have a net name. A1 for Red, and A2 for blue

After looking a bit closer, the Blue zone was too small and did not connect to the pad.
If I extend it so it connect to the pad, then the margin circle acts as expected.
If I then shrink the zone again, so it does not connect to any pad then I get the behavior back of getting copper on both sides of the circle.

It sort of makes sense if KiCad does not know on which side the copper could / should be removed.

If I modify zone properties and set: Remove Islands to Never then the area inside the circle is also filled with copper, but a small line around the circle remains free of copper. So it does look like quite normal behavior after all, just some unforeseen combination due to this being a simple test project and my infamiliarity with the margin layer.

Also, If I set the properties of the circle on the margin layer to a Filled Shape, then it always removes copper inside the circle, even if the circle intersects with Edge.Cuts. (In the following screenshot, I have hidden the margin layer to make the effect on the copper layers more clear).

So it’s pretty predictable and straight forward, Only if the zone does not connect to pads, then KiCad does not know which side of the margin circle the “Island” is, and it just paints both. Older versions did not paint any copper of a zone if it was not connected to a pad. Theoretically more correct, but it confused quite some new users.

After my post with picture I went home and till Monday I don’t have KiCad at PC I am writing.
You may do experiments with copper to board edge (???) being set to 0. As I remember from about month ago thread if set to 0 margin stops to work.

When I started with KiCad V5 Margin didn’t worked for me and I didn’t understood form documentation what Margin is for (even I always used Keep-Out layer in Protel). May be I had these one setting set to 0 and didn’t know its influence on Margin working. I think that changing Margin line width you can get different clearance from margin than from PCB edge. But I think these both should be separate parameters.

I did some more (simple) tests with the margin layer.
First, It definitely uses PCB Editor / File / Board Setup / Design Rules / Constraints / Copper to edge clearance for the clearance from objects on the margin layer too. If I change this, and re-generate zone geometry with b then the clearance changes.

Line width of objects on the margin layer is also taken into account.

And further, the zones use their normal rules for island filling.

Below the test project I made for the screenshots. It’s just a little test, takes 5 minutes to throw together.

2024-08-10_asdf_margin_test.zip (15.8 KB)

I do wonder how valuable a collection of example projects would be, if neatly organized and combined with some text to explain their purpose.

Just make a rectangular shape layer, then change the properties of that region to cut-out. That;s what I follow in EasyEDA.

No, it’s for a manual optical alignment for a special PCB cutout on our CNC.

@Sagar_Saini my title was a litte misleading. The shown area is already a soldermask zone. So I want a cutout in this zone which means to have a round dot of soldermask :upside_down_face:

As there is a component under the center, it can’t be a hole or similar.
So I will see, if just a fiducial is Ok.