Skip to content
HendriXML edited this page Mar 24, 2022 · 24 revisions

Setup

Files in the repository

Mandatory

  • Interpreter (tool to run the scripts):
    • \Interpreter\XMLScriptInterpreter.exe
  • Main script (needed to create a BOM report and gives the possibility to enhance PartKeepr data):
    • \Script.Project\Generate BOM.xml
  • Libraries (required libraries that contain most of the functionality):
    • \Script.Common.Electronics\
  • Schema component mappings (needed to map symbols to componentkinds):
    • \Resources.Project.ComponentMappings\

Optional

  • Batch file (easy way to startup the below BOM file):
    • \Run ESeries.cmd
  • E-Series BOM (a generated BOM, with e-series of resistors, capacitors and zenerdiodes):
    • \Resources.Project\ESeriesBOM.xml
  • Generate ESerie BOM (a script that generated the above BOM file with E-Serie values):
    • \Script.Project\Generate ESerie BOM.xml
  • XML Schema's (handy when editing xml-files, if you keep the directory structure intact they will be found and used when your xml-editor supports them):
    • \XmlSchemas.Common.XmlScript\
    • \XmlSchemas.Common.CodeGen\
    • \XmlSchemas.Common.KiCadBOMReporter\

Database connection configuration

Install a ODBC/OleDB Provider, for my database server I needed a driver from this location: https://downloads.mariadb.org/connector-odbc/

And setup a ODBC link using the installed ODBC provider to your MariaDB/MySQL database, best name it: PartKeepr like this:

XmlScriptInterpreter

By following these steps:

XmlScriptInterpreter

XmlScriptInterpreter

XmlScriptInterpreter

XmlScriptInterpreter

XmlScriptInterpreter

XmlScriptInterpreter

XmlScriptInterpreter

Alternative ways of connecting are possible, only a valid connectionstring needs to be provided. The main script has a inifile section for it.

Configuration in PartKeepr

The scripts shows in one of the report tabs what parts specifications are read. These specifications can be enhanced by:

  • Adding inifile sections to the description of the category
  • Adding part parameters (text or nominal value)

I will show how to make categories, which can be used to test with a E-Series BOM file. The end result looks like this: PartKeeprResistorsReport

Some categories have a functional ini-file like description, which are below:

PartKeeprCategoryElco

PartKeeprCategoryCeramic

PartKeeprCategoryZenerdiode

PartKeeprCategoryResistors [Resistor] should be the first line in the description.

Checking the E-series BOM

Execute "Run ESeries.cmd"

Startup from KiCad 5.0

KiCad expects a console application, so we start it via cmd.exe:

cmd /c start "XMLScriptInterpreter" "{your path}\XMLScriptInterpreter.exe" "{your path}\Generate BOM.xml" /var BomFilename "%I" /var ProjectDirectory "%O" /Execute

Kicad will keep waiting for the application to close, I did not find this very useful, so luckily there’s another way of launching the app via powershell.exe:

powershell.exe -command Start-Process -FilePath "{your path}\XMLScriptInterpreter.exe" -Argument '\"{your path}\Generate BOM.xml\" /var BomFilename \"%I\" /var ProjectDirectory \"%O\" /Execute'