← Back to team overview

kicad-developers team mailing list archive

Re: Kicad scripting progress :-)

 

Oh, I forgot, if it's useful to anybody, this are the parameters I used for
building it:

mkdir -p build.scripting && cd build.scripting

cmake ../kicad.scripting -DKICAD_STABLE_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
\
       -DUSE_PCBNEW_SEXPR_FILE_FORMAT=ON -DUSE_PCBNEW_NANOMETRES=ON \
       -DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_MODULES=ON \
       -DCMAKE_INSTALL_PREFIX=/usr
make


2012/4/14 Miguel Angel Ajo Pelayo <miguelangel@xxxxxxx>

> Hi everybody, I merged the scripting branch with the latest development
> changes.
> Now it saves to the new kicad_pcb format, and also reads/writes legacy :-)
>
> Lajos, about the python2 thing, it seems that in my computer there wasn't
> any "python2",
> just "python" or "python2.7", so probably I'll have to make some script
> that discovers
> which python2 flavor is available and just us it, until then, "ln
> /usr/bin/python2.7 /usr/bin/python2"
> is recommended (python2.6 must work too)
>
>
>
>
> 2012/4/9 Miguel Angel Ajo Pelayo <miguelangel@xxxxxxx>
>
>>
>>
>>
>> 2012/4/9 lajos kamocsay <panka.nospam@xxxxxxxxx>
>>
>>> Miguel-
>>>
>>>
>>> This is truly awesome!
>>>
>>
>> It's the swig magic + some help ':D thanks a lot!
>>
>>>
>>> I finally got your repo to build with the attached patch (to revno
>>> 3467). Maybe these changes work for you, too?
>>>
>>
>> Niiice, thanks for the patch, I will apply it right now.
>>
>>>
>>>  - had to specify python2 in a handful of .py files and in pcbnew's
>>> cmakelist (I have both python2 and 3)
>>>
>>
>>  makes sense :-)
>>
>>  - added rt to the linker flags (is this because of testing build?)
>>>
>> About the rt, not sure why is it needed, I suppose it's some Python
>> dependency
>> on your computer. We must leave it added by now.
>>
>>  - moved up Python.h in dialog_scripting.cpp, as there were some
>>> define conflicts
>>>
>>
>>
>> I think that fixes some warnings on my side :-)
>>
>>
>>> Do you plan on upgrading to python3 at some point? I can help with
>>> that if you need an extra hand.
>>>
>>
>>
>> About Python3, I expect it not to be hard to do at some point. I choose
>> to stay 2.x
>> because wxPython still doesn't have 3.0 support. I think that at that
>> point we could
>> tune the sources to compile for Python3 and python2 as they want to do.
>>
>>
>>
>>>
>>> I haven't had a chance to look at the available functions yet, but I'm
>>> hoping that now I can change a bunch of pad and drill sizes on a board
>>> automatically ;)
>>>
>>> in pcbnew/scripting/examples you have a couple of them, still very basic,
>> but you can already open a board, iterate over modules/pads/items, and
>> modify them
>> and save the pcb back.
>>
>>
>>>
>>> Thanks-
>>> -lajos
>>>
>>> Thank you Lajos :-)
>>
>>>
>>>
>>> On Sat, Apr 7, 2012 at 1:44 PM, Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
>>> wrote:
>>> > On 4/7/2012 12:08 PM, Miguel Angel Ajo Pelayo wrote:
>>> >>
>>> >>     During the last two days I had some hours to spend on scripting
>>> >> again, I've been able
>>> >> to fix some memory management problems (objects added to a board or
>>> >> module get deleted
>>> >> by board/module object, but python tried to delete them too, now that
>>> >> condition is detected
>>> >> and avoided  - .thisown=0 in python during (board/module).Add(object)
>>> >> did the work-.
>>> >>
>>> >>     Now we have wxRect and wxSize wrappers, that were missing.
>>> >>
>>> >>
>>> >>     I find some important points that I must address (prioritized
>>> list):
>>> >>
>>> >>      a) May be working in the KICAD_PLUGIN part for component
>>> libraries,
>>> >> to move the librairi.cpp
>>> >> code into plugin system.  There's already some design about that?
>>>  [I'm
>>> >> writing a separate email about this]
>>> >>
>>> >>         This is very very interesting: we cleanup kicad's code (as
>>> it's
>>> >> planned), and would offer many
>>> >> benefits: ability to create footprint wizards, making automated
>>> >> component servers/libraries, etc...
>>> >>
>>> >>      b) I should start documenting somewhere how to work with
>>> scripting.
>>> >> Where's
>>> >> the right place? http://kicad.sourceforge.net/wiki/Main_Page ? , or
>>> may
>>> >> be other place?
>>> >
>>> > Miguel,
>>> >
>>> > If this document is only interesting to developers, it may make sense
>>> to
>>> > put is somewhere in the source repo in the Documentation folder.  If
>>> > this is something that end users may be interested then the appropriate
>>> > place would be the user documentation at
>>> > https://code.launchpad.net/~kicad-developers/kicad/doc.  This is where
>>> > the file format documentation currently lives.  Either way, the
>>> document
>>> > would be under version control which is a good thing.
>>> >
>>> > Wayne
>>> >
>>> >>
>>> >>
>>> >>       c) Hook points for scripting inside kicad UI:
>>> >>             c.1) Dynamic toolbar + hotkey assignment for registered
>>> plugins
>>> >>             c.2) Footprint wizards list, where plugins could be
>>> registered.
>>> >>             c.3) Contextual menu plugins (they could registered, and
>>> >> when you right click on some object, they check if they should
>>> >>                    offer their functionality in the list)
>>> >>             c.4) Scripted DRC plugins
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> 2012/3/20 Wayne Stambaugh <stambaughw@xxxxxxxxxxx
>>> >> <mailto:stambaughw@xxxxxxxxxxx>>
>>> >>
>>> >>     On 3/18/2012 8:24 PM, Wolfgang Spraul wrote:
>>> >>     >> But just like the command line argument patch that came in 2
>>> >>     >> months ago, there will be a better time to merge this all in.
>>> >>     >
>>> >>     > Quick note from the guy who wrote most of the command line
>>> patch:
>>> >>     > I saw the scripting patch and I agree with Dick that this is
>>> super
>>> >>     > important and great work! Well done scripting can probably
>>> replace
>>> >>     > the need for command line options.
>>> >>     >
>>> >>     > I will continue to maintain the command-line patches out-of-tree
>>> >>     > and uplevel 'every few months'. But scripting is definitely the
>>> >>     > better approach and I'm very happy to see it moving forward.
>>> >>     >
>>> >>     > It is in our shared interest to keep the KiCad codebase readable
>>> >>     > maintainable.
>>> >>
>>> >>     Wolfgang,
>>> >>
>>> >>     Thank you for being patient and understanding the importance of
>>> keeping
>>> >>     the code base readable and maintainable.  KiCad is a large
>>> project and
>>> >>     as it continues to grow, the importance of code maintenance
>>> cannot be
>>> >>     under estimated.  I wish I could commit more time to the project
>>> to
>>> >>     speed this process along.  For now, we'll have to make due.
>>> >>
>>> >>     Thanks,
>>> >>
>>> >>     Wayne
>>> >>
>>> >>     > Cheers,
>>> >>     > Wolfgang
>>> >>     >
>>> >>     > _______________________________________________
>>> >>     > Mailing list: https://launchpad.net/~kicad-developers
>>> >>     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> >>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>> >>     > Unsubscribe : https://launchpad.net/~kicad-developers
>>> >>     > More help   : https://help.launchpad.net/ListHelp
>>> >>     >
>>> >>
>>> >>     _______________________________________________
>>> >>     Mailing list: https://launchpad.net/~kicad-developers
>>> >>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> >>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>> >>     Unsubscribe : https://launchpad.net/~kicad-developers
>>> >>     More help   : https://help.launchpad.net/ListHelp
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >> Miguel Angel Ajo Pelayo
>>> >> http://www.nbee.es
>>> >> +34 636 52 25 69
>>> >> skype: ajoajoajo
>>> >
>>> > _______________________________________________
>>> > 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
>>>
>>
>>
>>
>> --
>>
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 636 52 25 69
>> skype: ajoajoajo
>>
>
>
>
> --
>
> Miguel Angel Ajo Pelayo
> http://www.nbee.es
> +34 636 52 25 69
> skype: ajoajoajo
>



-- 

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

Follow ups

References