← Back to team overview

kicad-developers team mailing list archive

Re: Kicad scripting progress :-)

 

Thank you too Wayne,

    It's nice to team up with you all :-)


  I have a little prototype of the footprint wizards, for which I should
finish the C++ integration part, I just finished testing the python part.

The parameters they receive are structured in Pages, parameters inside the
pages, that come with a default value. Every time someone
changes a value the BuildFootprint() method will be called with the new
parameters, and we can get the new module via "GetModule()" method.

A footprint wizard may look like:

------ fpc_footprint_wizard.py
--------------------------------------------------------------------

from pcbnew import FootprintWizardPlugin

class FPCFootprintWizard(pcbnew.FootprintWizard):
    def __init__(self):
        FootprintWizardPlugin.__init__(self)
        self.name = "FPC"
        self.description = "FPC Footprint Wizard"
        self.image=""
        self.parameters = {
             "Pads":
                {"pad_n":40,"pitch":0.5,"pad_width":0.25,"pad_height":1.6},
             "Shield":

{"shield_to_pad":1,"top_to_pad":2,"pad_width":2,"pad_height":3}
        }
    def BuildFootprint(self):
        self.module = None
------------------------------------------------------------------------------------------------------------------
# w = FPCFootprintWizard()
# w.Show()

for example we may install them system wide in the kicad directory, so they
are loaded at pcbnew start... or
at some user directory like ~/.kicad/plugins/

The parent "FootprintWizardPlugin" class takes care for registering our new
class into the C++ part, so we can
can list and use them later on some wx interface.



2012/5/2 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>

> On 5/2/2012 12:32 PM, Dick Hollenbeck wrote:
>
>> On 05/01/2012 04:35 PM, Miguel Angel Ajo Pelayo wrote:
>>
>>>
>>>
>>> 2012/5/1 Dick Hollenbeck<dick@xxxxxxxxxxx<**mailto:dick@xxxxxxxxxxx>>
>>>
>>>     On 05/01/2012 10:02 AM, Miguel Angel Ajo Pelayo wrote:
>>>     >  We can read and write libraries now with the latest extensions to
>>> PLUGIN that Dick&
>>>     >  Wayne did :)
>>>     >  now it always use legacy, but they will work with all formats. :-)
>>>     >
>>>     >  [...]
>>>
>>>
>>>     Only 7 lines of code which show how powerful the scripting support
>>> is becoming.
>>>
>>>     Thank you very much Miguel.  I look forward to playing with it, some
>>> day when I have
>>>     more
>>>     time.
>>>
>>>
>>> You're welcome Dick , I think we all are putting a lot of effort to make
>>> next KiCad's
>>> release something
>>> awesome.
>>>
>>> I'm using the new library functionality to make some nice little
>>> footprint wizard
>>> examples, and I'm thinking about
>>> how to build a simple architecture to let people "plug in" new footprint
>>> wizard scripts.
>>>
>>
>>
>> Miguel,
>>
>> Your enthusiasm for the project has become an important asset of the
>> project in and of
>> itself.  I personally appreciate all that you do.
>>
>>
>> With the introduction of some sensible "software interfaces" we are now
>> starting to see
>> some benefits.  The original idea for the BOARD plugin framework should
>> be credited to Tom
>> and Javier of CERN.  From that I was able to actually design something
>> workable.  As
>> simple as possible, but not simpler.
>>
>> Wayne has been faithful to that software API contract, and is in the
>> midst of writing one
>> of the most important classes ever contributed to KiCad.  We're calling
>> it PCB_IO.  This
>> class is a normal PLUGIN for our new native s-expression support in mm,
>> but has special
>> bells and whistles on it for clipboard text generation and parsing.  This
>> work is being
>> funded by CERN, so we owe them a special thanks.  (Some selling took
>> place to get this
>> funding, and I will claim some responsibility there.  Selling is not
>> foreign to me.)
>>
>>
>> On my todo list is an EAGLE plugin.  (My todo list is like a personal
>> wish list.  Wishes
>> only come true based on available time, energy and mood.)
>>
>>
>> Now imagine that you, Miguel, write a world class footprint wizard, or a
>> framework that
>> lets others do their little twist to it.  Maybe as you say, it is a
>> housing for any number
>> of footprint wizards, each with a particular specialization.  Then, with
>> this design in
>> place, imagine being able to generate eagle footprints or kicad
>> footprints, without any
>> change to your code, or to the code within the wizards.  It is not
>> inconceivable that
>> eagle users will come just to use the footprint wizards.
>>
>>
>> Another benefit of this PLUGIN API design, is that we are positioned to
>> climb to a
>> superset position in both BOARD and in MODULE.  This is because the API
>> is based on those
>> objects, and as we write additional plugins, it is not inconceivable that
>> we may chose to
>> add features to our core C++ objects in order to handle them some other
>> format.  This
>> means we are positioned to assimilate and extend as needed.
>>
>> So yes, there is a hell of a lot going on here.  And there are a lot of
>> people contributing.
>>
>
> It is really great to see so many people stepping up and making great
> contributions to KiCad.  Thank you all for you continued support.
>
> Wayne
>
>
>
>>
>> Dick
>>
>>
>>
>> ______________________________**_________________
>> Mailing list: https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
>> Post to     : kicad-developers@lists.**launchpad.net<kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
>> More help   : https://help.launchpad.net/**ListHelp<https://help.launchpad.net/ListHelp>
>>
>>
>
> ______________________________**_________________
> Mailing list: https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
> Post to     : kicad-developers@lists.**launchpad.net<kicad-developers@xxxxxxxxxxxxxxxxxxx>
> Unsubscribe : https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
> More help   : https://help.launchpad.net/**ListHelp<https://help.launchpad.net/ListHelp>
>



-- 

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo

Follow ups

References