Access to collapse utility



simple question… how can I use the Collapse available in the Utilities Tab in my script?
How can I assess that? Maxscript Listener does not print anything when I use it tool and I was not able to find it in the help either. I need to make a script that collapses certain groups of objects and I can’t use attach… it creates some artefacts on CAD objects while Collapse works fine.

Thank you


Hi Martin,

I may be wrong but I’m pretty sure that you can’t. I would like to be shown to be wrong though!



should be some equivalent in code somewhere… but here’s how you could access it via UI commands:

-- open the Collapse utility
UtilityPanel.OpenUtility collapse

-- get UI elements
children = windows.getChildrenHWND (windows.getDesktopHWND())

-- get the "Collapse Selected" button
collapseButton = (for c in children where ( c[5] == "Collapse Selected" ) collect ( c ))[1]

-- your loop-and-selection code goes here
-- after selecting, press the button
UIAccessor.pressButton collapseButton[1]

-- done


I stand corrected!



Richard knows one thing more than the devil! :smiley:

  • Enrico


I still think there’s a proper code route, but I can’t find a thing.

Have you been using the standard Attach() function - and if so, have you considered meshop.attach() / polyop.attach()?
( make sure you disable the undo system when performing these commands, especially in a loop, to boost speed )

What are the problems you are seeing, specifically?


The Edit/Editable object commands (Attach, Detach, etc) invalidate vertex normal information, when dealing with CAD data this is a serious issue. The Collapse utility is the only way to combine objects and retain vertex normal information. I have searched high and low, and AFAIK there is no maxscript access to the Collapse Utility.



ahhh… -that’s- what the problem is :o


Okay, then… yep, use the functionality provided above… probably not as efficient as proper code would have been, but it’ll get the job done.


Yep… the vertex normals is the actuall problem.
Thanks Richard, I will have a look on the staff you showed.

Thank you


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.