Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
knowledge_base:professional:kicad [2023/06/16 17:21] – [Python Scripting] Normal User | knowledge_base:professional:kicad [2023/08/01 09:45] (current) – [Python Scripting] Normal User | ||
---|---|---|---|
Line 6: | Line 6: | ||
==== .gitignore file ==== | ==== .gitignore file ==== | ||
+ | |||
+ | **.gitignore** | ||
< | < | ||
Line 23: | Line 25: | ||
!*.kicad_pcb | !*.kicad_pcb | ||
- | # Sym lib table | + | # Project specific sym lib table |
!sym-lib-table | !sym-lib-table | ||
- | # Footprint | + | # Project specific footprint |
!fp-lib-table | !fp-lib-table | ||
Line 32: | Line 34: | ||
!*.kicad_dru | !*.kicad_dru | ||
- | # Schematic change list | + | # Schematic change list (user created) |
!SCH_Changelist.csv | !SCH_Changelist.csv | ||
- | # PCB change list | + | # PCB change list (user created) |
!PCB_Changelist.csv | !PCB_Changelist.csv | ||
Line 45: | Line 47: | ||
</ | </ | ||
- | ==== Python Scripting ==== | + | **File types may not need to save** |
+ | |||
+ | < | ||
+ | # For PCBs designed using KiCad: https:// | ||
+ | # Format documentation: | ||
+ | |||
+ | # 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:// | * https:// | ||
Line 51: | Line 87: | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * (GERBER) https:// | ||
+ | * (GERBER) https:// | ||
+ | * https:// | ||
- | === Hide 3D Models === | + | ==== Hide 3D Models ==== |
+ | |||
+ | https:// | ||
+ | |||
+ | < | ||
+ | # 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: | ||
+ | C: | ||
+ | C:/ | ||
+ | C:/ | ||
+ | C: | ||
+ | </ | ||
< | < | ||
Line 61: | Line 114: | ||
d3.clear() # this cleared all the 3D models - not what we want | 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 " | ||
+ | (constraint courtyard_clearance (min 10mm)) | ||
+ | (condition " | ||
+ | </ | ||
===== Library Database Setup ===== | ===== Library Database Setup ===== | ||
Line 256: | Line 326: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Saving Configuration Files ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | 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' | ||
+ | |||
+ | The default location of configuration is at C: | ||
+ | * 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: | ||
+ | |||
+ | Example configuration (version 7.0.5) - {{ : | ||
+ | |||
+ | === 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' | ||
+ | |KISYSMOD|Used in the official footprint library' | ||
+ | |KISYS3DMOD|Used inside the official footprint library' | ||
+ | |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' | ||
+ | |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" | ||
+ | |||
+ | === Using Template to Save Board Settings === | ||
+ | |||
+ | |||
+ | === GERBER out procedure === | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
==== References ==== | ==== References ==== | ||