← Back to team overview

kicad-developers team mailing list archive

Re: Python LAYER_PAIR parameter for EXCELLON_WRITER().BuildHolesList()

 

Le 12/01/2017 à 16:51, Martin Schreiber a écrit :
> On Thursday 12 January 2017 12:37:37 jp charras wrote:
>>
>> It could be worth to explain us what exactly are you trying to do.
> 
> MSEkicadBOM is a tool in order to combine KiCad with a component database and 
> to automate document and production file generation. MSEkicadBOM scans the 
> KiCad schematic files and matches the found components with the Firebird 
> component database and looks up the associated footprint in the database, see
> http://mseide-msegui.sourceforge.net/pics/msekicadbom.png
> http://mseide-msegui.sourceforge.net/pics/kicad_component.png
> 
> 'Reporting'-'Component-Footprintlist' creates a *.cmp list which can be 
> imported into schematic.
> 
> Document and production file generation uses infos defined in setup dialogs 
> which can use macros, the data is stored in project files and project 
> templates. See for example
> http://mseide-msegui.sourceforge.net/pics/kicad_globalsettings.png
> http://mseide-msegui.sourceforge.net/pics/kicad_globalsettings1.png
> http://mseide-msegui.sourceforge.net/pics/kicad_projectsettings.png
> 
> All is under construction!
> 
>> FILE is a basic C struct.
>> These methods are helper methods to create files, but are called by a
>> higher lever method.
>>
> That means that not all functions in pcbnew.py can be used because of missing 
> proxy classes?
> 
>> If you are trying to create a EXCELLON drill file (exactly a set of files),
>> have a look into the demo: gen_gerber_and_drill_files_board.py
> 
> Maybe it is possible to abuse the higher level functions in order to produce 
> the needed low level results, I prefer to use low level functions directly. 
> At the end it means less hassle.
> It seems it already has been talked about:
> https://lists.launchpad.net/kicad-developers/msg10233.html
> 
> Thanks, Martin

My question was more why do you want to use an helper internal method (which needs the
initialization of many parameters, made by a top level method), rather than the method which
generates the drill files as used in the demo gen_gerber_and_drill_files_board.py.

They are also subject to change: for instance LAYER_PAIR does not exist now, due to a collision
between 2 structs having the same name defined in Kicad code.
And this layer pair parameter for EXCELLON_WRITER().BuildHolesList() is not so easy to calculate for
boards with blind/buried vias.

pcbnew.py is automatically generated by Swig from C++ kicad sources.
It means many methods in pcbnew.py are not necessary easy to use or not necessary useful.

Besides, if you want to work on a tool which needs mainly a list of schematic components and their
fields, I encourage you to use the netlist (.net or .xml files) as entry point, not the schematic files.

Parsing the schematic files is usually tricky, and is justified only to access info not in netlist.
Especially for complex hierarchies.
And of course, the code will be outdated when the schematic file format is changed.

(See <kicad_sources>/script/bom-in-python examples)

-- 
Jean-Pierre CHARRAS


Follow ups

References