I’m looking for a way to round the corners of my non square PCB. I feel like once upon a time I knew a trigonometry equation for finding a circle tangent to two intersecting lines, but can’t recall or find it online now… Anyone know the proper way to do this? I know I can switch to the new OpenGL tools and get closer to accurate, but never quite right.
The shape of the board is dictated by existing parts it has to work with. The desire for the rounded corners is so that the board isn’t sharp from the PCB fab.
Here’s a link to an image of my board outline + top and bottom copper layers.
Use OpenGL mode + a reasonably fine raster. Or do you need sub 100µm accuracy for the board edge? Choose a diameter for the rounding, draw an arc, rotate + shift the arc for best match… fiddly work, but no issues.
I know that the math should work out, so I was just hoping to learn something instead of brute force it. I think I’ll resort to the brute force method as your suggested until I learn better. “Perfect” or “better” is the enemy of “good enough”.
If a future reader has insight, feel free to skool me
My attempt to be done with it and ignoring being perfect was met with much dissatisfaction from Kicad: https://i.imgur.com/Grr8MJN.png
Zoomed in on coordinates for the error.
In OpenGL mode, if you click on the straight line segment does it only overlap the curve in one spot, I had a similar issue with one of mine (cannot recall complete error message however) which resulted in the board not being able to be exported correctly as a gerber, and it was completely wrong in the viewer I use.
This was caused by the overlap of the corners and the sides being too long. When they were correctly aligned, only the end point (the curved end of both segments) was overlapping.
Update! Found a site called GeoGerba and made geometry work. Move the circle center point to change the radius and move points A, X, C to mimic the coordinates of your PCB edges and BOOM, it outputs all the data to draw an arc in Kicad: center point, start point on circle, and an arc length.
GeoGerba PCB Outline Rounding Edge
I tried coding it up in Python, but lost interest. Someone else should if they could and follow-up on this thread.
Another option is to draw the outline in libreCAD (qcad) and export as DXF then import that DXF as the edge cuts layer. Maybe a fillet tool might be of some use but I’m too lazy to code one. The maths is very simple; first you set the radius R of the fillet. Let’s say the angle of a vertex is A. Since the fillet is tangent to both edges the angle between a radius and an edge is 90 deg. Since a line from the vertex to the fillet center bisects the angle, you know your triangle has angles 90, A/2, and 90 - A/2. Now solve for the length along a filleted edge and calculate the start point and end point as they appear on those edges and calculate the center point.
That’s too much messing around to import/export. I know 3 (or 4 points). I can select a radius and be done.
A friend who gets excited about this sort of thing coded up a rough Java example that solves it:
YouTube video demo from him showing it in action on some earlier code: http://youtu.be/wlw2oDnjdX8
Compile it with gradle and Java 1.8 (I Used OpenJDK 8 on ArchLinux) and then run it.
java -classpath build/libs/rounded-1.0.jar com.mrdanielsnider.rounded.RoundedViewer
I’m sorry to bump such an old topic.
There still isn’t an auto-fillet in the new KiCad, but I found quite a simple method and wanted to share.
Lets assume I want the top left of my pcb to be rounded:
- Create a graphic circle to be used as a guide. Diameter to be 2* the radius you want your corners to be (for example, 3mm diameter).
- Move the circle so it snaps to the top left corner of your pcb
- Then shift the circle +x by 1.5mm, +y by 1.5mm. You’ll see the top left quarter of the circle looks like a rounded PCB edge.
- Now draw an arc to be your rounded corner. Snap the arc center point to the middle of your guide circle. Then 2nd point to the 12oclock point (snaps), 3rd point to the 9oclock point (snaps).
- Move/delete the guide circle, and you’re left with the round corner arc.
- Now pick the end handle of the graphic lines and move them back till they snap to the ends of the arc.
And you have your rounded corner!
Long to explain, but very quick once you get the hang of it.
Just draw an arc with the radius you want, and approx the included angle and shift it around a bit untill “good enough”.
Then move the end points of the straight lines to line up with the end points of the arc. This is the most important step because you’ll get yourself into trouble if the PCB outline is not a closed loop.
You can drag the square control points around, and when end points meet Pcbnew gives feedback by drawing a withe circle around the control points.
This works best when you zoom in very far.
Can someone now please close this 5 year old thread?
A much simpler solution is to use KiCommand.
- Construct the Edge.Cut boundary with straight lines.
- Select all continuous Edge.Cut lines for which you want rounded connections.
- Enter the appropriate KiCommand command:
- 5 mm list drawings selected round refresh
See this post for sample images. The commands in that post are really old, so use the command I show here.
This will connect the lines with KiCad arcs with the given radius (5 mm) and shorten the selected lines to fit.
(Also note that list in the command given is an artifact of KiCommand. I’ll make a note to remove the need for it in a future version of KiCommand.)