inset code is not working

i made this code
but that is not work ~~~
pls what problem ?
today sorry too ~

for i in selection as array do
(
convertTopoly i
subobjectLevel = 4
topFaces = #{}
gfc = if isKindOf i Editable_Poly then polyop.getFaceCenter else meshop.getFaceCenter

for f = 1 to i.numfaces do
(
if (gfc i f).z == i.max.z do append topFaces f

)
i.EditablePoly.SetSelection #face topFaces

i.insetType = 1
i.insetAmount = 200
i.EditablePoly.buttonOp #Inset
i.faceExtrudeHeight = -600
i.EditablePoly.buttonOp #Extrude

clearSelection()
)

Comments

Comment viewing options

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

.

(
	selObjsArr = selection as array
	for i in selObjsArr do
	(
		select i
		if classOf i != editable_poly do convertToPoly i
		subobjectLevel = 4
		topFaces = #{}
		gfc = polyop.getFaceCenter
 
		for f = 1 to i.numfaces do
		(
			if (gfc i f).z == i.max.z do append topFaces f
		)
 
		polyop.setFaceSelection i topFaces
 
		i.insetType = 1
		i.insetAmount = 200
		i.EditablePoly.buttonOp #Inset
 
		i.extrusionType = 0
		i.faceExtrudeHeight = -600
		i.EditablePoly.buttonOp #Extrude
 
		clearSelection()
	)
)
dussla's picture

thank you for reply , but that is not work still

thank you miauu
i tested this code~
but that is not work still ~

but
max modify mode is work
but in many object , that is very slow

is there good idea ?

jahman's picture

.

Check this example. It doesn't require modify mode to be active

selectedFaces = polyop.getFaceSelection $
 
-- Inset
$.EditablePoly.SetSelection #Face selectedFaces
$.extrusionType = 2 --by polygon
polyop.extrudeFaces $ selectedFaces 0.0
$.outlineAmount = -10
$.EditablePoly.Outline()
 
-- Extrude
polyop.extrudeFaces $ selectedFaces -5.0
 
redrawViews()
dussla's picture

perpect good speed

thank you for good code~~
really really fast~

Comment viewing options

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