Convert circular polygon to pad

Hi.
I just moved to Kicad nightly branch (5.99) and I must say that I’m VERY impressed. Thanks for the hard work to developers!
As part of my work I design RF PCBs. The design process is almost always:

  1. Design a PCB footprint with your favorite EM tool.
  2. Simulate.
  3. Import to PCB CAD tool exactly as simulated. (GDSII, DXF etc.)

I see that importing polygons to Kicad footprint editor is now extremely easy, which is great.
I can easily make a custom shaped pad from polygon by adding an anchor.

Is there a way to convert polygon circles into TH pads? I know that there is a workaround to do this via Freecad, and I utilized it before (with limited success for complex shapes).


My next best bet will be to write a python plugin/process the circles as vias offline but i’d rather avoid that.

Thanks in advance!

I do not understand.
What is so complicated about a circle that you would want DXF import or convert it to a pad?

Circular pads have been in KiCad for ages.
If you need a lot of them, and in specific relative positions, then a scripting approach could be useful.
Have you looked at the Footprint Wizards in KiCad?
They are pretty short Python scripts, about 3 or 3 pages and they take parameters to draw footprints with pads in various shapes and forms.
You can study them and use them as a base for your own scripts.

I’m hoping you were just using a circle as an example (because circular SMT pads have always been a thing). I think the easiest way to add a drill hole to a custom shaped pad is to add an additional THT pad, give it the same pin number as your custom shaped pad, and then place the THT pad where you want it within your custom shaped pad. Since this is all within a footprint, you shouldn’t have to worry about moving one in relation to the other unintentionally during layout. I don’t use 5.99 yet so there may be some new techniques there, but this suggestion works up to at least 5.1.x.

OK, I probably did not explain myself well enough, or I do not understand your suggestions. I’m quite familiar with Kicad (been around since Kicad 3). I’m using it with various workarounds for RF PCB design. Following my explanation about how the design flow works (see 1.-3. above) this is what I want to do:

  1. Here’s a typical 2-layer RF splitter design. The best practice is to start the design in a 2.5D EM simulator that allows to quickly evaluate performance. Specifically, this design was done in Keysight ADS. Note that “holes” are just a graphic layer. They can be exported as drills in a Gerber file but there is no stackup associated with the design

  2. Once the cell is done it needs to be embedded in a PCB CAD board design. For designs in the high-GHz range (28GHz-130GHz) hand drawing this again in the PCB CAD is completely unacceptable. An automated import is needed.

  3. I played with writing scripts for DXF-> Kicad footprint conversion for simple cases. Recently I’m using a workaround with Kicad 5.1 and Freecad’s Kicad plugin, with limited success for complext designs.

  4. Seeing the DXF import option in 5.99, it makes sense to import the RF cell graphics as outlines, and fill the traces/grouns planes. This leaves the via-holes, as you can see here:

  5. So the ultimate question is - is there a way internal to Kicad to convert those circular polygons that are the drill markings to actual TH pads? If not, writing a script that does so would not be hard (I estimate a vcouple hours of work) but I’ll be happy for advice before putting time unnecessarily

Hope it’s clearer now!
Cheers,
M

Your use case seems too specialized to expect a baked in solution in KiCad. (But I do not know all nooks & crannies in KiCad).

You seem to do this regularly, and therefore a scripting approach seems appropriate.

The simplest way is probably to write a script that takes your drill coordinates and insert via’s in the PCB at those coordinates.

You may already be aware of this collection of 60+ scripts and tools around KiCad:
https://github.com/xesscorp/kicad-3rd-party-tools.

Or:
https://html.duckduckgo.com/html?q=KiCad+"rf+tools"
I believe it can do via stitching around HF tracks, but it does not preserve your coordinates.

Another approach worth looking in to is the altium to KiCad converter. I know it’s being worked on, but I do not know it’s current state.

Hi,
you may have a look at Qucs-RFlayout

does your sw export dxf circles as polygons? is there an option to keep those as circles?

I was mistaken.
Writing the code actually took 30 minutes and not a couple of hours. It’s <20 lines of code:

path="E:\\vb_shared\\"
fname="my_fp.kicad_mod"
fp = open(path+fname, 'r')
fp_lines = fp.readlines()
fp.close()
fp_lines_new=[]
for i in range(0,len(fp_lines)):
    #read and identify if line is a circle
    line = fp_lines[i].split()
    if line[0]=="(fp_circle":
        fp_lines_new.append('  (pad "1" thru_hole circle (at '+line[2]+' '+line[3]+
                            ' (size 0.5 0.5) (drill 0.3) (layers *.Cu *.Mask) '+
                            line[13]+' '+line[14]+'\n')
    else:  fp_lines_new.append(fp_lines[i])

with open(path+'new_'+fname, 'w') as filehandle:
    for listitem in fp_lines_new:
        filehandle.write('%s' % listitem)
filehandle.close()

Can this be executed from within Kicad more easily? The only way I saw to run command line interface is PCBNew and not the footprint editor.

Cheers.

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