View Full Version : Access to collapse utility

02 February 2009, 02:41 PM

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

02 February 2009, 03:53 PM
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!


02 February 2009, 07:24 PM
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

02 February 2009, 07:48 PM
I stand corrected!


02 February 2009, 08:52 PM
Richard knows one thing more than the devil! :D

- Enrico

02 February 2009, 09:05 PM
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?

02 February 2009, 09:17 PM
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.


02 February 2009, 09:22 PM
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.

02 February 2009, 05:01 PM
Yep... the vertex normals is the actuall problem.
Thanks Richard, I will have a look on the staff you showed.

Thank you

CGTalk Moderation
02 February 2009, 05:01 PM
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.