NVil Forum

General Category => Feature Requests => Topic started by: samardac on January 12, 2015, 10:10:10 am

Title: Samardac Bridges.
Post by: samardac on January 12, 2015, 10:10:10 am
Is it way to select all objects with same material?
If no PLEAS make it!
It is hard to work fully without it with KeyShot.

Title: Re: select all objects with same material
Post by: Mason on January 12, 2015, 11:59:51 am
Right click on material gives you options to do this.
Title: Re: select all objects with same material
Post by: samardac on January 12, 2015, 12:14:18 pm
Mason,
Right click on material selects only polygons on selected object, so it is not what I'm asking for.

I'll explain my request more detail.
For example I work with some object, and then run command "select objects with same materials" and NVil selects all object that have the same material as object that I'm working on.
If object has more then one material assigned to its polygons for example material A and material B, Nvil will selects all object that has material A and then selects all objects that has material B and no matter if those objects may have some more materials than only A or B, they will be selected whatever.

It looks like it has to be Generic tool.
And have to work this way:
1. Identify selected object.
2. Find what materials are assigned to this object.
3. Find objects that has the same materials
4. Select that objects.


This tool is must have if you work with KeyShot, because for example if you have 3 objects with same material, and modify one of them then Update geometry in KeyShot, KeyShot will delete all objects with the same materials if you are not selected them when you made export.
It is not problem if you have one material per object but if you have one material per 3 or six or more objects it becomes problem. So before Update Geometry in KeyShot you must select all objects with the same style and export.
Title: Re: select all objects with same material
Post by: samardac on January 12, 2015, 01:29:01 pm
Just experimented a bit more with KeyShot, and have some additions.
To allow KeyShot to handle correct objects that have more than one material assigned it has to be:

And have to work this way:
1. Identify selected object.
2. Find what materials are assigned to this object.
3. Find objects that has the same materials and select them.
5. Analyse found objects.
6. Repeat from 2 to 6.
7. Till all selected objects will contain all selected materials.

Have no Idea if it is possible to implement, but NVil have no Render and KeyShot is very popular one, so this function will allow NVil to move to next level in terms of Render.
My plugin now allow to connect Nvil an Keyshot but with this command it will be PERFECT!
This is how it works:
https://www.youtube.com/watch?v=bAtiJNq3NAg
Title: Re: select all objects with same material
Post by: samardac on January 12, 2015, 01:43:04 pm
Some example of script work to make more sense.
If we have object 1 with materials A and B, Script looks if another objects has these materials. Script found that object 2 has also material A and it selects it. But object 2 also have material C scripts looks for objects with this material and it found  that object 3 has this material and select it. Object 3 have only material C so script stops.
Title: Re: select all objects with same material
Post by: samardac on January 12, 2015, 02:01:44 pm
And some demonstration about - Select objects with same materials:
https://www.youtube.com/watch?v=E-zuOTQuetA&feature=youtu.be

About exception message look here:
http://voidworld.cmcproductions.co.uk/index.php/topic,2546.0.html
Title: Re: select all objects with same material
Post by: IStonia on January 13, 2015, 09:47:06 am
Try this. "Select objects by material" is added to the right click menu in material window.
http://www.digitalfossils.com/Download/NVil-Jan-13-15.rar
Title: Re: select all objects with same material
Post by: samardac on January 13, 2015, 01:04:29 pm
IStonia,
Many thanx!
Could you pleas modify this command a bit and this will allow to my plugin make correct Update in KeyShot.
I made this video to explain you this problem more detail:
http://youtu.be/JguO7_SXf3g

Also pleas make it available in tools window to make it possible to assign shortcut to it and my plugin will be able to run it by shortcut.
Thanx in advance.
Title: Re: select all objects with same material
Post by: IStonia on January 14, 2015, 09:59:30 am
Try this
http://www.digitalfossils.com/Download/NVil-Jan-14-15.rar

I added another function, Select objects by material(Cascade).

