kicad-developers team mailing list archive
Mailing list archive
Re: [PATCH] Append schematic: copy the contents of one schematic file into another
Le 23/01/2013 13:55, Jacobo Aragunde Pérez a écrit :
El 22/01/13 09:47, jp charras escribió:
Le 21/01/2013 10:46, Jacobo Aragunde Pérez a écrit :
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.
After your comments, I don't think a name change would work in this case
any more. I'll keep the same document name. I've added a warning to ask
the user to save the document before the append operation, so they can
always revert the changes.
About loops, I don't think it makes sense fixing it only for this
feature, it needs a solution that works for all the application. I guess
that the warning plus the save operation would be enough for now.
Yes, the warning plus the save operation is enough for now.
This is important for components and sheets (which are something like a
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.
If you consider this is important, I'll check how timestamps work in the
paste block operation. I guess that the goal is resetting the timestamps
for the imported components, isn't it?
because the time stamps is sometimes used as identifier and must be unique.
(However annotation checks for duplicate time stamps and fix them)
See the function void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) in
For each imported component, a new time stamp is set (and the annotation
The annotation also is cleared to avoid duplicate references, which also
(obviously) create issues.
This is needed mainly when importing a schematic inside a non void sheet.
If the import is allowed only inside a void sheet (it makes sense for me
to allow only this case),
there is not problem.
Duplicates between 2 sheets does not matter (in fact in complex
hierarchies, you have duplicates),
because the actual time stamp of a component inside a sheet is the sheet
time stamp + the component time stamp.
Also have a look to the code relative to a sheet filename change, for
simples and complex hierarchies (and the conversion between these
I'll also fix this problem using the full file path when there's a problem.
Using full file path creates also issues:
- when moving/copying a project (be sure schematic files in an other
directory will be lost)
- But mainly, it creates shared files, which will break one schematic
project when the other is edited
Copying files to the target project is the only one way to fix it,
and changing the filename of imported files (and the filename in sheets)
if an existing file is found in the target project directory,
or asking the user.