This topic comes up once in a while, but I thought I would share an open-source project I am working on for designing planar magnetics for power electronics in KiCAD. Right now it can draw variable width spirals.
That other post was on a specific question relating to turning the polygon generation into a component. This post is meant to advertise the project and to let others node that the code is available, where to find it, and what is its state.
Sorry, I do not actually use KiCAD at the moment, so I cannot help you. Still on Altium, but looking at KiCAD. Mostly I am waiting for a database library, since that is a work requirement. I was only suggesting from the point of view of someone who has done some power circuit layouts.
There are debates back and forth about whether or not sharp points are bad from a manufacturing standpoint, but they are definitely bad in that they result in high electric field and this can cause a failure mode in power electronic PCBs.
Thanks @nickoe. I originally experimented with just using min thicknesses on the polygon lines to simulate edge smoothing, but was not happy with the result because it wouldn’t smooth inner corners. I ended up just writing a smoothing library which takes a list of arc segments and solves for tangential cornering arcs in between each. This allows for a true arc specification with mathematically optimized smoothing.
def smooth_polygon(polygon: Polygon, radius: float) -> Polygon:
"""Smooth the corners of a polygon
Adds smooth transitions with tangential arcs in between the points of a polygon
Args:
polygon (Polygon): The origin polygon to smooth
radius (float): The radius of the smoothing arcs
Returns:
Polygon: A new polygon with smoothed corners
"""
assert radius > 0, "The radius must be a positive number"
# smooth the corners
arcs = [polygon.points[0]]
for arc in polygon.points[1:]:
arcs.extend(round_corner(arcs.pop(), arc, radius))
# don't forget to smooth the start-to-finish transition
arcs.extend(round_corner(arcs.pop(), arcs.pop(0), radius))
return Polygon(arcs, polygon.layer, polygon.width, polygon.fill)
I am running into a small issue with trying to export designs as a footprint file format. It appears you are not allowed to include vias in SMT footprints, which makes it impossible for me to connect the inductor/transformer turns across different layers. What I want amounts to what is effectively a net-tie spanning multiple layers with vias with the symbol of an inductor. Workaround right now is to simply not use an inductor/trnasformer in the schematic and just use shorts and manually include the planar magnetics geometries, but this seems really hacky and makes the schematic confusing. If I could generate footprint files that can be attached to the right symbols that would be WAY cleaner.
I guess I don’t really. What are you suggesting? Just switching to TH and stimulating vias with TH pads? Can I still tent the “vias” and remove copper pads from unuseds layers (important for creepage from voltages generated between turns).
I added some better examples to the project REAME. I plan to add more comprehensive documentation using sphinx with time.
I am not planning on creating a kicad plugin as this is designed to be a generic pip installable library, but I believe a plugin could easily be created using this. I will try and get a release onto PyPi in the next few weeks to simplify this.