I also exposed it as an API, StartForm.SelectObjectsByMaterialCascade(), in NVil1.0.exe. See if you can access it.
Title: Re: select all objects with same material
Post by: samardac on January 14, 2015, 02:32:32 pm
Hay IStonia,
I try to call this API but have no luck.
I using AHK-Autohotkey language and asking people on forum of AHK why it does not wokr, this is thread:
http://ahkscript.org/boards/viewtopic.php?f=5&t=5925&p=34593#p34593
Looks like I made everything right considering help file of AHK. My function return that - The specified function could not be found inside the DLL/exe. So may be there is no this function inside exe?

How to call this API may be COM?
Give me some idea to go pleas.
Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 09:13:26 am
How do you trigger the NVil's export functions? Can you show me the code?

Also try "SelectObjectsByMaterialCascade()" instead of "StartForm.SelectObjectsByMaterialCascade()".
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 09:25:02 am
Tried SelectObjectsByMaterialCascade() also no luck.

I use this code:

NVil_Dir = C:\Program Files\NVil\NVil 1.0.exe
SellCascade = SelectObjectsByMaterialCascade()

DllCall(NVil_Dir . "\" . SellCascade)

***
DllCall - calls a function inside a DLL/Exe, such as a standard Windows API function.
Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 09:27:31 am
I asked you these in my last post
How do you trigger the NVil's export functions? Can you show me the code?
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 09:45:14 am
op, sorry misunderstood you.
I chose to use Clipboard Copy. I set shortcut Ctrl+C to this function and trigger it than script made all other stuff.
This is NVil Export Block:

NVilExport:
{
   gosub ActNVil
   
   FileDelete, %NVilCB%
   SetKeyDelay %NvilKeyDelay1%, %NvilKeyDelay2%
   
   Send {ctrl down}c{ctrl up}
   SetKeyDelay 10,-1
   
   sleep 100
   WinGetText, CurrWin, A
   WaitWin = There is no available object to save to obj file.
   IfInString, CurrWin, %WaitWin%
   {
      
      ErrorLevelAction()
      exit
   }
   
   Progress, b,,Nvil is exporting .OBJ..., Exp
   Progress, 90   
   
   
   FileWaitSaveComplite(NVilCB)
   
   FileCopy(NVilCB,Obj)
   
   ;FileCopy %NVilCB%, %A_WorkingDir%\transfer.obj,  1
   FileWaitSaveComplite(obj)
   
   Progress, 100
   Progress off
   return
}

I planed to make composite tool that will run Select objects by material(Cascade) and then Clipboard Copy (obj). And trigger this composite tool when export begins by using shortcut.

Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 09:58:15 am
What is "gosub ActNVil"?
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 10:00:39 am
It checks if NVil is open if no Open it. If it is opened then activate it.

ActNVil:
{
   IfWinNotExist, %NVil%
   {
      Run %NVil_Dir%,,UseErrorLevel
      CheckRun(NVil_Dir)
      WinWait %NVil%
      WinActivate %NVil%
      Sleep, 1000

   }
   WinActivate %NVil%
   sleep 100
   return
}
Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 10:03:12 am
What is %NVil% ?
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 10:06:37 am
NVil = NVil ahk_class WindowsForms10.Window.8.app.0.378734a

But I'm going to change it from Title and AHK Class to HWND. To allow my script work only with one selected NVil window.
Let me know if you want to know something else about this script.
Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 10:13:29 am
Well, it seems there is no simple solution. I run out of idea.
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 10:18:07 am
Why? It is impossible to make Select objects by material(Cascade) appears in Tools window to assign shortcut to it?
All I need is ability to run Select objects by material(Cascade) by using shortcut.
If it is possible everything will be good and will work perfect!
Title: Re: select all objects with same material
Post by: IStonia on January 15, 2015, 02:59:12 pm
Can your plugin write a .txt file into the hard disc?
Title: Re: select all objects with same material
Post by: samardac on January 15, 2015, 03:00:50 pm
Yep, no problem.
Also My plugin use .INI file.
That is here:
c:\Program Files\Bridges_3D\bridges.ini
May be you can use it.
Title: Re: select all objects with same material
Post by: IStonia on January 16, 2015, 10:23:21 am
Try this
http://www.digitalfossils.com/Download/NVil-Jan-15-15.rar

I added a feature so NVil can take instructions from a .txt file which contents look like this

-----------------

TID Common Modeling Shortcut Tools >> Select Objects By Material (Cascade)
TN Common Modeling Shortcut Tools >> Clipboard Copy (obj)

-----------------

You can get the instruction text from Edit > Customize > Tools. Right click the tool, then click the View Tool ID popup menu.
For program generated tools, it's better to use tool's ID because user can change tool's name. For user generated tools like composite tools, it's better to use tool's name since user generated tools will have unique IDs that are different between users.
You can put a bundle of instructions into the text.

The text file must be named as
NVil Instructions.txt

The file path must be like this
C:\Users\UserName\AppData\Roaming\DigitalFossils\NVil\NVil Instructions.txt
My c# code for the path is
Environment.SpecialFolder.ApplicationData + "\DigitalFossils\NVil\NVil Instructions.txt"
AHK should have similar method.

Once your plugin writes the file, NVil will read it and perform the operations as required. Then NVil will delete the file.

Title: Re: select all objects with same material
Post by: samardac on January 16, 2015, 11:15:58 am
Just tested, works great, thank you! :)
May I ask you to make one new command - Create new scene without Dialog

