ScriptSpot

Forum topic · General Scripting

inset code is not working

By dussla · 2018-04-19

Description

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

.

miauu · 2018-04-19


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

thank you for reply , but that is not work still

dussla · 2018-04-19

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 · 2018-04-19

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

perpect good speed

dussla · 2018-04-20

thank you for good code~~
really really fast~