Solved -- Create a trace that snuggles up to curved dxf-imported board edge

Yeah, this is a pretty long question.
I am doing a project with a curvy enclosure. The vendor, hammond, did not provide a board outline file, and the 2d drawing was not fully-defined, but with a pair of calipers and two pairs of reading glasses, I got started. However, matching the curved edge seemed tricky to do manually, especially since I don’t see any sort of kicad spline/bezier tool for drawing on the edge cut layer.

So I got the vendor step file, opened it in solidworks, found that it was a complete assembly down to the screws, and even had a pcb hidden inside (an easter egg with remarkable timing). I saved it as an assembly, and then opened the pcb part file, extracted the pcb outline and saved it as dxf. Whew. Anyway, that had nothing to do with kicad, but now I have a dxf outline for kicad import.

I started my kicad project and imported the dxf file to the User-1 layer, so I can measure/verify it, add centerlines and hole centers:

Then I also copied it to the edge cut layer and trimmed that down to a proper closed shape:

Now if I just want to add a ground plane it is easy to plop a polygon around it and set a design constraint to set copper-to-edge-clearance as needed:

Which finally brings me to my question, how can I get a trace (or inner polygon that effectively becomes a trace) that snuggles up to the edge?

The application is for an esd ring, which frankly is a great idea and easy thing to implement for your next design, whatever it may be. The top and bottom layers have this ring, which only connects at one point to battery negative or chassis ground. ESD events that get through the enclosure seam and hit the pcb ring get shunted to the safest potential in the circuit. All net-protection tvs parts dump into this ring, connector shells, and sometimes cable shield, connect to the esd ring. Sensitive stuff in the middle is safe as no high currents are running through their return paths, creating damaging delta-volts. Anyway, that’s the theory as I understand it. I have a product that will be going through testing including bung-puckering 16-kV contact discharge esd zaps, so I need every trick.

On a rectangular board, it is easy to draw traces for the esd ring, and have the ground plane just inside that. Below, the three-hole lego-technic thing is a gnd-tie to the main ground – the only spot the “chassis-gnd” esd ring gets connected to ground. D1 is a tvs diode dumping into it, and the usb shell is on the ring. It goes around the whole board on top and bottom layers, and connects to other connectors and tvs parts.

So how can I create an esd ring on a curved edge?

Well, I kinda got something – I took a copy of the outline, selected it all, create-tracks-from-selection, gave it the net name and a fat width. The enclosing ground zone fills inside it and that inner clearance can be adjusted with polygon property. However, the constraint from board setup, “copper-to-edge-clearance,” is no longer enforced so the fat trace bleeds over the edge (truncated at edge shown in 3d render):


Any ideas?

1 Like

image
You may have a look at RF shield

1 Like

Hmm. That sounds more than what I need.

Here is a fundamental question: why doe the kicad copper-to-edge constraint work with a plane and not a track? If it did I would be done. Here is a very quick example – I would call this a bug actually:

What about selecting all your fat traces and Convert to Zone? (The zone should get clipped properly to the board edges.)

1 Like

I thought about that but when I select the fat traces and create-from-selection, the only option is array.

It is also not just a random fat trace, I made it 3mm wide. It is centered on the edge cut. So, if I could enforce a 0.5mm edge clearance, I would have a nice 1mm ring trace left, and can have an interior plane fill up to that nicely.

Well, the fat traces were grouped, and array was the only option. I copied that out and ungrouped it, then selected it and could convert to zone. However, the traces are now skinny and the dozen or so curved segments from the dxf import got turned into a hundred little segments:
hmm

Oh, right, I couldn’t add that to 7.0 because it contained string changes. You’ll need 7.99:

(The actual zone won’t contain any different properties, so you should be able to copy it from the 7.99 document and paste it into a 7.0 document. “Should” being the operative word…)

I can’t say ‘why’ the dimensions are not as I expected and, I did not bother to investigate why some imported shapes/lines are not what they should be…

However, some simple solutions that I’ve used several times to accomplish similar tasks involves the following in some aspect, depending upon what works and what doesn’t work (usually, it has to do with Kicad’s versions not being consistent).

Basic concept is to have a PCB shape, Offset it’s lines and use it to make Trace/Zone/etc

One Approach if you have a DXF for your board shape and want to create copper but with it offset a tad-bit to get edge clearance:

By Example…
• Loaded a DXF into Edge-Cuts
• Select it, Plot it
• Import it with a Scale of 0.92 into Copper Layer

You could do similar fooling around with making it a Zone/Fill/Track

Could also, use the Offset ability in Solidworks and FreeCAD

Shape Drawn in FreeCAD, exported DXF

Shape DXF imported into Kicad and then, Ploted it from Kicad and Imported at Scale of 0.92 with Line-width of 4mm

ADDED: 22 yrs ago, I used a similar Hammond Box for my orignial Astronomy app based on dsPIC.
I milled the face-plate for the Buttons and LCD Now, I 3D-Print/Design them…

