detach as clone


Hello,I want to ask a question,

gmod=modPanel.getCurrentObject ()
gmod.selectByMaterialClear = true
gmod.selectByMaterialID = 2-1
gmod.SetOperation #SelectByMaterial
gmod.DetachToObject #Detachname ----Detach code, I want to know how to change it to detach as clone

How can he use this detach as clone form? Does anyone know? thank you!!


Can someone help me? my friend




you could just modify a bit the code printed in the listener for it to work

$.modifiers[#Edit_Poly].ButtonOp #CloneFace
$.modifiers[#Edit_Poly].SetOperation #Transform
$.modifiers[#Edit_Poly].MoveSelection  [0,0,0] 
$.modifiers[#Edit_Poly].Commit ()


First of all, thank you for your reply. I tested your code and the result was wrong. It did not Detach and clone any selected faces.



Maybe you have to switch to certain selection mode like face or element.


I tested it again and understood the cause of the error. I chose the face by ID,Thank you again for your reply, this is not the result I want


In your case selection didn’t happen and thats why it didn’t work



	gmod = modPanel.getCurrentObject()
	gmod.selectByMaterialID = 1 -- zero based
	gmod.ButtonOp #SelectByMaterial
	gmod.ButtonOp #CloneFace
	-- gmod.SetOperation #Transform -- if you don't need to move cloned faces it can safely be commented out
	-- gmod.MoveSelection  [50,0,0] 


I can’t operate by element, because I want to delete the original object after it detach.


I guess there’s some contradiction present in what you want to achieve.



I recorded a GIF for you.



	subObjectLevel = 4
	gmod = modPanel.getCurrentObject()
	gmod.selectByMaterialID = 1 -- zero based
	gmod.ButtonOp #SelectByMaterial
	gmod.ButtonOp #DetachFace	


–Select $whatever “Modifiers” “Volumeselect”

$.modifiers[#Vol__Select].volume = 5
$.modifiers[#Vol__Select].level = 2
–$.modifiers[#Vol__Select].matID = 1 --default

$.modifiers[#Vol__Select].invert = on “Modifiers” “DeleteMesh”


Your one has no effect on the plane.


I don’t understand you


I could of course post another gif with a plane and extruded polygon showing that it works as expected, but I it doesn’t make any difference. No matter what kind of mesh you provide as long as it has applied edit poly mod it should work as you want it to in the first post. Hope you get your way through all other corner cases which may exist.




I have a plane and an extruded polygon.


Generate Mat IDs in Extrude mod.
Why do you doing this in MaxScript anyway?
You can’t skip learning Max.
Many still trying that, though…


Thank you everyone. Thank you very much.The right code is still not found.