← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Append schematic: copy the contents of one schematic file into another


Le 21/01/2013 10:46, Jacobo Aragunde Pérez a écrit :
El 19/01/13 17:23, jp charras escribió:
Le 16/01/2013 12:18, Jacobo Aragunde Pérez a écrit :

Make me know your opinion about the feature or any comments you have on
the patch.

Thanks for reviewing :)

After a first trial, I am thinking the user should be warned about some
issues, due to the fact this import cannot be undone:
1 - before adding a schematic inside a non void sheet (the import will
put new components and wire over the existing components) .
I've checked the approach used in Pcbnew. After an import, the current
document name changes, so it doesn't overwrite the existing one unless
you specifically want to.

I think I will mimic this behaviour for two reasons: coherence inside
the application and protection against what you mention above.

I am thinking "the current document name changes" means the imported sheet, of one of the imported sub sheet file name:
But a schematic is not a board.
A board is only one file, a schematic project is a set of files.
Changing imported filenames to avoid collision could be needed, but be careful about these points: If this is the root sheet, changing the root sheet name is like create a new project: you should also create a .pro project. If this is inside a hierarchy, changing the filename of a sheet can seriously change the hierarchy. (mainly in complex hierarchies because the same file is shared by many sheets). Append twice (or more) the same sheet (with the same filename) creates also complex hierarchies. Append twice the same sheet and changing the name (different filenames for each sheet) creates simple hierarchy. Therefore (like in paste block) time stamps of new items should be checked and updated (and perhaps the references). I am thinking a lot of users will use such a feature to create multiple instances of a basic sheet, as an alternative to paste block,
so be careful about multiple imports of the same sheet.
Also have a look to the code relative to a sheet filename change, for simples and complex hierarchies (and the conversion between these hierarchies)

I am thinking most of possible issues will be relative to hierarchies and perhaps duplicate time stamps (time stamps should be an unique identifier at least inside a given sheet, but this is a good practice to have unique identifiers inside the whole project) They are used to identify a component when the reference cannot be used (after full re-annotation for instance by Pcbnew) and to identify sheets, because the sheet name can be modified by the user, and is not a reliable identifier)

2 - because it can change the hierarchy ( if the imported scheet has
subsheets with filenames already existing in the hierarchy).
   (see for instance warning messages when modifying the filename of a
sub-sheet, especially in a complex hierarchy).

I also noticed the import does not import the subsheets inside the
imported sheet, if the corresponding schematic files are not in the
working directory.
Pay attention to hierarchies in Eeschema,  especially complex
hierarchies: they can create very tricky problems,
and an import can create complex hierarchies.

Also, keep in mind Eeschema is not protected against infinite loops in a
hierarchy (i.e. inserting in a subsheet iside a given sheet the sheet
itself, which is easy when importing a schematic.).

I'll review the behaviour regarding subsheets and test it more deeply.

Best regards,

Jean-Pierre CHARRAS

Follow ups