Now my plugin handle that Create new scene dialog everything works good.
But with that command it will look more professional.

Forget to say my plugin also connect NVil and MoI so this command for this.
Title: Re: select all objects with same material
Post by: IStonia on January 16, 2015, 11:47:54 am
Try this
http://www.digitalfossils.com/Download/NVil-Jan-16-15.rar

"New Scene (NoDialog)" is added.
Title: Re: select all objects with same material
Post by: samardac on January 16, 2015, 12:15:20 pm
Thank you!
Developer of AHK reply to my question about API on forum, check it, may be it can be interesting for you:
http://ahkscript.org/boards/viewtopic.php?f=5&t=5925#p34805
Title: Re: select all objects with same material
Post by: Mason on January 16, 2015, 08:44:37 pm
Interesting!  What are you planning Sarmadac?
Title: Re: select all objects with same material
Post by: samardac on January 17, 2015, 07:26:45 am
Mason,
I'm working on plugin that connects NVil, MoI and KeyShot.
Title: Re: select all objects with same material
Post by: Mason on January 17, 2015, 02:36:57 pm
Will this require Rhino and Tsplines?
Title: Re: select all objects with same material
Post by: samardac on January 17, 2015, 02:46:03 pm
Export from NVil to MoI has 3 functions:
1. Creas (Export without smoothing, uses Max Smirnov's script, good for references)
2. Smooth Low quality (Export with smoothing, uses Max Smirnov's script)
3. Export through T-Spline(High quality).

All options work only with one click.
Actually I finish this plugin everything works good. But now I decide to try to remake it using Object Oriented approach. Also I have to make installer. Soon I'll release it.
Title: Re: select all objects with same material
Post by: IStonia on January 19, 2015, 06:05:36 am
Is it possible for your plugin to send message to the process where NVil is runging?

The message will be an integer: 41251
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 08:14:33 am
What kind of message?
Title: Re: select all objects with same material
Post by: IStonia on January 19, 2015, 09:28:54 am
Here is a sample code for c#

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern int SendMessage(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int Msg, IntPtr wParam, IntPtr lParam);

It is actually a window API execution. AHK should have similar stuff. "hwnd" is the window handle of the process. "Msg" is the message which is an integer.
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 09:36:54 am
I just try to figure it out...
What is going on here?:
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]

As I understand here:
SendMessage(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int Msg, IntPtr wParam, IntPtr lParam);
you send Windows message?
And what is it? - [MarshalAs(UnmanagedType.U4)] int Msg

Also I can not see here 41251.

Let me know, and looks like I can reproduce it because I can send Windows Messages and can call DLL and I can define Process ID and window ID(HWND).
Title: Re: select all objects with same material
Post by: IStonia on January 19, 2015, 09:48:12 am
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)] is used to specify that the defined function is going to use window API which is inside "user32.dll".

I can use this function to send message(like "123", "4398" or what ever) to any running app if I know its process and its window handle.

