Pcbnew chap11 JA
ModEdit - Managing Libraries
Overview of ModEdit
Pcbnew can simultaneously maintain several libraries. Thus, when a module is loaded, all libraries that appear in the library list are searched until the first instance of the module is found. In what follows, note that the active library is the library selected within the Module Editor (ModEdit), the program we be now described
ModEdit enables the creation and the editing of modules:
- Adding and removing pads.
- Changing pad properties (shape, layer) for individual pads or globally for all pads of a module.
- Editing graphic elements (lines, text).
- Editing information fields (value, reference, etc.).
- Editing the associated documentation (description, keywords).
ModEdit allows the maintenance of the active library as well by:
- Listing the modules in the active library.
- Deletion of a module from the active library.
- Saving a module to the active library.
- Saving all of the modules contained by a printed circuit.
It is also possible to create new libraries. A library is in fact made up of two files:
- The library itself (file extension .lib).
- The associated documentation (file extension .dcm).
The documentation file is systematically regenerated after the modification of the corresponding .lib file. In this way the file can easily be recovered if lost. The documentation is used to accelerate the access to the module documentation.
ModEdit
The Module Editor can be accessed in two different ways:
- Directly, via the icon in the main toolbar of Pcbnew.
- In the edit dialog for [[Image:]]the active module (see figure below: accessed via the context menu), there is the button Module Editor.[[Image:]]In this case, the active module of the board will be loaded automatically in ModEdit, enabling immediate editing or archiving.
ModEdit user interface
By calling ModEdit the following window will appear.
Top toolbar in Modedit
From this toolbar, the following functions are available:
[[Image:]] | Select the active library. |
[[Image:]] | Save the current module to the active library, and write it on disk. |
[[Image:]] | Create a new library and save the current module in it. |
[[Image:]] | Access a dialog for deleting a module from the active library. |
[[Image:]] | Create a new module. |
[[Image:]] | Load a module from the active library. |
[[Image:]] | Load (import) a module from the printed circuit board. |
[[Image:]] | Export the current module to the printed circuit board. when the module was previously imported from the current board.
It will replace the corresponding module on the board (i.e., respecting position and orientation). |
[[Image:]] | Export the current module to the printed circuit board, whenIf the module was loaded from a library.
It will be copied on to the printed circuit board at position 0. |
[[Image:]] | Import a module from a file created by the Export command ([[Image:]]). |
[[Image:]] | Export a module. This command is essentially identical to that for creating a library, the only difference being that [[Image:]] creates a library in the user directory, while [[Image:]] creates a library in the standard library directory (usually kicad/modules). |
[[Image:]] | Undo - Redo |
[[Image:]] | Calls the module properties dialog. |
[[Image:]] | Call the print dialog. |
[[Image:]] | Standard zoom commands. |
[[Image:]] | Call the pad editor. |
[[Image:]] | Not used. |
Creating a new module
The button [[Image:]] allows the creation of a new module. You will be asked for the name by which the module will be identified in the library. This text also serves as the module reference, which will be replaced by the final reference on the printed circuit board (U1, IC3, etc.)
It will be necessary to add the following to the new module:
- Outlines (and possibly text).
- The pads.
- A value (place-holding text that will subsequently be replaced by the true value).
When a new module is similar to an existing module in a library or board, this alternative and often quicker method should be used:
- Load the similar module via the buttons [[Image:]], [[Image:]] and [[Image:]].
- Modify the reference field to the name of the new module.
- Edit and save the new module.
Creating a new library
The creation of a new library is done via the button [[Image:]], in this case the file is created by default in the library directory or via the button [[Image:]], in which case the file is created by default in your working directory.
A file-choosing dialog allows the name of the library to be specified and its directory to be changed. In both cases, the library will contain the module being edited.
WARNING
If an old library of the same name exists, it will be overwritten without warning.
Saving a module in the active library
The action of saving a module (thereby modifying the file of the active library) is performed using this button [[Image:]]. If a module of the same name already exists, it will be replaced. Since you will depend upon the accuracy of the library modules, it is worth double-checking the module before saving.
It is recommended to edit either the reference or value field text to the name of the module as identified in the library.
Transferring a module from one library to another
Select the source library via the button [[Image:]].
Load the module via the button [[Image:]].
Select the destination library via the button [[Image:]].
Save the module via the button [[Image:]].
You may also wish to delete the source module. Reselect the source library then delete the old module via the button [[Image:]] and the button [[Image:]].
Saving all modules of your board in the active library
It is possible to copy all of the modules of a given board design to the active library. These modules will keep their current library names.
This command has two uses.
- To create an archive or complete a library with the modules from a board, in the event of the loss of a library.
- More importantly, it facilitates library maintenance by enabling the production of documentation for the library, as below.
Documentation for library modules
It is strongly recommended to document the modules you create, in order to enable rapid and error-free searching.
For example, who is able to remember all of the multiple pin-out variants of a TO92 package? The Module Properties dialog offers a simple solution to this problem.
This dialog accepts:
- A one-line comment/description.
- Multiple keywords.
The description is displayed with the component list in Cvpcb and, in Pcbnew, it is used in the module selection dialogs.
The keywords enable searches to be restricted to those modules corresponding to particular keywords.
When directly loading a module (the icon [[Image:]] of the right-hand Pcbnew toolbar), keywords may be entered in the dialog box. Thus, entering the text "=CONN" will cause the display of the list of modules whose keyword lists contain the word CONN.
Documenting libraries ? recommended practice
It is recommended to create libraries indirectly, by creating one or more auxiliary circuit boards that constitute the source of (part of) the library, as follows:
- Create a circuit board in A4 format, in order to be able to print easily to scale (scale = 1).
- Create the modules that the library will contain on this circuit board.
The library itself will be created with the File/Archive footprints/Create footprint archive command.[[Image:]]
The "true source" of the library will thus be the auxiliary circuit board, and it is on this circuit that any subsequent alterations of modules will be made. Naturally, several circuit boards can be saved in the same library.
It is generally a good idea to make different libraries for different kinds of components (connectors, discretes,...), since Pcbnew is able to search many libraries when loading modules.
Here is an example of such a library source:
This technique has several advantages:
- The circuit can be printed to scale and serve as documentation for the library with no further effort.
- Future changes of Pcbnew may require regeneration of the libraries, something that can be done very quickly if circuit-board sources of this type have been used. This is important, because the circuit board file formats are guaranteed to remain compatible during future development, but this is not the case for the library file format.