Notifications
Clear all

[Closed] Function to merge meshes

Hi all,

I’m trying to create a function that will merge a number of meshes I pass to it.

What I’m stuck with is working out how the function works out how many meshes it has been passed?

So below I am saying the minimum is 2 objects that it needs to be passed


				fn objectmerge object1 object2 object3:  =
				
				(
				convertTo object1 Editable_Poly
				convertTo object2 Editable_Poly
				convertTo object3 Editable_Poly
								
				polyop.attach object1 object2 object3
				)

Any help appreciated!

3 Replies

clusterAttach

	fn clusterAttach objArr =
	(
		j = 1;
		count = objArr.count;
		undo off
		(
			while objArr.count > 1 do
			(				
				if classof objArr[j] != Editable_Poly then 
					converttopoly objArr[j];
					
				polyop.attach objArr[j] objArr[j+1];
				deleteItem objArr (j+1);
					
				j += 1;
				if (j + 1) > objArr.count then
					j = 1;
			)
		)
		return objArr[1];
	)

hi!

I thought you might be interested in reading this post:

http://forums.cgsociety.org/showthread.php?t=922140&referrerid=261675

Awesome thanks! Very helpful link too, much appreciated!