If you can send NVil a window message after you've written the .txt file. NVil will be able to read it without using timer checking.
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 09:52:34 am
Give me NVil and I'll try.
Title: Re: select all objects with same material
Post by: IStonia on January 19, 2015, 10:29:35 am
http://www.digitalfossils.com/Download/NVil-Jan-18-15.rar

Make sure the msg is 41251. This is to avoid conflicting with other window messages.
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 11:01:02 am
Can not make it to work.
Look, In AHK you send message with this command:
SendMessage, Msg [, wParam, lParam, Control, WinTitle]

Msg - is message number
WParam - Some parametr
lParam - Some parametr
Control - Name of control if you sen message to Windows conrtrol
WinTitle - Title of window or HWND e.t.c of window to what you sen message.


So, my command now looks like this(send to Win Title not HWND fore simplicity of test):
SendMessage, 41251,0,0,,NVil
It does not work, as you can see WParam and LParam is 0 may be I have to set it to something?
Also I see that Windows messages have number paterns like this: 0x000.
So may be you can figure out what is wrong.

May be you can show me working code in C# that send message to NVIl and make NVil get that .txt? And I will try to reproduce it?
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 11:18:28 am
Sorry everything is working!!
Here was mistake in name of .txt file I just notice it.
Looks like it works good without problems, thanks!
Title: Re: select all objects with same material
Post by: samardac on January 19, 2015, 11:25:36 am
Just and Idea, may be you can associate some of WParam or lParam with name of command?
To run them without .txt only with Messages?
Title: Re: select all objects with same material
Post by: samardac on January 20, 2015, 06:51:49 pm
hay IStonia,
Is it possible for you to warp command name into WParam or lParam? To send them with message.
Title: Re: select all objects with same material
Post by: Mason on January 22, 2015, 07:33:19 am
I hope to see you share this Sarmadac!

At the moment I am creating Radial Menus for Moi and would love to have integration with Nvil.
Title: Re: select all objects with same material
Post by: IStonia on January 23, 2015, 09:07:48 am
hay IStonia,
Is it possible for you to warp command name into WParam or lParam? To send them with message.

WParam and LParam are just integer values. LParam may point to an address where the data is stored. But AHK and .net may store data in different patterns, even if its the same today, it may be different in the future when things get changed.
Title: Re: Samardac bridges.
Post by: samardac on February 02, 2015, 03:34:34 pm
Hi IStonia,
Have some question,
My plugin have function - New project, it means that MoI sends to NVil obj, but before it past in NVil, plugin creates new project using command - New. So it looks like this:

TID Common Modeling Shortcut Tools >> New Scene
TID Common Modeling Shortcut Tools >> Clipboard Paste

The problem is that when Save As dialog appears and you press cancel it does not cancel Clipboard Paste.
Could you make command Clipboard Paste (New project)? So it will have command - New and Clipboard Paste, but if you press Cancel it will cancel everything.
Title: Re: Samardac Bridges.
Post by: IStonia on February 03, 2015, 07:53:33 am
Try this
http://www.digitalfossils.com/Download/NVil-Feb-03-15.rar

