Open All groups (and sub-groups)

Hi everybody!

I need to create a script to simplify my work. I need to open all groups in the scene, but it means all sub-groups too (groups inside antoher group). Something like a loop in the command "Select All" and "Group Open", until open all groups, that's what I'm doing manually.
To close is simple, one time command, but to open...
I don't know script, my only experience are recording actions and create scripts with it. Very, very, very basic...

Can anyone help me?

Regards,

Caetano Brasil

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pfbelesa's picture

open - modify internal object than close

Hi i have a problem that maybe this open/close groups can help me.
I got a VERY big set of groups of wide flange shapes with extrusion on my scene, all of them grouped together in groups of 4 to 12 wide flanges, but because my camera is VERY far from those objects they got invisible on the final render so i need to forcely change their sizes.

how could i add to this script a funcion or action to open all groups and set new size to all wide flange shapes?

thanks in advance

barigazy's picture

...

You not need to open all groups to change Extrude modifier value.
Select all objects ei. groups where want to change extrude mod amout and run this code.

fn changeExtrudeValue value:0 = if selection.count > 0 do
(
	modifier = #()
	for o in selection where canConvertTo o Editable_mesh and o.modifiers.count > 0 do
	(
		join modifier (getClassInstances Extrude target:o)
	)
	if (modifier = makeUniqueArray modifier).count > 0 do for m in modifier do m.amount = value
)
-- change only value number below
changeExtrudeValue value:20

bga

le1setreter's picture

get it here:

Great idea ... reminds me on a discussion we had here some time ago...

Anyway, i took the code from "Swordslayer" and made a macro of this. Hope you are ok with that Swordslayer.

http://www.scriptspot.com/3ds-max/scripts/openclose-allselected-groups

AttachmentSize
openclose-groups_v01.zip 572 bytes
barigazy's picture

ungroupAll

To ungroup all scene groups here is a little snippet

groups = for o in helpers where isGroupHead o collect o
while groups.count > 0 do
(
	ungroup groups[groups.count] ; groups.count = groups.count-1
)

bga

crystal3d's picture

hello all,

i did also benefit from this script and i like it, just that it opens the hidden groups aswell.

is it simple to convert it to "operate only on selected groups"?

caebrasil's picture

Hi,

Sorry for my poor English, maybe I don't explained very well: I don't want to ungroup, just open groups, in all levels (groups inside another groups). But I need to maintain my actual group structure.

@Swordslayer, when I create a script with your command, I receive a error message:

 -- Error occurred in anonymous codeblock; filename: S:\3DSMAX\- BASE\usermacros\Open ALL Groups.mcr; position: 104; line: 6

>> MAXScript MacroScript Compile - S:\3DSMAX\- BASE\usermacros\Open ALL Groups.mcr, offset 104; Exception: -- Syntax error: at function, expected (

--  In line: fn u <<

Problably I'm doing something wrong creating the script?

@Anubis, thank you! But, as I say, I can't lost my groups structure...

Thank you very much for your attention, guys!

duckylock's picture

Here is the simple function...

Here is a simple function to do what you need.

Voici une fonction simple pour faire ce que tu veux.

--create function named openGroups with a parameter (objects to check)
function openGroups mySelection = 
(
	--loop into selected object
	for obj = mySelection do
	(
		--to find group end open it
		if isGroupHead obj then setGroupOpen obj true
	)
)
--run this function with the current selection as parameter
openGroups $selection
Swordslayer's picture

Okay, just make a new script,

Okay, just make a new script, copy-paste what I first sent there, change "setGroupOpen o false" to "setGroupOpen o true" and either comment out or delete the line "ungroup o". Hit CTRL+E. Then it should work.

caebrasil's picture

PERFECT! Thank you!

PERFECT!

Thank you!

Anubis's picture

or just with one command

explodeGroup objects

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.