4.2. Templates
4.2. Templates
They facilitate the easy setup of projects which have common attributes such as pre-defined board outlines, connector positions, schematic elements, design rules, etc. .
4.2.1. Metadata
A template’s METADIR must contain the required files, and might optionally contain any of the optional files.
4.2.2. Required Files:
meta/info.html
Contains html formatted information about the template which is used by the user to determine if the template is what they are after. The <title> tag determines the actual name of the template that is exposed to the user for template selection.
Using html to format this document means that images can be in-lined without having to invent a new scheme.
Only a basic HTML language can be used to format this document.
4.2.3. Optional Files:
meta/icon.png
A 64 x 64 pixels PNG icon file which is used as a clickable icon in the template selection dialog.
4.2.4. Example:
Here is a template for a raspberrypi-gpio board:
And the meta data info:
brd.png is an optional file.
Here is an info.html file sample:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html;
charset=windows-1252">
<TITLE>Raspberry Pi - Expansion Board</TITLE>
<META NAME="GENERATOR" CONTENT="LibreOffice 3.6 (Windows)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGED" CONTENT="20121015;19015295">
</HEAD>
<BODY LANG="fr-FR" DIR="LTR">
<P>This project template is the basis of an expansion board for the
<A HREF="http://www.raspberrypi.org/" TARGET="blank">Raspberry Pi $25
ARM board.</A> <BR><BR>This base project includes a PCB edge defined
as the same size as the Raspberry-Pi PCB with the connectors placed
correctly to align the two boards. All IO present on the Raspberry-Pi
board is connected to the project through the 0.1" expansion
headers. <BR><BR>The board outline looks like the following:
</P>
<P><IMG SRC="brd.png" NAME="brd" ALIGN=BOTTOM WIDTH=680 HEIGHT=378
BORDER=0><BR><BR><BR><BR>
</P>
<P>(c)2012 Brian Sidebotham<BR>(c)2012 KiCad Developers</P>
</BODY>
</HTML>
4.2.5. Operation
The KiCad File menu New shows 2 option:
- New Project Create a blank project by just copying template/kicad.pro to the current folder.
- Project from Template Opens the template selection dialog. The template selection dialog has a list of icons, and a display window. A single click on a template’s icon on the top will load that template’s info.html metadata file and display it in the display window. A click on the OK button starts the new project creation. The template will be copied to the new project location (excluding METADIR as mentioned earlier) and any files that match the string replacement rules will be renamed to reflect the new project’s name.
After selection of a template:
4.2.6. Templates Location:
The list of available templates are gathered from the following sources:
- For system templates: <kicad bin dir>/../share/template/
For user templates:
- on Unix: ~/kicad/templates/
- on Windows: C:\Documents and Settings\username\My Documents\kicad\templates
- on Mac: ~/Documents/kicad/templates/
When the environment variable KICAD_PTEMPLATES is defined, there is a third page: Portable Templates, which lists templates found in KICAD_PTEMPLATES path.