Up to release 6.0 were able to pass data from our app and get data
from Rhino with a copy/past to clipboard using opennurbs to write-read the buffer.
Something has changed and it does not work in v 7.0 , can we have a example on how to do this ?
thanks
Gerry
dale
(Dale Fugier)
February 19, 2021, 4:58pm
#2
Hi @gerryark ,
Do you have some code, that doesn’t work, that you can share?
Thanks,
– Dale
Here a snippet for reading, I have a similar for Writing
they both work fine with Rhino 6
Model.read fails to read from the stream
void uimain::cmGetRhinoData( bool bSilent )
{
QClipboard *clipboard = QApplication::clipboard();
const QMimeData * mimeData = clipboard->mimeData( );
QStringList formats = mimeData->formats();
for(int k=0;k<formats.size();k++)
{
QString cformat = formats[k];
//QStringList items = cformat.split("=");
//if (items.size() > 1)cformat = items[1];
if( cformat.contains(QString("Rhino 4.0 3DM Clip global mem")) || cformat.contains(QString("Rhino 5.0 3DM Clip global mem")) || cformat.contains(QString("Rhino 6 3DM Geometry"))|| cformat.contains(QString("Rhino 7 3DM Geometry")) )
{
QByteArray data = mimeData->data ( cformat );
QRhinoDataStream stream(data);
ONX_Model model;
if( model.Read(stream) )
{
IW_ReadRhinoFile( &model , GetStruttura() , NULL , bSilent );
return;
}
}
}
}
dale
(Dale Fugier)
February 19, 2021, 7:41pm
#4
Hi @gerryark ,
Here is a sample that shows how to paste, basically.
cmdSamplePaste.cpp
It is intentionally verbose, and it does not read from a stream but rather from a temporary file.
Does this help?
– Dale
Thanks Dale
Could I have a example on how to fill clipboard and pass data to Rhino, basically the other way around so I can test both
Thanks
Gerry
dale
(Dale Fugier)
February 19, 2021, 10:19pm
#6
Hi @gerryark ,
I’ve added a “Copy” command sample to the file I referenced above.
– Dale
thanks Dale
tested and it works fine
gerry