Site Tools

Retrieving Rhino Data from the Clipboard

Developer: C++
Summary: How to access Rhino data from the Windows Clipboard.

Like most Windows applications, Rhino can cut, copy, and paste information to and from the Windows Clipboard. When Rhino either cuts or copies geometry to the clipboard, it creates a temporary 3DM file that contains the selected geometry. Rhino then stores the temporary filename in the Clipboard. When a paste operation is invoked, Rhino determines if the Clipboard contains the name of a temporary Rhino file. If found, Rhino simply imports the temporary file.

Rhino registers custom Clipboard formats to store the temporary file names: a unique Clipboard format for each Rhino version.

The attached C++ file demonstrates how to determine of there is Rhino information in the Windows Clipboard. If there is Rhino data in the Clipboard, the sample will retrieve the name of the temporary file. Once this file name is known, you can whatever means necessary to retrieve the data. For example, if you are using this code from a Rhino plug-in, you could script the running of Rhino's Paste command to insert the geometry into the current document. If you are in a standalone application, you would use the opennurbs toolkit to read the temporary .3DM file.

developer/sdksamples/clipboard.txt ยท Last modified: 2015/09/14 (external edit)