Mesh Attach Question

For example I have a lot of meshes named "left" - left001, left002, left003.... left 099. And the same number of meshes called "right", from 001 to 099. (All meshes have modifiers). And I want to mesh-attach them in pair according the index - left001 with right001, left002 with right002... etc. How should I do this?

Comments

Comment viewing options

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

`

try something like this:

(
	a_From = 1
	a_To = 99
 
	a_basename1 ="left"
	a_basename2 ="right"
 
	a_resultname ="left-right"
 
	for i = a_From to a_To do (
		local n3d = (formattedPrint i format:"03d")
		a1 = getnodebyname (a_basename1 + n3d)
		a2 = getnodebyname (a_basename2 + n3d )
		if a1 != undefined and a2 != undefined do (
			convertToMesh a1
			attach a1 a2
			--meshop.attach a1 a2 targetNode:a1
			a1.name = a_resultname + n3d
		)
	)
)
chooj's picture

thanx

Thanx, I'll try this code! And what if the nunber of meshes is different every time? Sometimes it's 025, and sometimes it's 125?

pixamoon's picture

`

just change a a_To = 125 or maximum

code also recognize no pair - and will skip that object

so if you change a_To = 999 - it should attach all found left and right pairs till 999

hope this makes sense

chooj's picture

yes

Yes! Its working! Thanx again. But I've changed mesh-attach to poly-attach bacause of strange issue with normals, one of the objects was flipped every time. Now working fine!

pixamoon's picture

`

Coool. I'm glad it helped :)

Pixamoon

chooj's picture

Many thanx

Many thanx, will try this today!

Comment viewing options

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