Copy and paste bug? The journey to fix it

Here is a post I made to the V-Ray forum;

If I copy and paste ANY geometry – even a single line – I get a 10 second delay. The file is under 25 MB, so it’s not a memory issue

I suspect it is a V-Ray bug because I see this info on my command line:

  • _CopyToClipboard
  • _Paste
  • V-Ray data version of "C:\Users\David\AppData\Local\Temp\rh$6C14.tmp ": -1

​Again, there is no material on the single line that I did my copy and paste test.

For larger geometry with materials, the system lock-up delays can be 20 seconds or more. This makes the system almost unusable.
------------------- end -------------------------------------

Here is their analysis & solution

I’ve checked your file. Indeed there is a delay when copying (not pasting though).
If you disable V-Ray and perform the same action - you will observe the delay as well. Thus it is not V-Ray itself, at least not the V-Ray run-time for sure.
I used the debugger to check up the call stack at the time of the delay, and it is mostly Rhino’s OpenImageIO implementation. That is there is some image processing going on a background.
Furthermore when you copy, but not paste, and close Rhino, you will see this message:


This is very odd, for having copied a single line geometry.
I inspected the clipboard - and indeed Rhino puts ~1MB and geometry and 5 MB of imagery on the clipboard:


The image you see (CF_DIB) is the snapshot of the viewport.
The bigger viewport the larger the image - thus you can reduce the size of what Rhino puts on the clipboard by having smaller viewports.
This is not very practical, but an useful knowledge.

When you copy something via Ctrl+C, what Rhino does it to make a new document that contains only the copied stuff. However that also includes among other things the full RDK table (materials, textures and environments)
Usually that is OK, since the RDK is just XML “file”. And indeed those 1MB is mostly comprised of the RDK table. However, the shape you copied doesn’t have any materials assigned !?
And yet Rhino does copy the entire RDK alongside it. And it does that several times. The reason for that is that it is not known in advance where you’re gonna paste it. That’s why Rhino puts the same data in several different formats on the clipboard.
it even writes out a .dwg file for AutoCAD (on the disk!).

No onto the real problem.
Putting all that on the clipboard is not really a problem - after all the clipboard is just RAM and that is fast.
The problem is that Rhino does some image processing. I don’t know what and why, but it does, and that takes time.
That’s why CAD software usually have in-built copy command. That does not inflict putting any data to the clipboard, transforming it into several formats.
This is true for AutoCAD, Solidworks, Catia, you name it, so does Rhino.

Just use the in-build Copy command, instead of CopyToClipboard
You will save a lot of time
------------------- end -------------------------------------

My update:

I made a keyboard shortcut for CTRL+C to be [Edit>]Copy instead of CopyToClipboard.

Things are improved, but the command Edit > Copy invokes two extra steps; as it asks you for starting and ending position.

QUESTION > How do I get the old copy and paste functionality back???

Notice that the SVG, PDF, and DWG formats are very small. This is because there is a mechanism with the clipboard to advertise that you can support a clipboard format, but not actually do any work until an application attempts to paste this format.

I would like to do the same for the image and V7 format; just haven’t found the time yet.

Hey @stevebaer

Thanks for the reply.

All I want is to have minimal delay when I copy and paste. Locking up for 20 seconds or more is not fun.

Q1 > What, if anything, can I specifically do differently?

Q2 > If possible, how do I use Edit > Copy with an ‘in place’ option to avoid picking a ‘to’ and ‘from’ location each time?

How about _Copy _Pause _InPlace?

– Dale

You can try the 8.14 release candidate when it becomes available next week. There was one change I know of that may affect timing.

I wasn’t very clear in my initial response. What I was referring to was for us to do something to attempt and reduce this waiting time.

This is excellent! I did find that the Keyboard Shortcuts are very picky with spaces and formatting, but your suggestion works perfectly.
_Copy _Pause _InPlace

This also worked, but I’d like to know exactly why
_Copy _InPlace

In a very recent SR of Rhino 8, I noticed that the Tools > Rhino Options > Keyboard shortcuts were extremely limited and I had to resort to the section called Aliases. However, the keyboard shortcuts now seem to be functioning again.

QUESTION > Am I imagining this?

Hi Dave -

That will only work as expected when you preselect the object(s). The macro with Pause also works when nothing is selected before you run the macro.
-wim