Notifications
Clear all

[Closed] Append Selection

Hey guys, Im hoping to find help with something very simple. I have something pre-selected and I want to be able to append the selection with the children of the selected object in maxscript. I tried using the max select child command, but it then deselects the parent!

Thanks!

7 Replies

selectMore $.children

OR

MyObject = $
selectMore MyObject.children

Thanks, that worked perfect! Now what about doing the opposite, now I just want to deselect the children.

I tried this

deselect $.children

But it throws me this error:

–Unknown property: “children” in $selection

Thanks again!

Hi there, try this:

parents=for i in selection where i.parent==undefined collect i 
select parents

I appreciate the help guys!

I was able to get this function working! One problem is it works on selected meshes and mesh parents, but it doesnt work on a group. It keeps saying:

– Unknown property: “position” in $selection

For some reason it doesnt like moving the group to 0,0,0. Would anyone know why this is?

fn DoExport exportsel = 
 	(
 		OldSelection = getCurrentSelection()
 		objList = getCurrentSelection()
 		exportsel = True
 		for p=1 to objList.count do
 		(
 			
 			exportName = MaxFilePath + "\\" + objList[p].name + "." + "ase"
 			select objList[p]
 			
 			OldPosition = $.Position
 			$.position = [0,0,0]
 			selectMore $.children
 			exportfile exportName #noPrompt selectedOnly:TRUE
 			select objList[p]
 			$.Position = OldPosition
 		
 			if (p == objList.count) then
 				select OldSelection		--reselect old selection
 		)
 	) 

There you go

theobjs=selection as array
for i in theobjs where classof(i)!=Dummy do
(
	i.position=[0,0,0]
)

Thanks again for the post Kameleon.

Im having a hard time integrating that into this script, also when I run this code straight on a group, it moves each object inside the group to 0,0,0. All I want to do is move the group itself, or I guess aka the Group Head.

Oh, sorry I didnt quite get it, but it’s almost the same script, all you have to do is change the != to == hehe, there you go.

theobjs=selection as array
for i in theobjs where classof(i)==Dummy do
(
	i.position=[0,0,0]
)