technical architecture.

by on Mar.16, 2009, under Batching, maxscript

Here’s partial results from last nights maxscript silliness.

QuickCollapse is a maxscript Struct with a few functions to speed up collapsing large numbers of objects, it provides feedback in the listener window so you can see progress as it goes.

Run script will trigger ‘CollapseSelected’ on your current selection. there isn’t much Error Checking involved, so filter your selection for meshes, and remeber that it SHUTS UNDO OFF for the collapse so that we dont have RAM overruns on large objectsets, so save/hold first eh?


EDIT 2013: Here’s an update with UI and a few other useful mesh cleanup functions: DOWNLOAD

17 Comments for this entry

  • Shawn

    Is there supposed to be a readout screen while this is running?

    I’m totally new to this, so forgive me if this is a dumb question. But I’m looking through the script and it seems like there’s a % done type thing. But when I run the script it doesn’t show anything?

  • Shawn

    Okay, sorry, I already figured it out — The Listener.

    Thanks, this script is exactly what I was looking for.

  • Shawn

    Sorry, another question.

    I was looking through the script and was wondering if there is a way for me to change it to Collapse w/ boolean union? Like in the Collapse utility?

  • Dave Buchhofer

    Sure that could be done, i believe the only change would be instead of meshop.attach, it would be mesh1 + mesh2

    can’t really test it out from home, but give it a try and let me know if it works!

    from the help:
    mesh + mesh — union
    mesh – mesh — difference
    mesh * mesh — intersection

  • Shawn

    hmm, the quickcollapse union doesn’t seem to have any changes? I’m trying to figure the syntax. I see the mesg + mesh your talking about and the meshop.attach. I just haven’t figured out how to replace it…

  • Shawn

    Got it.

    Thanks, you’ve been a big help! It does work.

    ( b + arr[i] ) instead of ( meshop.attach b arr[i] )

    Thanks again!

  • Shawn

    Strange, after running this script, I can’t save. It keeps freezing when I try to save. This last time I fiddled with the object a bit before trying to save. The fiddling went fine? I did notice, that the objects were not deleted, I had 1000 spheres to start, then at the end I still had those thousand spheres + like 32 objects(from the first pass) and another like 9 objects, and then the one big one. I tried deleting the other objects and I have what I want – just can’t save it ??

  • Dave Buchhofer

    that’s a new one to me, I’ve yet to run into any issues saving. I haven’t had a change to try out the union version though, maybe you can sidestep the issue by exporting instead? or possibly try the Reset Xform, Convert to Mesh tricks.

  • Shawn

    Okay, it was a personal problem 🙂

    It was trying to save through the network instead of directly to the hard drive.

    Everything looks to work perfectly – now if I can figure out what to add to delete all the originals automatically.


  • BruceLeroy

    Just ran this script with Max2010 and got an error. It’s opening the script in the editor and highlighting the line “meshop.attach b arr[index]” Any ideas?
    Is it possible to modify your script to automatically go through a max file and automatically collapse by layer? It would make the transition between Revit and Max a little less painful.

  • Dave Buchhofer

    Bruce, hi, yea, that was exactly the impetus for making it, This is the ‘generic’ library that i load into various other scripts, my collapse by layer script simply selects all objects on a layer, then runs this!

    I’ve found most of the errors that pop up are due to the lack of error checking for various things that aren’t easily collapsed to Editable Meshes, Dummys, Cameras, helpers, group heads, etc.

    I’ve since expanded this to an interface with various other helper scripts for general mesh cleanup (Weld all, Delete isolated verts, collapse to individual meshes, collapse to 1 mesh, collapse by layer, etc.)

    Someday soon I hope to clean it up and package it somewhat. I really only haven’t thus far since it includes a few parts of other peoples useful scripts and i haven’t taken the time to check with them yet.

  • Dave Buchhofer

    an eaaasy/quick way to filter out the un-collapseable objects, is to shut them off by category with the Display Floater

  • BruceLeroy

    Dave, thanks so much for the quick response. I got caught up in a project and only just now had the opportunity to check back. So I’m getting the error ’cause I’ve got non-collapsible elements selected – makes sense. Does that include those invisible objects that come in when you import a model from Revit? Is that what you mean by group heads? My process now is to manually select by layer, run the collapse utility, then turn off the object and delete all the invisible stuff left over. Sounds like you’ve got this whole process w/ geometry cleaning already automated. I’d like to write a similar script but I’m just getting started with maxscript. Any tips would be greatly appreciated and thanks for all your help so far!

  • BruceLeroy

    My scene geometry is coming from Revit by way of DWG. Each object is written out as an Acad block and comes into 3dsMax as a mesh object linked to an empty parent object.
    I tried to filter my selection with both the display floater and the selection filter but both of them include the empty parent object and that’s what seems to cause the error. How do you work around this?

  • jinj

    hi, i want to use your script.. i’m a nurbs modeller and use body objects and nurbs.
    well could you add the ability to collapse such kind to their own kind instead to convert them to editable mesh?
    also how to collapse them all without to join or grouping them all?
    thank you and happy new year

  • Roland

    Hi Dave,

    You mentioned in one of your comments “expanded this to an interface with various other helper scripts for general mesh cleanup (Weld all, Delete isolated verts, collapse to individual meshes, collapse to 1 mesh, collapse by layer, etc.)”

    Will you be releasing this script any time soon?
    As it will be a life saver on a project I’m working on at the moment.

  • Dave Buchhofer

    Hi Roland, I never did end up packaging that up for wide public consumption, mostly since it is missing a few simple things like multisub material support for collapses, but it’s still helpful here: DOWNLOAD LINK

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!