Yet another Python teardrop script. Adds and deletes teardrops to a PCB. V0.3.3

Hi all,

I am aware of elphel’s teardrops patch but I cannot see it coming in the devel mailing list.
Since I’m not a C++ dev, I have modified svofski’s python script in order to make it fit my needs.

The script is here and implements teardrops using zones. This allows the DRC rules to be respected (you only need to rebuild all zones). It also keep track of generated teardrops in a file in order to delete them afterwards.
The SetTeardrops method takes 2 parameters: hpercent and vpercent. These parameters follow the Altium way as defined here (for via to track only): http://techdocs.altium.com/sites/default/files/wiki_attachments/235632/TeardropsDlg.png

The script works. Except for two points (which I suspect to be related):

  • a board file is corrupted and cannot be re-opened after teardrops application

  • the OpenGL (as well as Cairo) mode shows some artefacts in the teardrop zone. The default mode does not show any problem. Gerber neither.

Does anyone know how to solve this or can give me some pointers ?
Thanks in advance,

Niluje

1 Like

Hi,
it seems to me that is a bug in saving filled_polygon zones or in the python API function …
if you open with a text editor the .kicad_pcb board and add a

) 

just before any occurrence of

     (filled_polygon

of your teardrops zones and you save the file
then you can open the board in pcbnew …

nice script though :smiley:
(I tested it with the latest dev branch… which kicad version are you testing with?)

Thanks a lot for your answer.

I will add a method in script to fix the saved file.

I am using :
Application: kicad
Version: 4.0.2+e4-6225~38~ubuntu14.04.1-stable release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.4,wx containers,compatible with 2.8)
Platform: Linux 3.13.0-91-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
_ USE_WX_GRAPHICS_CONTEXT=OFF_
_ USE_WX_OVERLAY=OFF_
_ KICAD_SCRIPTING=ON_
_ KICAD_SCRIPTING_MODULES=ON_
_ KICAD_SCRIPTING_WXPYTHON=ON_
_ USE_FP_LIB_TABLE=HARD_CODED_ON_
_ BUILD_GITHUB_PLUGIN=ON_

you could also add a function to add teardrops only on selected vias (selection is available in GAL mode)

.IsSelected()

ps please post the updated script :smiley:

Teardrops are a great idea, but I’ve found arc geometry teardrops give the best results, for clearance to nearby PADS, and allowing larger teardrops.
Not sure if you can support ARC as an option ?

its an issue for the manufacturer

if they feels it necessary they ask for permission to add it.

post-processing carried out at fab, as is balance patterns etc

IMHO

I am actually working on it right now. It is a bit complex but I think I will be able to get something quite quickly.

This is clearly possible. The only drawback is that it will generate complex zones for each teardrop. Nevertheless, can you (or anyone) give some references about the arc radius ? I am not able to find anything.

For sure, that’s why I want it !

have a look here …


and this is a function for annular checking

[quote=“Niluje, post:7, topic:3388”]
This is clearly possible. The only drawback is that it will generate complex zones for each teardrop. Nevertheless, can you (or anyone) give some references about the arc radius ? I am not able to find anything. [/quote]
This is how PADS layout sets ARC teardrops.
I think that ratio is a % of PAD diameter, and the teardrop polyline can match the trace width
You can see how much closer other pads/vias/corners can be placed, with curved teardrops.
It does not need a lot of segments to approximate the arc, maybe 5 or 7 a side ?

I wonder if KiCad scripts can trawl the DRC error reports/tags, as then a 2 pass could be possible, where offending teardrops are removed or adjusted.

PADS can also generate teardrops on angled entry into oval pads.
There are no teardrops on trace T junctions, they apply to “last-segment intersecting pad-outline”

I think there is arc support for tracks coming. Someone who does RF circuitry has got code working that does arc tracks… but I have no idea about how far away that is from implementation into the official branch.
@cbernardo, @keruseykaryu, @madworm or @caer will probably know more about the status - if there is any.

That’s the relevant thread:

Interesting, but that’s a ways-off, and a simple polyline segmented ARC approx will work now.
If course if full ARC entity support arrives, it will be easy to add.
Meanwhile, best to keep entities DRC and Shove understand,

Note that other CAD pgms have only modest ARC support, - for example, shove with ARC preserve is missing in Mentor.

Edit: I see road map info here, about DRC/ARC and complex Pad shapes

http://ci.kicad.org/job/kicad-doxygen/ws/Documentation/doxygen/html/v5_road_map.html

Hi @Niluje
any news from your side about the script?
thank you
Maurice

Hi @maui,

I have implemented all the requested features: (but the curved teardrops (but I am planning to code it soon)):

  • add teardrops only on selected via/pads if some are selected
  • add a method to fix the missing polygon parenthesis (this actually also solves the artefacts issue in GAL mode)
  • improve performances
  • Fixed some bugs in teardrops file

I only have to make it readable and clear before releasing it. This might be done by the end of the week.

It took me much more time than I initially though because I became father ten days ago which did not let me much brain time available.

I am now struggling with github to import my personal ssh-only hosted git repos. This will be much more efficient to share it here.

1 Like

Hi @Niluje
CONGRATS!!! I can understand your happiness and brain storm!!!
I became father 2 years ago and I’m still feeling like that :smiley:

Maurice

1 Like

@maui: Thank you very much! This is all new to me and I really enjoy it!

I managed to get the script done this evening. I created a github account for the occasion: https://github.com/NilujePerchut/kicad_scripts/tree/master and uploaded the script on it.

The readme gives some explanations about how to use the script.

I hope this will can be useful (and not too much buggy).
Thank for all the advices on this thread.

Next step: curved teardrops.

Sounds cool, looking forward to curved teardrops !

If the corrupted file error is solved, you could edit the thread title - maybe add a version number there ?
I expect this to be generally useful, and referred to often.

I have edited it to something more sensible

Congrats Maurice on the baby

1 Like

Thanks for the modification, this looks better now.

As suggested by @PCB_Wiz, I also added the current revision and will keep it synced with the github version.

Curved teardrops are now available.
The script is still available on my github page:

The script behaviour is identical to the previous version (0.2.0).
Curved style is used by default. The number of segments per curved is controlled by the parameter “segs” of the setTearDrops function (default is 10).
If segs is set to 2, straight lines are used.

I hope this will help.

Notice: I am not very good in geometry and the only solution I found is to use a bezier curve in order to keep the teardrop tangent to the track and the via. It works but it is quite expensive in processing time. If someone has a better method, please let me know.

The script version is now 0.3.0 (the thread title is now modified)

4 Likes

HI
thankyou for your help, I get one error:
File “C:\Program Files\KiCad\lib\python2.7\site-packages\pcbnew.py”, line 31, in
import _pcbnew
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

Win10 64bit
python2.7.4 64bit