Wishlist: Schematic copy paste offers options on how to deal with existing annotation

Bug #1837002 reported by Rene Poeschl
90
This bug affects 15 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Wishlist
Jeff Young

Bug Description

Right now copy paste always resets the annotation. This is ok if one intents to duplicate a section of the schematic. If one wants to move a part of the schematic from one sheet to another then this is not really helpful.

How about a feature similar to how word processors handle copying of text. They ask if one wants to keep the original formatting, copy text only, ... (With a small unintrusive toolbar right next to the mouse at paste, but it can even be a small popup window in the beginning.)

Tags: eeschema
Revision history for this message
eelik (eelik) wrote :

Some programs have "Paste Special", like LibreOffice Writer.

BTW, the original discussion in the forum mentioned moving portions of schematic between sheets, not copying them. Problematically Cut+Paste is a bit different here than Copy+Paste. In the former case there are no duplicate references existing in the schematic, so there's no need to clear the annotation.

I would go with Paste Special because it would work for all cases and it's easy to add other possible options in the future, and there's no need to touch the existing Paste functionality in the code or in the UI.

tags: added: eeschema
Revision history for this message
Rene Poeschl (poeschlr) wrote :
Jeff Young (jeyjey)
Changed in kicad:
importance: Undecided → Wishlist
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Given that most KiCad users seem to revile nagware, I would prefer that this be handled with a "Paste Special" main menu and/or context menu entry rather than a dialog that pops up before every paste operation.

Changed in kicad:
status: New → Triaged
Revision history for this message
David Bridgham (dab-1) wrote :

Another way I can see of getting the functionality is to add a context menu entry to blocks that says 'move block to sheet' which brings up a pop-up selection of which sheet to move it to. Don't know if that might be easier or somehow preferable to 'Paste Special'. It would remove the issue of duplicate references though that could be fixed with 'Paste Special' by graying it out once you've pasted once or if the original move was a copy rather than a cut.

Revision history for this message
eelik (eelik) wrote :

Paste Special is more generic and therefore can solve more potential problems and serve more use cases. For example, it works (at least it should work!) with both Copy and Cut, and it can be used within one sheet.

Revision history for this message
Robert Baruch (robertbaruch) wrote :

You could have "Paste & Keep Annotations" and "Paste & Add Annotations". "Paste" means "Paste & Drop Annotations", which is the default behavior.

Paste: Pastes components, dropping their annotations.
Paste & Keep Annotations: Pastes components, keeping their annotations.
Paste & Add Annotations: Pastes components, and brings up a dialog:
  Sorting:
    * Sort by X
    * Sort by Y
    * Sort by current annotations
  Numbering:
    * Use first free after N
    * Use first free after sheet x100
    * Use first free after sheet x1000

If I had to prioritize, I'd want Paste & Keep Annotations first.

For "Sort by current annotations", if you have, say, R3, R4, R5 and Q1, and select "Use first free after 0", then you'll end up with R6, R7, R8 and Q2 (as long as these aren't already present). If a component has no numbering, then executing the command should result in an error, saying that the block must be fully annotated.

Revision history for this message
eelik (eelik) wrote :

I still think a generic "Paste Special" is better than any specific name. Reasons:

The names are shorter.

Other options can be added to the dialog without changing the name.

If something similar (options for pasting) is needed for pcbnew it would have the same name which would be more consistent, and there also the other reason would be relevant.

But these are only smaller details; what is the default behavior of the default Paste command and what are the options in the more specific command are important details.

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

+1 on paste special, keeping also a standard "paste" with the default behaviour of clearing annotation of a component if its reference yet exists in design.

Revision history for this message
Jeff Young (jeyjey) wrote :

I think the default behaviour should be able to determine if there are no conflicts (ie: cut and paste) and keep the annotations.

But beyond that a Paste Special sounds good.

Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Triaged → In Progress
Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote : Re: [Bug 1837002] Re: Wishlist: Schematic copy paste offers options on how to deal with existing annotation

I agree, this is probably the optimum behaviour.

On 02/09/19 15:50, Jeff Young wrote:
> I think the default behaviour should be able to determine if there are
> no conflicts (ie: cut and paste) and keep the annotations.
>
> But beyond that a Paste Special sounds good.
>
> ** Changed in: kicad
> Assignee: (unassigned) => Jeff Young (jeyjey)
>
> ** Changed in: kicad
> Status: Triaged => In Progress
>

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Summarizing the previous posts, a good way to go seems:

-Default (on shortcut ctrl-v (or similar on other OS) and "paste" item in right-click menu): keep annotation if there are no conflicts (faster to implement modifying the current behaviour, and solves the "cut-and-paste to move" problem).