I didn't add any new command. But if new scene is canceled, clipboard paste won't go.
Title: Re: Samardac Bridges.
Post by: samardac on February 04, 2015, 07:21:18 am
Thanx.
Title: Re: Samardac Bridges.
Post by: samardac on 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.
Title: Re: Samardac Bridges.
Post by: IStonia on 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.
Title: Re: Samardac Bridges.
Post by: samardac on February 06, 2015, 01:54:59 pm
Thanx, is it any command that allow to save to defined directory?
Title: Re: Samardac Bridges.
Post by: IStonia on February 06, 2015, 09:09:03 pm
Why you need it for?
Title: Re: Samardac Bridges.
Post by: samardac on 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?
Title: Re: Samardac Bridges.
Post by: polyxo on 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.
Title: Re: Samardac Bridges.
Post by: samardac on 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.
Title: Re: Samardac Bridges.
Post by: polyxo on 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 (http://discourse.mcneel.com/) of the Rhino forum.
Title: Re: Samardac Bridges.
Post by: samardac on 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.
Title: Re: Samardac Bridges.
Post by: IStonia on 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.
Title: Re: Samardac Bridges.
Post by: samardac on 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.
Title: Re: Samardac Bridges.
Post by: samardac on 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
Title: Re: Samardac Bridges.
Post by: IStonia on 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.
Title: Re: Samardac Bridges.
Post by: samardac on 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?
Title: Re: Samardac Bridges.
Post by: IStonia on February 07, 2015, 11:44:06 am
I don't know much about folder permissions either. I don't think it's a good idea to mess with people's folder system.

Try this
http://www.digitalfossils.com/Download/NVil-Feb-07-15.rar
You can add something like this in NVil Instructions.txt

Clipboard_Copy_File_AppData_Roaming Samardac\Bridges\MyModel.obj
Clipboard_Paste_File_AppData_Roaming Samardac\Bridges\MyModel.obj


...
c:\Users\Samardac\AppData\Roaming\Samardac\Bridges\
...

You have two Samardac!!!
Title: Re: Samardac Bridges.
Post by: samardac on February 07, 2015, 12:12:19 pm
Can not get it to work,
this is what in NVil Instructions.txt: Clipboard_Copy_File_AppData_Roaming Samardac\Bridges\transfer.obj

My directory is: c:\Users\Samardac\AppData\Roaming\Samardac\Bridges\

NVil deletes Instructions.txt but do not save file into \Samardac\Bridges\.

Quote
You have two Samardac!!!
Yep it is because my UserName is Samardac  :)
Title: Re: Samardac Bridges.
Post by: samardac on February 07, 2015, 12:14:19 pm
Also may be you will modify this command and make it without _AppData_Roaming ?
I can get it inside AHK, but may be some users will want to copy somewhere outside _AppData_Roaming? May be even me  ;D
Title: Re: Samardac Bridges.
Post by: samardac on February 07, 2015, 02:32:49 pm
IStonia,
Just found that Selecet Objects by material(cascade) selects by material selected in Material window.
So there is no way to Select(Cascade) selected object.
You have first go to material window selects material you need and after that run Select(Cascade).
Could you pleas make command Select Material by selected object/objects?
So if object has not only one material assigned, it will selects one of them.
Need it to finish export from NVil to KeyShot. I want user just select object and run Export, without dealing with material window.

Title: Re: Samardac Bridges.
Post by: steve on February 07, 2015, 07:34:05 pm
Just found that Selecet Objects by material(cascade) selects by material selected in Material window.
So there is no way to Select(Cascade) selected object.


Why not use:-
Commom modeling shortcut tools >> Pick material
Commom modeling shortcut tools >> Select objects by material (cascade).

You then just need to move mouse cursor over object(material) in viewport and run those 2 commands.


Title: Re: Samardac Bridges.
Post by: samardac on February 07, 2015, 08:11:06 pm
Because, there is no way to keep cursor on object and at the same time push button on plugin GUI to start export.
Title: Re: Samardac Bridges.
Post by: steve on February 07, 2015, 08:27:04 pm
I do not understand.

Are you saying you start export plugin before selecting objects?

I would of thought you select objects first, then export them.
Title: Re: Samardac Bridges.
Post by: samardac on February 07, 2015, 09:10:26 pm
Quote
You then just need to move mouse cursor over object(material) in viewport and run those 2 commands.
How can I move mouse cursor over object and run command from plugin GUI at the same time? Cursor is on object or on plugin GUI.
No way...

What you suggest is:
1. Select object
2. Run shortcut - Pick material staying on object.
3. Go to plugin GUI and run export.

Step 2 is absolutely not good for plugin because:
1. User must set up this shortcut.
2. I have to told user to run this shortcut before push button - Export on plugin GUI.

What I want is:
1. Select object
2. Run export.
That is all, no any excess steps.
Title: Re: Samardac Bridges.
Post by: IStonia on February 07, 2015, 10:21:14 pm
Try this
http://www.digitalfossils.com/Download/NVil-Feb-08-15.rar

* You can ALSO use this
Clipboard_Copy_File filefullPath
Clipboard_Paste_File fileFullPath

