← Back to team overview

kicad-developers team mailing list archive

Re: more pythonic scripting API for pcbnew

 

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))

--
Best Regards,
LordBlick


Follow ups

References