← Back to team overview

kicad-developers team mailing list archive

Re: more pythonic scripting API for pcbnew

 


Miguel Ángel Ajo


On Friday, 16 de January de 2015 at 20:01, LordBlick wrote:

> In response to a message written on 16.01.2015, 18:43, from Miguel Ángel Ajo:
> > About using mm as the default unit, other people may disagree, we should provide
> > facilities to let people specify their unit.
> >  
>  
> wxPoint and wxSize can be subclassed to allow any arithmetical operation and  
> unit conversion with propietary methods.
> > > As Jean-Pierre Charras wrote in thread nearly, board names for cooper layers may
> > > vary:
> > > brd = pcbnew
> > > pcb = brd.GetBoard()
> > > > > > pcb.SetLayerName(0, 'Top')
> > > > >  
> > > >  
> > >  
> > > True
> > > > > > pcb.SetLayerName(31, 'Bottom')
> > > > >  
> > > >  
> > >  
> > > True
> > > > > > pcb.SetLayerName(32, 'BottomGlue')
> > > > >  
> > > >  
> > >  
> > > False
> > > > > >  
> > > > >  
> > > >  
> > >  
> > >  
> >  
> >  
> > Hmm, that’s an important point for not referencing layers by names dynamically,
> > (I was proposing that too)
> >  
> > may be we should be defining a set of 32 constants for the layers we can reference
> > and keep up to date with any ID changes at the C++ side. Although I suppose ID’s
> > are not
> > going to change for compatibility reasons.
> >  
>  
> Seems to be unessary creating independent data. Simply:
> lsLayers = tuple([(idl, brd.BOARD_GetStandardLayerName(idl)) for idl in  
> range(brd.LAYER_ID_COUNT)])
> lsCuLayers = tuple(filter(lambda idl, layerName: layerName.endswith('.Cu'),  
> lsLayers))
>  
Yes, you already told me, but wasn’t the point against using provided names
that they could eventualy change?.

This is why I was suggesting constants. It’s not an awful work ;) but I understand you may
not want to do it ;)  

  
> --  
> Best Regards,
> LordBlick
>  
> _______________________________________________
> 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
>  
>  
>  



Follow ups

References