Complex PCB edge with matching margin

A complex Edge.Cuts layer may require many lines and arcs. Often a Margin layer is needed to match the Edge.Cuts to allow a correctly bounded copper pour like in this image:

To date I have achieved this a few ways:

  1. With a DXF double import: One to Edge.Cuts, another to Margin. However, if a DXF is not the source of the board outline, or is lost, or requires lots of tidying up etc., then I might try:

  2. Graphically via two PCBNew instances:

  1. In high contrast mode, select and copy applicable Edge.Cuts artwork
  2. Open a new PCBNew window and paste.
  3. Edit > Move and Swap Layers.
  4. Copy+paste back into projectā€™s PCBNew window. Or,
  1. Kicad script:
  1. In high contrast mode, select applicable Edge.Cuts artwork.
  2. Run this script to copy selected drawing segments to Margin:
  import pcbnew
  board = pcbnew.GetBoard()
  for drw in board.GetDrawings():
    if drw.IsSelected():
      drwCpy = pcbnew.DRAWSEGMENT(board)
      board.Add(drwCpy)
      drwCpy.SetStart(drw.GetStart())
      drwCpy.SetEnd(drw.GetEnd())
      drwCpy.SetWidth(drw.GetWidth())
      drwCpy.SetAngle(drw.GetAngle())
      drwCpy.SetArcStart(drw.GetArcStart())
      drwCpy.SetShape(drw.GetShape())
      drwCpy.SetLayer(pcbnew.Margin)
  1. Because of a bug in Kicad I then need switch to legacy canvas (F9), then back to modern canvas (F11) to refresh the artwork.

All of these approaches can be pretty cumbersome, so Iā€™m wondering if anybody has discovered a better way?

In Altium Designer for example, I am able to copy+paste, then use the PCB Inspector tool to switch the layer of any selected items.

Regards
m

Sounds here like Kicad really needs a Clearance to PCB edge option ?

Other CAD pgms have more options in their clearance rules.

? I can create a polygon on Edge, and move to Margin by simple select, layer change ?
I canā€™t change it to F.Cu, or change a F.Cu layer to non-copper, but thatā€™s Kicad trying to protect users.
You can easily edit the design file.

I am not really sure the margin layer is used for anything in KiCad. (At least not in KiCad 4. Maybe something new has come in in KiCad 5)

I just tested the layer-change detail.

Margin seems to have no effect on any pour, so if you do want a Fill area to have an edge clearance not the same as other clearances, you will need a second polygon, shrunk manually, best done via DXF import from CAD pgms that can easily manage shrink ?

I am not sure there is an easy way to get a dxf converted into a filled zone. Maybe this would need a python script.

? I can create a polygon on Edge, and move to Margin by simple select, layer change ?
I canā€™t change it to F.Cu, or change a F.Cu layer to non-copper, but thatā€™s Kicad trying to protect users.
You can easily edit the design file.

Do you mean a ā€œfilled zoneā€ in Kicad vernacular? Iā€™m aware you can change the layer of a zone very easily, but then you have the issue of creating a complex zone outline. You canā€™t easily do this *without some hackery IFAIK, so the problem remains. As for individual lines/arcs, these can be changed individually, but not in bulk selection.

*EDIT

I just tested the layer-change detail.

Margin seems to have no effect on any pour, so if you do want a Fill area to have an edge clearance not the same as other clearances, you will need a second polygon, shrunk manually, best done via DXF import from CAD pgms that can easily manage shrink ?

Interesting. I was so sure it did have an effect (maybe that was in V4??). It seems a the filled zone (e.g. in my image above) is using the edge cuts as a perimeter. I donā€™t think this is necessarily the correct approach, but makes things easier in most cases.

In AD I would define a keepout, usually to be a minimally modified copy of the edge. This would be the copper pour edge. Sometimes you might want it to run over the edge, hence why I donā€™t know that itā€™s the correct approach to assume the PCB edge will always define the copper pour marginā€¦

I thought the kludge to enforce a ā€œClearance to PCB edgeā€ in KiCad was to understand that the board will be milled to the centerline of the board outline on the Edge.Cuts layer, but the copper-to-copper clearance settings for the pour will treat the Edge.Cuts lines as copper traces and enforce clearance to the edge of the line. Thus if you want a larger copper-to-edge clearance than the normal copper-to-copper you make your board outline on the Edge.Cuts layer as wide as twice the difference between the two clearances.

For example, if you want 10mil clearance copper-to-copper, but also want 15mil copper-to-edge clearance. The difference is 5mil, so you would make the lines for the board outline on Edge.Cuts to be 10mil wide. This would also enforce DRC to keep traces at least 15mil from the centerline of the board outline.

1 Like

See above also - you can use the width-is-used effect to skip the shrink step, if you want a larger PCB clearance.
Of course a fat Edge.cuts line looks strange, so you might want a finer copy on another layer to give to the FAB - but thatā€™s now a simple copy, as the line width manages the shrink.

If you wanted a special case PCB edge (as in a edge connector) then I think you need to use (eg) margins as a PCB fab indication, and use Edge.Cuts (line edge used) as the pour-limit control.

Yes, KiCad lacks finesse in many ā€˜groupā€™ operations.
You cannot for example, ^Click to select multiple entities.

You can mouse-box select a number of lines, and duplicate works on that as a whole, but you cannot then change layer on that selected group. You must use a script, or deselect, and change each segment, one at a time.
Also, Zones behave like polylines, but normal drawing lines do not, so there is no segment-drag.

I think polyline support is coming, so you will be able to drag a segment, and extend the connecting lines ?

In the modern tool set you can use shift plus click to select multiple things.

planned for v6. So in two years or so for users of stable releases.

Ah, missed that, nice to know - but that still does not allow Query(layer change), so is the same as mouse-box select.

For traces and vias it is possible to open the properties dialog for multi selection in v5. (so you can change the layer and trace width of all selected traces at once) Sadly not for anything else.

I thought this technique was discussed in detail, with illustrations, 2 or 3 times in the last year or so but I can only find an old post of mine : Creating ā€œzone outlinesā€ for odd-shaped PCBā€™s

I donā€™t think you need to do anything more than define the fill-zone as a rectangle circumscribing the board outline, and fill it. The algorithm places copper up to the board outline, less the ā€œclearanceā€ parameter. You may have to be careful that the outline on the Edge.Cuts layer is a strictly closed contour.

The clever trick of adjusting the board-edge clearance isnā€™t too difficult in practice. Select everything on the Edge.Cuts layer, change the line width, do the fill, then re-set the line width if necessary.

I am NOT a programmer but my superannuated brain (which learned ā€œFortran IIā€ over half a century ago) wonders if this feature could be easily implemented by defining the Edge.Cut as a special kind of Net Class, with an associated Clearance parameter just like any other Net Class.

Dale

Yes, that seems a good approach, as that structure is already there.
You can have a net entry with 0 connections, and a net called Edge.Cuts is valid.
It just needs to be ā€˜appliedā€™ to the edge cut lines during fill.

It could be applied to traces or footprints in general, and checked during DRC. In years past, board fabricators imposed a requirement for edge clearance, just like requirements for trace spacing - except the required edge clearance was often larger than trace spacing. In those days the edge clearance was a design rule just like trace width or spacing, and something to be checked by DRC. In recent times they are more tolerant of things like edge contacts, plated-through castellations, etc, so the ā€œruleā€ is much less definitive. Even so, I think thereā€™s value to defining the Edge Cut as a kind of net, with clearance requirements like any other net.

1 Like

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