News:

 

Topic: Samardac Bridges.  (Read 5204 times)

0 Members and 1 Guest are viewing this topic.

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.

« Last Edit: February 02, 2015, 03:34:44 PM by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 287
  • Triangle
    • Portfolio
January 12, 2015, 11:59:51 AM
Right click on material gives you options to do this.

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.
« Last Edit: January 12, 2015, 12:17:58 PM by samardac »
Portfolio: www.samardac.com

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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
« Last Edit: January 12, 2015, 01:44:02 PM by samardac »
Portfolio: www.samardac.com

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.
Portfolio: www.samardac.com

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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
« Last Edit: January 12, 2015, 02:07:31 PM by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3311
  • Developer
  • Administrator
  • Polygon
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

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3311
  • Developer
  • Administrator
  • Polygon
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.

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.
« Last Edit: January 14, 2015, 02:35:04 PM by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3311
  • Developer
  • Administrator
  • Polygon
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()".

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3311
  • Developer
  • Administrator
  • Polygon
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?

  • Posts: 1695
  • Administrator
  • Polygon
    • http://samardac.com/
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.

« Last Edit: January 15, 2015, 09:48:16 AM by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3311
  • Developer
  • Administrator
  • Polygon
January 15, 2015, 09:58:15 AM
What is "gosub ActNVil"?