*Selection > Select Objects (Cascade By Material). It uses the current selected objects as the starting point. You can add this into your instruction text.
Title: Re: Samardac Bridges.
Post by: samardac on February 08, 2015, 03:35:08 pm
IStonia,
Select works but file do not save. What can be wrong?

NVil Instructions.txt :

TID Common Modeling Shortcut Tools >> Select Objects (Cascade By Material)
Clipboard_Copy_File c:\Users\Samardac\AppData\Roaming\Samardac\Bridges\transfer.obj
Title: Re: Samardac Bridges.
Post by: IStonia on February 09, 2015, 08:29:41 am
It works on my side.

Do you have this line in your text?
TID Common Modeling Shortcut Tools >> Clipboard Copy (obj)
Title: Re: Samardac Bridges.
Post by: samardac on February 09, 2015, 08:38:35 am
No I don't.
Looks like I do not understand how to use Clipboard_Copy_File.
Can you pleas write instruction how to copy file in some directory?
Title: Re: Samardac Bridges.
Post by: IStonia on February 09, 2015, 08:42:51 am
This is my text

----------

Clipboard_Copy_File c:\Users\kun\AppData\Roaming\Samardac\Bridges\transfer.obj
TID Common Modeling Shortcut Tools >> Clipboard Copy (obj)

----------
"Clipboard_Copy_File" only tells the location. Nothing else. Likewise "Clipboard_Paste_File".
Title: Re: Samardac Bridges.
Post by: samardac on February 09, 2015, 09:05:25 am
Aaa...
Ok, now everything is working, I thought Clipboard_Copy_File, copy file, but it only tell path, thanx.

Title: Re: Samardac Bridges.
Post by: IStonia on February 10, 2015, 10:45:49 am
Test with this
http://www.digitalfossils.com/Download/NVil-Feb-09-15.rar

I fixed a bug which causes crashes on polygon selection.
Title: Re: Samardac Bridges.
Post by: samardac on February 16, 2015, 04:46:14 pm
IStonia,
I have a little problem, after sending Windows Message NVil starts export and my plugin starts to monitor if .obj appears. Plugin waits about 2 seconds and if .obj does not appear plugin stop export and back to idle, if .obj appears plugin waits until it stop to increase its size and go to KeayShot for other actions.

I need this check to know if nothing was selected when Export starts and also to know when to go to KeyShot.


The problem is that NVil does not create .obj straight after export was started. So now if I have big project .obj can appears after 3, 4 and more seconds, so Plugin think that .obj was not created and stop its work. It would be greate if .obj appears stright after export was started.
No metter if it will have 0 bite, it will be enough to handle it.

For example MoI when exports .obj creates it immediately and then starts to increase its size, so I have smooth workaround here. I thought that NVil do the same thing but today tested Plugin with big project and found this problem.



Title: Re: Samardac Bridges.
Post by: IStonia on February 17, 2015, 08:55:01 am
You should be able to write a loop for file waiting in your plugin. Something like this

while(true)
{
    // check file
    ...

    if(fileFound)
    {
        break;
    }
    else
    {
        Thread.Sleep(100). // This is a good practice to reduce cpu usage.
    }
}
Title: Re: Samardac Bridges.
Post by: samardac on February 17, 2015, 09:14:57 am
I have already use loop like this, but the things is that if for example user select nothing and run export, .obj will never appears so loop will goes infinitely. So that is why my loop waits only about 2 secs and if obj does not appears it exits thread.
Title: Re: Samardac Bridges.
Post by: steve on February 17, 2015, 07:49:01 pm
For example MoI when exports .obj creates it immediately and then starts to increase its size, so I have smooth workaround here.
All the other 3d application I use work in a similar way. To save system resources, on export, they will first create/open a file on disk, then convert/export each object separately to that file. Once last object exported, file on disk is closed.
 
