ScriptSpot home

Script

Detach by Material ID

By Jeff Lim · 2006-10-21

Community compatibilityNo compatibility reports yet

No reports yet for the available releases.

Community reviewsNo reviews yet.
Version
2
3ds Max compatibility
See listing claims below
How compatibility works

Choose the 3ds Max version you use. For example, selecting 2020 puts direct matches for 2020 first, followed by listings that say a supported version or newer.

Scripts that only mention an older version can still appear as “2020 unconfirmed.” Listings that rule out 2020 are excluded. Use “Show scripts with unconfirmed compatibility” to also see listings without a clear match.

Community reports show what worked for members on a specific release. They’re separate from the listing’s compatibility claims and don’t change the filter.

From original requirements
9
Original version requirement
3ds Max 9
Date updated
2008-12-09
Legacy votes
38

Downloads

  • Version 2Listed version

    Listing updated

Tags: Materials, detach, id

Description

Detach Polygons based on its Material ID

Additional Info

Features
  • works on a selection of objects
  • options to automatically name detached objects
  • material propagation
    • this will assign a corresponding material by id to the detached object
Usage
  1. select any number of objects
  2. set the desired paramteters
  3. optional: if you know the maximun number of ids the object has, set the Max IDs to help speed up detachment.
  4. press detach

Internal Operations
Procedure:
  • object[s] is/are copied
  • then collapsed to an editable poly
  • faces are finally detached by material ID

Naming:
  • Numbered
    • will creae numbered names
    • e.g. 0,1,2,3
    • preferable to use with the Prefix option checked
  • Bitmap Name
    • if not diffuse bitmap found, it will use the material name
    • if no material applied, it will use the object's name
  • Material Name
    • if no material applied, it will use the object's name
  • Object Name
    • will create a unique name based on the object's name

More by Jeff Lim

View all contributions
Comments (23)

Comment policy

psh19989

Script Change

We want to change to mesh instead of poly when we run the script. How should I change it? We want the noodles to be mesh.

Reply to psh19989
harumscarum

EditableMesh output would be great!

Could anyone adjust it to have EditableMesh as output objects?

abdelhamead rasslan

This script saves lifes thanks for the effort !

chew

a lot of errors

-- Error occurred in i loop; filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4358; line: 159
-- Frame:
-- theDetachedObj: $rug020
-- the_faces: #{1..114}
-- i: 1
-- called in obj loop; filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4471; line: 163
-- Frame:
-- the_orig: $rug18
-- the_mat: rug3:Standard
-- id_count: 7
-- obj: $rug18
-- Error occurred in detach_bot.pressed(); filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4553; line: 166
-- Frame:
-- the_sel: #($wassily_chair05, $wassily_chair04, $wassily_chair03, $coffee cups15, $coffee_table03, $rug18, $coffee_table05, $magazine_face_down01)
>> MAXScript Rollout Handler Exception:
-- Unable to convert: ReferenceTarget:Texmaps to type: Material <<
-- Error occurred in i loop; filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4358; line: 159
-- Frame:
-- theDetachedObj: $Maps001
-- the_faces: #{1..17214}
-- i: 1
-- called in obj loop; filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4471; line: 163
-- Frame:
-- the_orig: $cushion22
-- the_mat: farbric:Standard
-- id_count: 7
-- obj: $cushion22
-- called in detach_bot.pressed(); filename: C:\Users\XXX\Desktop\SCRIPTS\DETACH_BY_MATERIAL_ID\detachbyID.ms; position: 4553; line: 166
-- Frame:
-- the_sel: #($cushion22, $cushion08, $ceramic_bowl1, $cushion20, $sofa_right, $cushion11, $sofa_long_right06, $sofa_long_right04, $cushion12, $cushion21, $cushion13, $sofa_right01, $cushion14, $coffee_table01, $apples02, $ceramic_bowl02, $wooden_bowl02, $coffee_table, $apples01, $wooden_bowl1, ...)
>> MAXScript Rollout Handler Exception:
-- Unable to convert: ReferenceTarget:Texmaps to type: Material <<

Wilalbert Gomez

The best script ever to import "bad" clients sketchup models

This script is a life saver for that kind of models which comes all in one single layer. But the client toke the time to insert some materials definitions on it...

Really great man!, you save my morning!

harumscarum

request

would be great to have an option to detach by material ID to EditablePoly elements (not new objects) - separate macros without UI

thank you in advance

backflipbedlem

Random bitmap name

Great script dude,
But when tick the use bitmap name option, it saves it with a random bitmap name, not one that corresponds to the object!

Any ideas how to fix????

asymptote

This is great, but freaks out and throws up an error when one of the selected objects has only a single id and cannot be detached.
Can this be easily fixed ?

mmaitland

Very Cool, wish it had one thing though

Very Nice!! I wish it had an option to group the objects after it blows them apart, or at least have all of the objects selected that it tweaked. Thank you for the script!

crystal3d

thanks for this script but...

it gave this error when trying it on a bunch of vray materialed objects...

Reply to crystal3d
crystal3d

i think it errors when

one of the selected objects had no multiple materials applied so have to choose the objects carefully!:)

jsrocha

doesn´t work for me

Hey man, the script doesn´t work for me. I´m using max2009, and when i click the detach button, nothing happens....
is a pity, because it´s a very useful script.
Thanks,

Jsrocha

chalid

thanks bro.. this script is very useful..

Spacelord

Great work !!

Plus 1 to Titanes request :)
it would be handy to make each object end up with its separate material and not the multisub.

Reply to Spacelord
Jeff Lim

Thanks! I might need to test this again.. but I think that's what the "Propagate Materials" is for. :)

one808

O O O O
verygood ,thanks.^_^

subburb

Woaw ! simple and efficient... 5 ***** for this perfect script !

jerome Prévost (Subburb)

titane357

:-)

titane357

happy to see you're here !!!! :-)
Thanks again !
I will abuse : could it be possible to have each resulting separate object with right material applied ? (and not the multi subobject material ?)
For chrismas ? New year ? :-))

Reply to titane357
Jeff Lim

ok! somehow, i couldnt get myself to not update this script. merry christmas.

Jeff Lim

thanks, I'll try to look into the code again and see if i can make feasible adjustments. I can't promise an update anytime soon coz of busy schedules, my apologies.. :)

titane357

Great script, thanks !!!!
Last update 2005 is somebody strong enough to optimize it ? (a bit slow)