Notifications
Clear all

[Closed] meshop.attach condenseMat syntax

hi!

i’m struggling to understand the meshop syntax, i do not want to condense materials or do anything to material ID’s as i’m attaching, but i can’t seem to get this right

the syntax :


    meshop.attach $box01 $box02 attachMat:#IDToMat \
    condenseMat:true deleteSourceNode:false

…and one of my shots in the dark :


for i = 2 to nodes.count do
(
    meshop.attach nodes[1] nodes[i] condenseMat:false
)

any tips for a struggler?

14 Replies

almost


    meshop.attach nodes[1] nodes[i] attachMat:#neither

it’s messing up ID’s and condensing materials, aaarhhh…

any ideas?

i thought i found a workaround by using


    convertTo nodes[1] PolyMeshObject
    nodes[1].EditablePoly.attach nodes[2] nodes[1]

this leaves ID’s and materials alone, but is not an option as convertTo screws up the mesh

is there a way at all to use meshop.attach and still have ID’s and materials intact?

hi Jon,
while back I struggled with the very same problem ( http://forums.cgsociety.org/showthread.php?f=98&t=717531 ). I think it was with max2008 and I never got it to work. Sorry I can’t help you but at least you know you are not alone…

hi Lena! and thanks for replying, it helps a lot to know that i’m not the only one with issues.
not sure how i missed your thread on this, i guess it was getting late. thanks for the link, you describe a lot better the exact same issues i’m running into.

strange thing is, as you say, that hitting attach/attach list from the edit mesh interface works fine, so there should be a way to replicate this in maxscript?

i’m no script master, i think there’s something with my syntax, would be great if someone could confirm


meshop.attach $Plane01 $Plane02 attachMat:#neither condenseMat:false
-- #neither, #IDToMat, #MatToID makes no difference

i’m feeling adventurous today so i might try to enter max modify mode and try to feed a selection to meshOps.startAttach or something, wonder if that could work?

btw, your picasso piece is great!

the following script retains the material id of the faces but not the material. you will have to use the “select id” button and reapply the material :sad:, maybe there’s is a way to get the material assigned to a material id (i dunno yet!)

select 2 objects with different materials id’s and execute the script. and check if the material ids remain the same (the material will not though)

(
 
 	if selection.count==2 then
 	(
 		Obj1 = selection[1]
 		Obj2 = selection[2]
 		numFacesObj1 = getnumfaces Obj1
 		numFacesObj2 = getnumfaces Obj2
 		
 		mIDo1 = #() -- Stores the Faces for each Material ID of Object 1
 		mIDo2 = #() -- Stores the Faces for each Material ID of Object 2
 		
 		mIDc1 = #() -- Unique Material Id For Object 1
 		mIDc2 = #() -- Unique Material Id For Object 2
 		
 		for i = 1 to numFacesObj1 do
 		(
 			theMatId = getfacematid Obj1 i
 			flag = 1
 			for j = 1 to mIDc1.count do
 			(
 				if (mIDc1[j] == theMatId) do
 				(
 					flag = 0
 					exit
 				)
 			)
 			if flag == 1 do
 			(
 				mIDc1[mIDc1.count+1] = theMatId
 				mIDo1[theMatId] = #{}
 			)
 			append mIDo1[theMatId] i
 		)
 		
 		for i = 1 to numFacesObj2 do
 		(
 			theMatId = getfacematid Obj2 i
 			flag = 1
 			for j = 1 to mIDc2.count do
 			(
 				if (mIDc2[j] == theMatId) do
 				(
 					flag = 0
 					exit
 				)
 			)
 			if flag == 1 do
 			(
 				mIDc2[mIDc2.count+1] = theMatId
 				mIDo2[theMatId] = #{}
 			)
 			append mIDo2[theMatId] (i+numFacesObj1)
 		)	
 		
 		meshop.attach Obj1 Obj2
 		
 		for i = 1 to mIDc1.count do
 		(
 			theArray = mIDo1[mIDc1[i]] as array
 			for j = 1 to theArray.count do
 				setfacematid Obj1 theArray[j] mIDc1[i]
 		)
 		
 		for i = 1 to mIDc2.count do
 		(
 			theArray = mIDo2[mIDc2[i]] as array
 			for j = 1 to theArray.count do
 				setfacematid Obj1 theArray[j] mIDc2[i]
 		)	
 	)
 	else
 		print "Error : Select 2 objects !!"
 )
 

best of luck !
cheers

fantastic! thank you HornBerger!

that the material id’s are condensed does not matter so much, i can always store that multisub and reapply it. but if the original face id’s are intact…i am golden!

let me digest some food, and i’m off to work to check this out! thanks!

doublepost

Page 1 / 2