-Advanced: "paste special" (new function, accessible with new right-click menu item, longer to implement) on sub-menu items like
paste special +->un-annotate
              +->keep annotation (forces to keep current annotation, but may be it will need a warning message to confirm if there are conflicts)
              +->add annotation (opens dialog to sort options, select first indexes to use etc...)

P.S.: If shorter strings are desirable using "paste..." instead of "paste special" in the right-click menu can also be considered.

Cheers,
Dino.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision fc50ddda64cb0d3d31ea472508ca98c50600c364
https://git.launchpad.net/kicad/patch/?id=fc50ddda64cb0d3d31ea472508ca98c50600c364

Changed in kicad:
status: In Progress → Fix Committed
Changed in kicad:
milestone: none → 6.0.0-rc1
Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Hello,
The paste special still can't be used to move components from one sheet
to another for a board that has yet been routed since it has a side-effect:
Components moved with "cut-and-paste" are un-placed when you update your
pcb with the modified schematics (F8 shortcut).

Cheers,
Dino.

Revision history for this message
Rene Poeschl (poeschlr) wrote :

I would assume that you will need to choose "reassociate by reference" after a cut and paste-special.

There could be a special mode added to paste-special that allows keeping the timestamp the same for the pasted symbols. But that really requires a guaranty that the symbols are removed from the original source. (Might be tricky to guarantee this even if it is only available after cut. One can easily imagine a case where the user does only save the target sheet. Or somehow reverts the source sheet. Both would result in the internal "unique" identifier to be duplicated which i assume might break some things.)

Maybe a better solution would be to offer "update pcb side to new timestamps" as part of the paste special dialog.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Dino, which Paste Special checkbox did you have checked? If you checked Keep, and there were no timestamp collisions, it's supposed to keep the existing timestamps.

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

On 03/09/19 17:26, Jeff Young wrote:
> @Dino, which Paste Special checkbox did you have checked? If you
> checked Keep, and there were no timestamp collisions, it's supposed to
> keep the existing timestamps.
>

Yes, even with Paste special and keep the component deleted and
re-placed on pcb when you synchronize with F8.

Cheers, Dino

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

On 03/09/19 17:26, Jeff Young wrote:
> @Dino, which Paste Special checkbox did you have checked? If you
> checked Keep, and there were no timestamp collisions, it's supposed to
> keep the existing timestamps.
>

In the sheet where I cut (before cutting) (get from the .sch file)

$Comp
L Device:R R1
U 1 1 5D7344E1
P 5850 4150
F 0 "R1" H 5920 4196 50 0000 L CNN
F 1 "R" H 5920 4105 50 0000 L CNN
F 2 "Resistor_SMD:R_0603_1608Metric" V 5780 4150 50 0001 C CNN
F 3 "~" H 5850 4150 50 0001 C CNN
 1 5850 4150
 1 0 0 -1
$EndComp

In the file of the sheet where I paste (after pasting)

$Comp
L Device:R R1
U 1 1 5D7344E1
P 5950 4050
F 0 "R1" H 6020 4096 50 0000 L CNN
F 1 "R" H 6020 4005 50 0000 L CNN
F 2 "Resistor_SMD:R_0603_1608Metric" V 5880 4050 50 0001 C CNN
F 3 "~" H 5950 4050 50 0001 C CNN
 1 5950 4050
 1 0 0 -1
$EndComp

So it seems the timestamp is kept (U 1 1 .... is the same in both files).
May be the sync with pcbnew uses not only the timestamp but also the
sheet where the symbol is located?

Cheers,
Dino.

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

P.S.: When you paste to the same sheet where you cut does not show the issue, neither with normal "paste" (that keeps annotation by default) nor with "paste special".

Revision history for this message
Jeff Young (jeyjey) wrote :

Yes, the "detect collisions" logic runs in both cases. Sounds like your hypothesis from comment #17 is correct....

Revision history for this message
Tony Kerr (ajkerr-4) wrote :

This is absolutely frustrating.

No special paste modes are required.

I have found that, if I copy a component and paste it, behaviour is as expected - the new component has the same attributes as the original, with the reference field cleared (e.g R?, U?, C? etc).

This is the same behaviour as V5, and makes perfect sense.

If, however, I edit any of the fields and THEN attempt to copy and paste, the new component has all the fields blank.

A work around appears to be to edit a component, save the schematic, CLOSE Eeschema and re-open it, then copy and paste the component.

I have also found that the problem only seems to affect subordinate sheets. It does not appear to happen on the main sheet.

Is it possible that the problem with copying sections of schematics to other sheets is to do with the way the paste function works on subordinate sheets?

Revision history for this message
eelik (eelik) wrote :

Launchpad isn't used anymore for KiCad issues, the right place for this is now https://gitlab.com/kicad/code/kicad/-/issues/3148.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.