Hi!
Is there a script which convert meshes in a scene to a single mesh based on their material. For example I have 100 meshes with 5 materials assigned, as a result I should have 5 meshes.
Thanks in advance!
Forum topic · Scripts Wanted
By Chumazik · 2009-07-24
Hi!
Is there a script which convert meshes in a scene to a single mesh based on their material. For example I have 100 meshes with 5 materials assigned, as a result I should have 5 meshes.
Thanks in advance!
Chumazik · 2009-07-26
Hi Anibus,
Sorry if I seemed to be demanding! Didn't mean to. It is always possible to convert primitives to meshes in a few cliks.
But anyway thanks a lot for your time! You saved a lot of mine!
Best regards!
Anubis · 2009-07-25
well, the script is updated
Anubis · 2009-07-25
Yes, according to your request I wrote the script for meshes only.
Okay, I am here in 40 C (104 F) heat and try to work :) ...
but I'll modified the script for you, maybe soon ...
At the moment you can use snapshot tool to convert your objects to mesh ;)
Chumazik · 2009-07-25
Update:
Oh, I have found why it didn't work. I tested the script with simple boxes, but it handles only editable meshes. Maybe there is a point to make it work with primitives as well.
And again thanks a lot!
Chumazik · 2009-07-25
Hi, Anubis!
Thank you very much for attention!
While testing your script I always get the warning message - No meshes with material in selection! Tested in 3DS Max Design 2009 SP1.
Anubis · 2009-07-24
I am not sure if there are similar so I wrote a script from scratch.
(
mtl = #() ; tmp = #() ; fin = #()
sel = selection as array
if sel.count > 0 do -- filter selection
sel = for i in sel where classOf i == Editable_mesh \
and i.material != undefined collect i
if sel.count == 0 then
messageBox "Selection is empty!" title:"Attach Mesh by Material"
else
(
for i in sel do
appendIfUnique mtl i.material
for m in mtl do
(
tmp = for i in sel where i.material == m collect i
append fin tmp
)
undo on
(
for i in fin do
(
trg = i[1]
deleteItem i 1
for j in i do
meshop.attach trg j attachMat:#IDToMat condenseMat:true
)
)
)
)
I hope this help
(p.s. - script works also with Multi/Sub-Object materials)
[EDIT] Ultimately I changed the code slightly and upload the script here:
http://www.scriptspot.com/3ds-max/attach-mesh-by-material