detach as clone


#1

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!!


#2

Can someone help me? my friend


#3

:sweat:


#4

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 ()

#5

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.


#6
gif

UOUktEKa56

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


#7

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


#8

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

gif

bZye6pOb4l

(	
	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] 
)

#9

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


#10

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


#11


#12

I recorded a GIF for you.


#13

this?

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

#14

–Select $whatever

macros.run “Modifiers” “Volumeselect”

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

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


#15

Your one has no effect on the plane.


#16

I don’t understand you


#17

:roll_eyes:
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.

gif

CYuCR3hhlQ


#18

I have a plane and an extruded polygon.


#19

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…


#20

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