Yesterday I wrote a proposal for discussion here: http://pads.kicad-pcb.org/p/kicad-scripting-layer (please write your name for your color using the top right icon, so what you write can be identified to you).
I tried not to look too much into the original Piers proposal, to do a true top-down design (“how do I like to interact with kicad objects?”) In the end, it looks quite much like Piers proposal, just with the difference of Point/Size objects receiving the unit. I was trying to be as pythonic as possible avoiding set_/get_ methods, and instead rely on attributes and implicit setters/getters. The listed options are not exclusive, just different ways of doing the same. Please feel free to write about other use cases, or copy, paste, then modify my blocks to provide different possible interactions. Best, Miguel Ángel. Miguel Ángel Ajo On Thursday, 15 de January de 2015 at 01:32, LordBlick wrote: > In response to a message written on 07.01.2015, 19:29, from Adam Wolf: > > I dunno, LordBlick, it looks pretty Pythonic to me! > > > > Also, I do not think > > > > dict(map(lambda lname: lname, layers_tuple.index(lname), layers_tuple)) > > > > is clearer than using a dictionary called layer_dict :) > Auto-generated functions below are always up to date, layers names and number > in > KiCAD still evaluates, so we can not rely on ordinary static, an independent > dictionary. > > lsLayers = tuple([(idl, pcbnew.BOARD_GetStandardLayerName(idl)) for idl in > range(pcbnew.LAYER_ID_COUNT)]) > layerName2ID = lambda txtLayer: dict(map(reversed, lsLayers)).get(txtLayer) > layerID2Name = lambda layerID: dict(lsLayers).get(layerID) > > 3 lines concluding bilateral conversion vs. 24 lines of dictionary only… > Thank you for your attention! :) > > -- > Best Regards, > LordBlick > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > (mailto:[email protected]) > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp > >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

