====== KiCAD 7.x for Team Configuration ====== ===== Using Git Server with KiCAD ===== * Each functional PCB is a repository and each revision is a folder ==== .gitignore file ==== **.gitignore** # Blacklist everything * # Whitelist all directories !*/ # Project files !*.kicad_pro # Schematic files !*.kicad_sch # PCB files !*.kicad_pcb # Project specific sym lib table !sym-lib-table # Project specific footprint lib table !fp-lib-table # Custom rules !*.kicad_dru # Schematic change list (user created) !SCH_Changelist.csv # PCB change list (user created) !PCB_Changelist.csv # Readme file !README.md # Ignor file !.gitignore **File types may not need to save** # For PCBs designed using KiCad: https://www.kicad.org/ # Format documentation: https://kicad.org/help/file-formats/ # Temporary files *.000 *.bak *.bck *.kicad_pcb-bak *.kicad_sch-bak *-backups *.kicad_prl *.sch-bak *~ _autosave-* *.tmp *-save.pro *-save.kicad_pcb fp-info-cache # Netlist files (exported from Eeschema) *.net # Autorouter files (exported from Pcbnew) *.dsn *.ses # Exported BOM files *.xml *.csv ===== Python Scripting ===== * https://kicad.mmccoo.com/ * https://www.youtube.com/watch?v=_zVJ96SdYrs&t=1496s * https://docs.kicad.org/doxygen-python-7.0/namespacepcbnew.html * https://docs.kicad.org/7.0/en/pcbnew/pcbnew.html * (GERBER) https://gist.github.com/aster94/bd52972ab6dbf13a44fc046b4222f7e7 * (GERBER) https://gist.github.com/spuder/4a76e42f058ef7b467d9 * https://dev-docs.kicad.org/en/python/pcbnew/ (how to write pcbnew plugin) ==== Hide 3D Models ==== https://gitea.isolo.org/cpan/KiCad_Plugins # import pcbnew; print(pcbnew.PLUGIN_DIRECTORIES_SEARCH) C:\Program Files\KiCad\7.0\share\kicad\scripting C:\Program Files\KiCad\7.0\share\kicad\scripting\plugins C:\Users\TomWang\AppData\Roaming\kicad\7.0\scripting C:\Users\TomWang\AppData\Roaming\kicad\7.0\scripting\plugins C:/Users/TomWang/Documents/KiCad/7.0/scripting C:/Users/TomWang/Documents/KiCad/7.0/scripting\plugins C:\Users\TomWang\Documents\KiCad\7.0\3rdparty\plugins from pcbnew import * board=GetBoard() c86=board.FindFootprintByReference('C86') d3=c86.Models() d3.clear() # this cleared all the 3D models - not what we want I did (in the Scripting Console) models = fp.Models() m = models[0] m.m_Show = False pcbnew.Refresh() ==== Custom Rules ==== (version 1) (rule "Distance between different packages" (constraint courtyard_clearance (min 10mm)) (condition "A.Type == 'Footprint' && B.Type == 'Footprint' && A.Library_link == '*R_0402*' && B.Library_link == '*L_1210*'")) ===== Library Database Setup ===== ==== Objectives ==== * Everyone uses the same library (symbol, footprint, 3D model) * Only admins and librarians are allowed to create or modify library * When a part is updated in the library, everyone gets the latest version automatically * Fully specified parts (atomic) * No duplications of symbols * Automatic BOM generation without manual adjustment * Extensible structure for new field to be added in the future ==== Folder Structure ==== * symbols - Holds generic schematic symbols in ".kicad_sym" files. Each file represents a category of parts. E.g. passives, ICs, diodes, magnetics, connectors, ... * footprints - Holds ".pretty" folders that hold footprint files (.kicad_mod files). Each ".pretty" folder represents a category of parts. * 3dmodels - Holds ".3dshapes" folders than hold 3d model files (.step and .wrl files). Each ".3dshapes" folder represents a category of parts. The folders shall resides on a centralized network server that is read only to most users. ==== MariaDB Database Structure ==== * create "kicad" database with utf8_general_ci collation * create table "resistors" with columns (VARCHAR type) "epn" (key), "symbol", "value", "pkg", "footprint", "datasheet", "mfg", "mpn", "descr", "status" * "status" can be "production", "development", "obsolete", "restricted" * "mfg" is manufacturer name * "epn" is a unique internal part number. it is the database key * "descr" is description ==== ODBC Connection ==== https://help.interfaceware.com/v6/connect-to-postgresql-from-windows-with-odbc **kicad_dbl file** { "meta": { "version": 0 }, "name": "EE Components", "description": "EE Components", "source": { "type": "odbc", "dsn": "KiCad_DB", "username": "", "password": "", "timeout_seconds": 2, "connection_string": "" }, "libraries": [ { "name": "Resistors", "table": "Resistors", "key": "EPN", "symbols": "Symbol", "footprints": "Footprint", "fields": [ { "column": "MPN", "name": "MPN", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Value", "name": "Value", "visible_on_add": true, "visible_in_chooser": true, "show_name": false }, { "column": "Pkg", "name": "Pkg", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "MFG", "name": "MFG", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Status", "name": "Status", "visible_on_add": false, "visible_in_chooser": true, "show_name": false } ], "properties": { "description": "Descr" } }, { "name": "Diodes", "table": "Diodes", "key": "EPN", "symbols": "Symbol", "footprints": "Footprint", "fields": [ { "column": "MPN", "name": "MPN", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Value", "name": "Value", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Pkg", "name": "Pkg", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "MFG", "name": "MFG", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Status", "name": "Status", "visible_on_add": false, "visible_in_chooser": true, "show_name": false } ], "properties": { "description": "Descr" } }, { "name": "Capacitors", "table": "Capacitors", "key": "EPN", "symbols": "Symbol", "footprints": "Footprint", "fields": [ { "column": "MPN", "name": "MPN", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Value", "name": "Value", "visible_on_add": true, "visible_in_chooser": true, "show_name": false }, { "column": "Pkg", "name": "Pkg", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "MFG", "name": "MFG", "visible_on_add": false, "visible_in_chooser": true, "show_name": false }, { "column": "Status", "name": "Status", "visible_on_add": false, "visible_in_chooser": true, "show_name": false } ], "properties": { "description": "Descr" } } ] } ===== Saving Configuration Files ===== https://docs.google.com/document/d/1Rq8i2Ay7qpGpffaj-AQmE-Xp88ikHhgyt0Ygpi8717o/edit#heading=h.osuronu74isn https://docs.kicad.org/7.0/en/kicad/kicad.html KICAD_CONFIG_HOME - If we consider how KiCad is started and how the path variables are defined, this is the most important of those variables. Namely, every other variable can be defined from within KiCad so that they are stored into KiCad's own configuration. But naturally you can't store the location of the configuration into the configuration. This is the only variable you absolutely must set from outside KiCad itself if you want to change it. Every other variable you can change through KiCad's Configure Paths dialog, provided that the variable hasn't already been set from outside KiCad as an actual system environment variable. The default location of configuration is at C:\Users\\AppData\Roaming\kicad\7.0 if KICAD_CONFIG_HOME is not set. The following three files are important: * kicad_common.json - it has a section that stores environment variables * fp-lib-table - global footprint library links. * sym-lib-table - global schematic symbol library links. One convenient way of saving configuration is to save the entire folder of C:\Users\\AppData\Roaming\kicad\7.0 (push to git). Then delete the folder. KiCad will give you an option to import configuration the next time it starts. Point to the saved folder to import all the configurations. Example configuration (version 7.0.5) - {{ :knowledge_base:professional:kicad_config.zip |}} === List of Environment Variables === ^Variable name^Explanation^ |KICAD_CONFIG_HOME|Directory for the KiCad configuration files.| |KICAD_SYMBOL_DIR|Used in the official symbol library's sym-lib-table to point to the directory where the symbol libraries are installed.| |KISYSMOD|Used in the official footprint library's fp-lib-table to point to the directory where the footprint libraries are installed.| |KISYS3DMOD|Used inside the official footprint library's footprint files to point to the directory where the 3D model libraries are installed.| |KIGITHUB|Not used anymore with official libraries. This was used when the official libraries were still loaded from github by KiCad (in version 4).| |KICAD_TEMPLATE_DIR|Directory for the KiCad's official project templates. See File -> New -> Project from Template in the project window.| |KICAD_USER_TEMPLATE_DIR|Directory for the user's own project templates. See File -> New -> Project from Template in the project window.| |KICAD_PTEMPLATES|Not recognized anymore. Use KICAD_TEMPLATE_DIR and KICAD_USER_TEMPLATE_DIR.| |KICAD_WKSFILE|Full path to the .kicad_wks file which has the page layout. See File -> Page Settings in Pcbnew and Eeschema.| |EDITOR|The text editor which KiCad may open. See the project window -> Browse -> Open Text Editor and Preferences -> Set Text Editor.| |XDG_CACHE_HOME|See XDG_RUNTIME_DIR below. See *NOTE below.| |XDG_CONFIG_HOME|Directory for the configuration files. Use KICAD_CONFIG_HOME instead, which also overrides this if set. This is recognized on all platforms. See *NOTE below.| |XDG_RUNTIME_DIR|Unix only (excluding OSX). Directory for the lockfile (used for the "kicad is already running" warning). If this is not set, XDG_CACHE_HOME is used. If that is not set, either, $HOME/.cache is used. On non-Unix systems the lockfile is saved to a system specific fixed location. See *NOTE below.| === Using Template to Save Board Settings === === GERBER out procedure === https://www.circuitstate.com/tutorials/how-to-get-your-kicad-pcb-design-ready-for-automated-assembly-kicad-6-tutorial/ https://www.pcbway.com/blog/help_center/How_to_Generate_Gerber_and_Drill_Files_in_KiCad_7_0_ab0d12bb.html ==== References ==== https://forum.kicad.info/t/project-and-libary-setup-for-sharing-and-collaboration-kicad-version-5/20842 https://capistranorb.com/documentation/overview/what-is-capistrano/ ==== Useful Git Options ==== **.gitignore** # Blacklist everything * # Whitelist all directories !*/ # Whitelist the file you're interested in. !*.cocci git clone -b mybranch --single-branch git://sub.domain.com/repo.git === How to git clone only a specific file or directory === Git does not directly support cloning only a specific file or directory from a repository. However, you can use --depth 1 to clone only one specific revision (as opposed to the entire history) and use --no-checkout followed by git sparse-checkout set to checkout not the entire file tree but only a specific file.