← Back to team overview

kicad-developers team mailing list archive

Re: Append schematic feature in Eeschema


Le 18/12/2012 10:14, Jacobo Aragunde Pérez a écrit :
El 15/12/12 20:28, jp charras escribió:
Le 14/12/2012 10:16, Jacobo Aragunde Pérez a écrit :
I have noticed there is a feature in Pcbnew, "Append board", to add all
the components from a .brd file into the currently opened document. This
feature doesn't exist in Eeschema but I thought it would be useful there

The attached patch adds this feature linked to a new entry in the "File"
What *exactly* do you mean by "Append schematic" to an other schematic.

Append a schematic to an other schematic has nothing to do with append a
board to an other board.
A board is described by only one file, a schematic by many files.

Yes, maybe the name I chose for the feature is not the best one ;) .

The feature could be called "import components from another sheet". It
opens another sheet file and loads its components into the currently
open sheet. It is roughly equivalent to opening both sheets, copying the
components from one of them and pasting into the other one.

I still have to think (a) what to do when the components in the other
sheet are not in the loaded libraries and (b) how this works with
hierarchical schematic projects.

To fix (a) I was asking about the relation between .sch files,
components and libraries. When I open a .sch file which uses components
that are not in my loaded libraries, how does eeschema know the
components definition?

Sorry for the delay.
sch files do not store component shapes and definitions. they are stored in libraries. When a component is not found in loaded libs, it is searched in the library cache of the project (-cache.lib).
Only the root sheet should be opened by Eeschema.
sub sheets are automatically loaded, but the lib cache has he same name as the root sheet. (if the project is <mywork.pro> the root sheet is mywork.sch and the lib cache is mywork-cache.pro)
If a component is not found, it cannot be drawn.

From my point of view, "append schematic" could be better replaced by a more powerful (and very similar for users) copy and paste function using the clipboard between 2 instances of eeschema. Currently copy and paste does not use the clipboard, and this is the reason one cannot copy schematic between instances of Eeschema (the copy function copy the internal data in binary form in a paste buffer). To use the cliboard the easier way is to save the selected items (which can be an entire sheet) in ascii form, using the save file code (see SaveEEFile) modified to write only selected components to the clipboard, and the read file code to retrieve the saved data from the clipboard.

This approach needs more work, but this is a really useful work, and such a feature is *really* powerful.
(This is also true for Pcbnew)
Keep in mind complex hierarchies are *very tricky*, and can have a reference to sheet files having the same name, but which can be different between projects, like power.sch for instance, so a feature like "append schematic" or copy between schematics is *not* easy to add if we avoid broken schematic projects.

Obviously, loaded libs should contain all components used in each project to copy (or append) a sheet to an other sheet.

Jean-Pierre CHARRAS
KiCad Developers team.
KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>

Follow ups