← Back to team overview

kicad-developers team mailing list archive

Re: How to read custom pad polygon data in swig?

 

Ah, that is clever.
But I already exposed classes needed to do it in swig
https://github.com/KiCad/kicad-source-mirror/commit/72fcf46430286d62739eacab67bf964ba1ae8d88

On Mon, Aug 27, 2018 at 11:38 PM mitjan696-ubuntu@xxxxxxxxxxx <
mitjan696-ubuntu@xxxxxxxxxxx> wrote:

> I don't know if this is exactly what you are looking for, but you should
> take a look at how Miles Mccoo clones zones in his python script
>
>
> https://github.com/mmccoo/kicad_mmccoo/blob/master/replicatelayout/replicatelayout.py
>
> lines 215-224 and 15-20
>
> Regards, Mitja
>
>
> On Monday, 27 August 2018, 13:43:26 CEST, Andrew Lutsenko <
> anlutsenko@xxxxxxxxx> wrote:
>
>
> Hello Kicad team,
>
> I'm writing a pcbnew action plugin that needs to read footprint pad
> coordinates and shape.
> I had no trouble figuring out all shapes except for custom one. It is
> represented by SHAPE_POLY_SET which has a corresponding python type but to
> get actual vertex coordinates you have to either call one of Iterate()
> variants or get polygon outlines with Outline(). They both return objects
> (ITERATOR and SHAPE_LINE_CHAIN) that are pointers and have no useful
> attributes. As far as I understand they just don't have corresponding swig
> bindings so they are not exposed properly in python.
>
> Am I missing some obvious way to read custom pad polygon data in python?
>
> If not, what would it take to add that?
>
> I don't understand much about how swig configuration works but cursory
> glance at Kicad source suggests that there needs to be an import for
> shape_line_chain.h in common/swig/kicad.i
>
> If you are curious about what the plugin does, here are some of it's
> results, generated from Kicad demos:
> http://plugindemo.bitballoon.com/1/
> http://plugindemo.bitballoon.com/2/ <-- this one has a solder bridge with
> custom shape pads which is not rendered
> http://plugindemo.bitballoon.com/3/
>
> Above links are short lived.
>
> Regards,
> Andrew
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to    : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help  : https://help.launchpad.net/ListHelp
>

References