News:

 

Topic: Samardac Bridges.  (Read 15088 times)

0 Members and 1 Guest are viewing this topic.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 04, 2015, 07:21:18 am
Thanx.
Portfolio: www.samardac.com

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 04, 2015, 03:58:54 pm
IStonia,
How to restore selection after select by material cascade?
I can see there is save/restore selection in subobject mode but do not know how to make it in object mode.
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3705
  • Developer
  • Administrator
  • Polygon
February 06, 2015, 05:51:51 am
Try this
http://www.digitalfossils.com/Download/NVil-Feb-05-15.rar

  * Selection > Save Current Object Selection.
  * Selection > Paste Saved Object Selection.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 06, 2015, 01:54:59 pm
Thanx, is it any command that allow to save to defined directory?
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3705
  • Developer
  • Administrator
  • Polygon
February 06, 2015, 09:09:03 pm
Why you need it for?

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 07:14:26 am
Now,
I use Clpboard commans to save, load obj.
So my script interact with MoI, KeyShot and Rhino(fot T-Spline conversion)
I could make MoI, KeyShot to load .obj from NVil clipboar directory, but looks like there is no way to make Rhino do it, becouse it has no built in variable like %AppData%. So my script after NVil copy to Clipboard, copy .obj to directory that Rhino can acces and this additidional file copieng take time, so process of conversetion becom larger.
Also it will be much convinient for me to have all transtion.obj in one folder, now I use one folder for NVil (Clipboard directory) and one for all other apps.
So it will be greate to have Save/Load command to save/load in directory that you need. Or may be NVil already have somethink like it?
Portfolio: www.samardac.com

  • No avatar
  • Posts: 232
  • Spline
February 07, 2015, 07:31:03 am
but looks like there is no way to make Rhino do it, becouse it has no built in variable like %AppData%.
I didn't follow along with your Autohotkey scripts but what you want sure is doable. Rhino is extremely scriptable one could access this folder in various script languages but also a simple macro (made from the dash "-" version of the import command)will do.

I agree that setting a custom path for Nvils clipboard feature was nice.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 07:43:35 am
 polyxo, I tried to find way how to make it, now I have script in Rhino that hadle import and TSpline manipulation it works good but as I say I have no %AppData% and I do not find simple way to get it, If you know know tell me pleas. So it is simpler for me to indicate simple directory for Rhino to import. Also it is a bit complicated to keep diffrend folders for file keeping for my script, so it looks like have custom commands save/load in NVil is best solution.
« Last Edit: February 07, 2015, 07:53:50 am by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 232
  • Spline
February 07, 2015, 08:44:00 am
I would like to help but I'm afraid that I don't quite understand your problem. To me Appdata is just a directory on C, the parent folder of Nvil's file exchange folder. It is unproblematic to let Rhino write to and read from a file, using this path: C:\Users\Username\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj

There will also be ways to perform this action without the need for individual users to set the path, you might check Rhino's scripting Help or post in the developer section of the Rhino forum.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 09:20:05 am
The problem is that Rhino have to import obj form:
C:\Users\USERNAME\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj

This USERNAME is different on different PC(this will work on my PC but did not work on yours becouse you have different USERNAME), that is why script must use variable instead of simple path to work on all PCs.
For example in AHK this variable is A_AppData, in Windows it is %AppData%(you can past it in explorer to see how it works.)
I made MoI import obj from NVil clipboard directory by using build in function -  moi.filesystem.getAppDataDir() (MoI uses Java Script for scripting)
But I do not know how to get this variable(%AppData%) in Rhino, frankly say I found this way using VBA for scripting in Rhino, but I do not like it. It is here: http://stackoverflow.com/questions/3865777/how-to-reference-home-folder-on-visual-basic-script
Hope this make sense.
« Last Edit: February 07, 2015, 09:29:05 am by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3705
  • Developer
  • Administrator
  • Polygon
February 07, 2015, 09:36:15 am
When NVil does clipboard copying, it also writes the file and path onto windows clipboard.

When NVil does paste from clipboard, first it checks the any file path in the clipboard. If it can't find any in the windows clipboard, it will check the NVil's default clipboard location.
Here is the code.

-----------------------------------------------
            private string[] GetClipboardFileInfo()
            {
                string[] files = null;
                IDataObject iData = Clipboard.GetDataObject();

                if (iData.GetDataPresent(DataFormats.FileDrop))
                {
                    files = (string[])iData.GetData("FileDrop");
                }
                else
                {
                    string file = AbstractGraphicWindow.ClipboardFolderPath + @"\ClipboardObj.obj";
                    if (new FileInfo(file).Exists)
                    {
                        files = new string[1];
                        files[0] = file;

                        return files;
                    }
                    else
                    {
                        file = AbstractGraphicWindow.ClipboardFolderPath + @"\ClipboardDae.dae";
                        if (new FileInfo(file).Exists)
                        {
                            files = new string[1];
                            files[0] = file;
                        }
                    }
                }

                return files;
            }
------------------------------

So if your plugin can read/write file info from/to windows clipboard, you may have the solution.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 09:37:16 am
And as I said before to communicate with NVil my plugin use its ClipBoar directory, but to communicate with all other apps Plugin use directory that was created by itself, now it looks like: c:\ProgramData\Samardac\Bridges\

So no if I want to export from MoI I have to use 2 differen paths:
1. For Nvil: C:\Users\USERNAME\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj
2. For KeyShot: c:\ProgramData\Samardac\Bridges\

If I want to export from NVil:
1. To KeyShot: C:\Users\USERNAME\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj
2. To MoI: C:\Users\USERNAME\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj
3. To Rhino: C:\Users\USERNAME\AppData\Roaming\DigitalFossils\NVil\Media\Clipboard\ClipboardObj.obj then copying to c:\ProgramData\Samardac\Bridges\

As you can see complicated I'd like to use only one directory for communication like:
c:\ProgramData\Samardac\Bridges\ or so on.

That is why it will be great to have custom save/load commands in NVil.
Portfolio: www.samardac.com

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 09:43:45 am
IStonia,
thanks for your comment, it makes me find solution.
Now my Plugin add value to register to assign import script to hotkey in Rhino, so I can get directory of ClipboardObj.obj in AHK and then set it in to Registr for Rhino to use.
But still will be great to have those save/load commands. But I really do not know how you will implement them in NVil Instructions.txt
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3705
  • Developer
  • Administrator
  • Polygon
February 07, 2015, 09:58:42 am
Why you use this

2. For KeyShot: c:\ProgramData\Samardac\Bridges\

If the plugin only for you, it's ok. But if some one uses your plugin, it could be unacceptable. The user may even don't have the right to create that new directory.
« Last Edit: February 07, 2015, 10:00:48 am by IStonia »

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 07, 2015, 10:09:10 am
I plane to make this Plugin not only for me, so thanks for your notice.
I do not yet think about it because I have not yet start to make installation file.
I plane that it will be:
c:\ProgramData\Samardac\Bridges\ to allow Rhino to import without problems(after plugin copy obj here), but now(I solve this problem with %AppData%) I think to move here:
c:\Users\Samardac\AppData\Roaming\Samardac\Bridges\

I really know nothing about folder permissions yet. So what do you suggest to do?
« Last Edit: February 07, 2015, 10:11:21 am by samardac »
Portfolio: www.samardac.com