MoI discussion forum
MoI discussion forum

Full Version: Copy-paste from Rhino 7 to MoI3d

Show messages:  1-9  10-29  30-49  50-51

From: renklint
24 Dec 2020   [#10] In reply to [#9]
Sorry, I haven't got version 5.

Today I purchased Moi3d and have downloaded v4 beta.

I can kinda copy/paste curves from Rhino 7 to Moi v4.

But if the curves are 3d they are squished to flat on z.

Pasted a SubD and a Nurbs closed surface from Rhino 7, which came out as flat curves in Moi.
Then pasted to Rhino 6, copied and pasted both in Moi. Only the polysurface was pasted in Moi.

Image Attachments:
paste.png 


From: Michael Gibson
24 Dec 2020   [#11] In reply to [#10]
Hi renklint, probably what's happening is that it's the PDF clipboard format being used rather than 3DM format.

The problem is likely that Rhino v7 is not telling the OS clipboard system that it can produce a Rhino v5 3DM format for the clipboard data. That's what MoI would need to see in the clipboard for it to work.

What operating system are you running on? I can probably cook up a helper app that could make things work by translating Rhino v7 3DM format on the clipboard into Rhino v5 format, then you'd modify the paste function to run the helper app right before doing the paste.

I probably need to collect a little bit of information first like get the names of the clipboard formats that Rhino v7 is putting on the clipboard.

- Michael
From: renklint
24 Dec 2020   [#12] In reply to [#11]
I'm using win 10.

Please let me know if I can help you doing some tests.

The free clipboard viewer has this to report about the copied geometry.
(https://freeclipboardviewer.com/windowsclipboard/)

Attachments:
copy.cl7

Image Attachments:
clip.png 


From: Michael Gibson
24 Dec 2020   [#13] In reply to [#10]
Hi renklint,

re:
> Then pasted to Rhino 6, copied and pasted both in Moi. Only the polysurface was pasted in Moi.

That's to be expected - SubD is a new object type in Rhino v6 and v7 and isn't stored in Rhino v5 format 3DM files which is currently the latest type that MoI can read.

I think there's some method to convert a SubD Rhino object into a regular NURBS object, you would need to do that to transfer it into MoI.

- Michael
From: Michael Gibson
24 Dec 2020   [#14] In reply to [#12]
Hi renklint,

re:
> I'm using win 10.
>
> Please let me know if I can help you doing some tests.

Well the first step is to use a clipboard viewer utility to see what clipboard data types Rhino v7 is putting in the clipboard when you do a copy from Rhino.

It seems that there isn't a clipboard viewer built in to Windows anymore like there used to be.

If you can try some app like the ones mentioned here:
https://www.thewindowsclub.com/windows-clipboard-manager-viewer

the data that I'm looking for is a list of clipboard formats like it should have a list something like "CF_DIB", "PDF", "Rhino v7 3DM clip", etc...

I can cook up a little app that would gather and show this list if none of those viewers seems to do it well.

- Michael
From: renklint
24 Dec 2020   [#15] In reply to [#14]
Here's a list:

Image Attachments:
clip2.png 


From: Michael Gibson
26 Dec 2020   [#16] In reply to [#15]
Hi renklint,

re:
> Here's a list:

Thanks, that helps! I've got a helper app almost ready which I think should make it possible to solve this. It's a small program that is built with the OpenNURBS7 library and so it can look in the system clipboard and if a Rhino v7 3DM file is in there it can take it and convert it to a Rhino v5 3DM file and put that in the clipboard so that the paste will work.

Then you would modify your Ctrl+V paste keyboard shortcut so it runs this helper app before doing the actual paste into MoI.

I've almost got it ready to test.

What happens if you do a Ctrl+C copy in Moi and then try to paste in Rhino v7, does that work or is that direction also not working with Rhino v7 either?

- Michael
From: renklint
26 Dec 2020   [#17] In reply to [#16]
That sounds very promising.
From Moi to Rhino 7 works.
From: Michael Gibson
26 Dec 2020   [#18] In reply to [#17]
Hi renklint, I've attached the helper app here. Unzip it and save it somewhere.

Then you'll need to modify the Ctrl+V shortcut key in MoI to run the helper app before doing the paste.

To do that go to Options > Shortcut Keys and for the Ctrl+V key that currently has "Paste" for its Command value, instead put in this:

script: moi.filesystem.shellExecute( 'c:\\path\\UpdateRhinoClipboard.exe', 'target=moi', true /*wait for finish*/ ); moi.command.execCommand( 'paste' );

You'll need to update the c:\\path\\ to the path where you saved it, and also note that instead of just one \ character you need 2 of them like \\ because a single \ is an escape character in JavaScript.

Any luck with Ctrl+V working from Rhino 7 to Moi with that in place?

- Michael

UPDATE - Mac version is here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=9890.35

Rhino script for going the reverse direction here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=9890.40

Attachments:
UpdateRhinoClipboard.zip


From: renklint
26 Dec 2020   [#19] In reply to [#18]
Yes!
Points, curves, open surfaces and polysurfaces - from Rhino 7 to Moi.
You are a wizard!


Image Attachments:
rhino.png 


From: Michael Gibson
27 Dec 2020   [#20] In reply to [#19]
Hi renklint, that's great I'm glad that works!

- Michael
From: feirui445
31 Dec 2020   [#21] In reply to [#18]
Hi Michael Gibson,I don't know how to save and set the folder. Can you demonstrate it? Thank you
From: Michael Gibson
31 Dec 2020   [#22] In reply to [#21]
Hi feirui445, the folder can be anywhere on your system where it is convenient for you to store a downloaded file.

One possibility would be to store it in the MoI appdata folder. To do that press Win+R to open the Windows "Run" dialog and put in: %AppData%\Moi and push Enter. That will open up the MoI appdata folder where some MoI files are already stored. It will be a path like: C:\Users\Michael\AppData\Roaming\Moi

Unzip the file attached above to get the UpdateRhinoClipboard.exe helper program and put it in that appdata folder.

Then you would set your Ctrl+V shortcut in MoI (under Options > Shortcut keys) to be (copy and paste the following into the "Command" part of the shortcut key):

script: moi.filesystem.shellExecute( 'C:\\Users\\Michael\\AppData\\Roaming\\Moi\\UpdateRhinoClipboard.exe', 'target=moi', true /*wait for finish*/ ); moi.command.execCommand( 'paste' );

Note - you would replace the "Michael" in the path with your user name. One thing to note is the path name in the script code needs doubled backslash characters. Instead of just one \ as the path separator it needs 2 like \\. That's because in JavaScript a single \ is an escape character for special characters like \t means tab or \n means newline. The \\ means make a single backslash in the actual string.

- Michael
From: feirui445
31 Dec 2020   [#23] In reply to [#22]
Hi Michael, I'll select a face of the object in rhinoceros 7 to copy, and then paste it in moi3d, and the object will appear. Copy all the objects in rhinoceros 7, and then paste them in moi3d. The objects are lines. I'll try again, thank you!
From: Michael Gibson
31 Dec 2020   [#24] In reply to [#23]
Hi feirui445, if the objects are all lines flattened down on the X/Y plane then it means that PDF format is being used and the clipboard updater is not running.

When you paste into MoI how are you doing it exactly, are you using the Ctrl+V keyboard shortcut or some other method?

- Michael
From: BurrMan
31 Dec 2020   [#25] In reply to [#22]
Hi Michael,
Does this work from a js file also, or does it have to be invoked from MoI's "Paste" Ctrl-V
From: Michael Gibson
31 Dec 2020   [#26] In reply to [#25]
Hi Burr, it should work from any kind of script, it is just convenient to bake it into the Ctrl+V so that it does the cilpboard update and the paste all in one action.

- Michael
From: BurrMan
31 Dec 2020   [#27] In reply to [#26]
So the function in that case would be to run this script, which alters clipboard data, THEN Ctrl-V to paste into MoI?
From: Michael Gibson
31 Dec 2020   [#28] In reply to [#27]
Hi Burr, yes that's correct. Although you would remove the end part of the script above (moi.command.execCommand( 'paste' ) ) if you wanted to do the paste separately.

When the UpdateRhinoClipboard.exe program is run, it will look in the system clipboard and if it finds Rhino v7 (or v6) 3DM data there but no Rhino v5 data it will generate the Rhino v5 format from the v7 data and put it in the clipboard. Once that has been done then pasting into MoI will work.

At some point I'll probably be able to update the OpenNURBS library used directly by MoI to v7. There has been a lot of changes in it though so it will need some careful work to make sure nothing that MoI relies on itself gets broken during the update. And since compatibility is being broken on every version release it's kind of a never ending thing that I'm getting tired of chasing.

- Michael
From: BurrMan
1 Jan 2021   [#29] In reply to [#28]
Hi Michael,
Thanks for the help, i'm pretty sure it's sorted. Again i was confused.

I didn't read the "it looks for v7" part. I was using v6. Just wanted to test if i had it installed and working correctly. I most likely won't be moving to v7. It was a "Just in case" installation...

The helper app may be a good way to handle it going forward, (hopefully that was easier to cook up) so you don't have to mess with the base much... may not be enough guys using the copy/paste functionality to warrant the work...

Thanks again. Sorry about the extra work from my end...

Show messages:  1-9  10-29  30-49  50-51