#356927
Hi Jeremy,

i was wondering if it could be possible to avoid creation of duplicate materials when extracting them from rhino models.

when i extract materials, eg. from sketchup/warehouse models, each object gets it's own material, like "color 20", "color 20 (2)", color 20 (3)", although the material they originate from is identical.

this sometimes creates hundreds of materials, which makes rhino/maxwell slow when selecting/assigning materials via the plugin's Material tab, and also makes it hard to navigate in there.

thnx,

Daniel
#356928
Could you please provide a specific model? The plugin does compare various aspects of materials in order to achieve what you are asking for -- if two materials are not identical according to these comparisons, though, then they must be considered as being unique. So I need to take a look at your model and see why this is the case.
#356938
Thanks, here's the problem: the model has that many materials assigned to its parts. During an export, or during Maxwell_ExtractMaterials with ExtractOnly, I can do comparisons and only consider materials which do not resemble one another. During Maxwell_ExtractMaterials with AssignToSourceObjects though, to do this would be to assign different materials to objects than the ones they have (or modify their materials). So I'll see what I can do about that.
#356946
Something along those lines -- Rhino has an internal material table, and it contains up to one material for each object in the model. Considering these two meshes:

Image

The materials of these two are located at index 64 and 65 in the Rhino material table -- if you select one of them and make its material blue, the other will still be red, even though they will both still be named "Color_A11". After looking further into the issue, I found the problem was that in Maxwell_ExtractMaterials AssignToSourceObjects, as the code updated the source (Rhino) material to simulate the appearance its newly-associated Maxwell material, this caused the comparison function to no longer consider them identical; changing the function slightly fixes this. So, in the next build, please check it again and let me know if it is working more to your liking, and if you find that the change has introduced any unforeseen issues (I believe it should work fine).

So, is this a known issue?