Ahh, I was looking for some sort of scaling transform, but didn’t realize that was an import option – that may be the trick I need. Gotta do some yard work so look at it later. Thx

Did some putzing with scaled dxf and realized that while the shrunken outline is as expected for the convex outer curves, it is the opposite for the concave cutouts.

So then I thought maybe keepout of some sort would be handy – as in adding a 1mm wide line centered on the edge cut as a keepout, to enforce a 0.5mm edge-to-copper clearance. I thought this would be a good hack for the apparently-broken board constraint for edge-to-copper. But a quick test with a keepout region shows that it also seems to ignore the perimeter trace. Sigh.

ko

I often find the best solution is to start over by Brute-Force, if necessary, using the existing tools, versus hacking work-arounds.

Perhaps I don’t fully understand your goal but, If I do understand it correctly, just Drawing Tracks is simple enough. I did NOT fuss with trying for Exact Dimensions/etc but video conveys enough info… (picture = 1000 words)


1 Like

OK, I didn’t really try to just route a trace, but you got me looking at it. The edge-to-copper constraint does not work with traces pasted over the boundary, but it does control the extent of planes, and routing of traces. I can’t just use an arc like in your demo, as the curves are complex, but I did get something that looks like it will work.

By setting grid down to 0.1mm, and drawing the traces in short little bits while keeping the cursor outside the board edge, I was able to draw a line up against the curves. It needed to use 45 degree sections around the notches, but I can live with that:

One problem though: it won’t let me connect it into a complete closed trace – opens it up somewhere. I think there is a setting that allows this, but unsure what it is. Anyone?

Look at your posted image… Missing closure line

Screen Shot 2023-04-08 at 16.15.53

I’m certain you can figure this out…
Depending on your system and setup… I’m set to Not snap when holding Sh+Alt

Ahh that is a good idea. I will try to refine the notches. Say, how do you make those little videos? You are on linux as well iirc.

Regarding the non-closed trace: if I close it it deletes a segment somewhere else. It won’t let me complete the loop. I thought I read something about a setting for that.

I’m on a Mac.

I make Screen-Shot movies (using Mac’s QuickTime App).
Then, to reduce the File size for posting under Kicad’s 4M limit, I use HandBrake (free Open-Source app) to export an .mp4.
There are presets for usage-type and quality; I use the ‘Gmail’ preset because it makes a nice-enough file size and video.

Not completing the loop - hum, I know nothing about that as you can see from my posts wherein the copper is closed.
There may be a setting, I don’t remember the various pref panel’s contents… (It somewhat leans me to think it’s like a “walk around” setting. When in the PCB, click the Green Icon in top bar - it’s the PCB settings panel and not available elsewise (AFAIK)… You may find something to Click to solve your problem…

ADDED: When in PCB, the menubar > Route>Interactive Router Settings:

Yes, it was indeed the Interactive-Router-Settings dialog – the “Remove redundant track” box needs to be unchecked to allow the track to connect in a loop. I saw this before when I was trying to parallel a power trace between vias by drawing a track top and bottom, and it would only allow one. A kinda annoying default setting but good to know where it is hidden.

I was able to make a copper arc as you showed, but could find no way to give it a net. Perhaps there is a way. I gave up on that.

So then I just did an ugly hack, by drawing an inner arc on the edge cut layer, to force a real trace route to follow a channel. A rather granular-looking trace that needed some manual grid-off tidy up:

But I did finally get a perimeter trace route:

So, you want to make it a NET.… Best to plan Ahead.
This will show you how to do it, after Netting, delete the left-over lines (I didn’t delete them in video…)

Planning Ahead.… you could have simply Drawn Tracks and Netted them in One-Fell-Swoop.
You can use the Fillet Track tool (and, I think in v7 there’s a Radius ability - not sure. I’m staying with v6 for at least six months)

I had tried this before and could not seem to convert an arc to trace, but I tried it again and finally got it to work.

I created the arc on top copper, set the width, right-click, create-from-selection/create-tracks-from-selection, as I had tried before. Then I pressed E to edit but it was still an arc (even though I told it to create a track):

Previously, I just undid this as I thought it didn’t work. This time I dragged it out for some reason, and there were two. The one that was underneath was indeed a track:

Crazy. I have spent way more time on this than I expected, but learned some more kicad tricks and quirks along the way.

BTW, I did note your idea about using offset in cad to create smaller dxf outlines. I was totally baffled in freecad as I needed to combine all the dxf segments together and did not find a way to do that. I am sure freecad is powerful and useful, and plan to dig into it at some later time, but it is certainly not an intuitive program for getting started. I am more familiar with solidworks (which also has a non-trivial learning curve) with an offset tool I have used before, but did not have access to it this weekend. Then I tried librecad, and was able to combine the segments and create an offset outline pretty easily. I never continued down this path, but it could probably lead to another solution.

thanks for your help @BlackCoffee

1 Like

the convert tools always leave both the old object and the newly created object. The old object remains selected, so if you don’t want it you can just do convert and then immediately hit delete, before selecting anything else.

2 Likes