Quote
I thought that NVil do the same thing but today tested Plugin with big project and found this problem.
Voidworld exported an .obj file as a single vertex object, so would copy geometry in memory, convert to .obj format in memory, then export to disk (the export options available to split the objects, was to create face groups within the exported file).
After I posted about an .obj file being able to have multiple objects(rather that a single vertex object) IStonia did make change, but did not change the behavior of first copying/converting everything in memory before exporting.
I have mentioned it before, it is a poor way to work, as it can use a lot of system memory for large scenes.(certainly not good if using 32bit version).

It may be a lot of work to change how the exporter works?. So why not make your plugin wait longer.
Title: Re: Samardac Bridges.
Post by: samardac on February 18, 2015, 07:25:33 am
Quote
It may be a lot of work to change how the exporter works?. So why not make your plugin wait longer.
I can make it, but...
For example I will make it wait 5 or 4 secs, I have powerful PC and it can be enough but for people with weak PC it can be not enough.
So if it will wait 5 secs and user run export and select nothing .obj will not creates and user must wait those five seconds before starting export again, it because AHK is Single Thread Execution and it does not run the same thread if it does not exit.
Title: Re: Samardac Bridges.
Post by: IStonia on February 18, 2015, 09:39:45 am
Try this
http://www.digitalfossils.com/Download/NVil-Feb-17-15.rar
Title: Re: Samardac Bridges.
Post by: samardac on February 18, 2015, 10:54:01 am
Thank you, works!
Title: Re: Samardac Bridges.
Post by: samardac on December 09, 2015, 06:23:48 pm
Hay IStonia,
I try to use this in instruction.txt but it does not work:
TID View Navigation Tools >> Best Fit (All Views)

(https://monosnap.com/file/CofBLtZiPUQWeXr5Bn5SX8lBM77bRr.png)

I have this error with all best fit commands.
Title: Re: Samardac Bridges.
Post by: kevjon on December 10, 2015, 07:38:04 am
Have you tried

View > Viewport Framing > Best Fit All
Title: Re: Samardac Bridges.
Post by: samardac on December 10, 2015, 07:45:20 am
I try to use this command with - NVil Instructions.txt and looks like it does not work.
This NVil Instructions.txt is used to control NVil from another application.
Title: Re: Samardac Bridges.
Post by: IStonia on December 15, 2015, 09:03:20 am
Fixed
http://www.digitalfossils.com/Download/NVil-Dec-15-15.rar

Also, Edit > Customize > Tools > Common Modeling Tools > P_SaveToFile.
Title: Re: Samardac Bridges.
Post by: samardac on December 15, 2015, 12:02:53 pm
Works great!
It do not support .vws is it how it should be?
Title: Re: Samardac Bridges.
Post by: samardac on December 16, 2015, 08:53:07 am
IStonia,
This tool P_SaveToFile do not exit composite tool when nothing is selected. It shows message - There is no available object to save to obj and then continue to execute composite tool.
Pleas make this tool to stop execution of composite tool in this situation because after this P_SaveToFile I have Launch App command that runs external .exe that activates MoI and starts import operation.
So if nothing selected I see message(no file to save) than MoI activates and imports nothing.


This tool have to work this way if nothing is selected it will show dialog - Nothing is selected and than cancel current composite tool.
Title: Re: Samardac Bridges.
Post by: IStonia on December 16, 2015, 10:46:18 am
Try this
http://www.digitalfossils.com/Download/NVil-Dec-16-15.rar
Title: Re: Samardac Bridges.
Post by: IStonia on December 16, 2015, 10:47:03 am
vws supported.
http://www.digitalfossils.com/Download/NVil-Dec-16-15.rar
Title: Re: Samardac Bridges.
Post by: samardac on December 16, 2015, 11:26:54 am
Works perfectly!!!! :) Now I can export to MoI in perfect way only 3 strings in my script... it is awaysome.

Can you make the same tool for load:
P_Load ; Dir(string)  ; new(boolean)

Dir - Path
New - New project. If it is true, It will work absolutely like New Scene command. So if there is something in scene it will ask to save it.
Title: Re: Samardac Bridges.
Post by: IStonia on December 18, 2015, 10:34:56 am
http://www.digitalfossils.com/Download/NVil-Dec-17-15.rar
Edit > Customize > Tools > Common Modeling Tools > P_LoadFromFile.