face move script error
i made this script
this is script for moving face with 3 vertex
there is error
pls see attacef file
lastvetx = #()
curO = selection[1]
aFaces = (polyOp.getFaceSelection curO) as array
for selFaceBA in aFaces do
(
vertPos1 = polyop.getVertsUsingFace curO selFaceBA
vertPos = vertPos1 as array
vertPosArr = for v in vertPos1 collect (polyOp.getVert curO v).z
vertZmax = amax vertPosArr
topVertIdx = 0
for f = 1 to vertPos.count do
(
uuu = polyop.getvert curO vertPos[f]
vZpos = uuu.z
if vZpos == vertZmax do
(
topVertIdx = vertPos[f]
arraynum= f
)
)
for f = 1 to vertPos.count do
(
if ( (polyop.getvert curO vertPos[f]).z) < (polyop.getvert curO topVertIdx).z do append lastvetx (polyop.getvert curO vertPos[f])
)
ver_center = ((lastvetx[1]) + (lastvetx[2]))/2
nnnx = (polyop.getvert curO topVertIdx).x - ver_center.x
nnny = (polyop.getvert curO topVertIdx).y - ver_center.y
newver = [ver_center.x,ver_center.y,(polyop.getvert curO topVertIdx).z]
polyop.setVert curO vertPos[arraynum] newver
topVertIdx = 0
)
Attachment | Size |
---|---|
face_align.max | 228 KB |
Comments
.
what's the end purpose of the script that you're trying to make?
moving the topmost vertex in face to an average z value of the other two verts?
ps. It is a good idea to give script variables meaningful names.
'vert_position' instead of 'uuu' looks much better to anyone who will have to read your script (even you after a week won't remember what this variable is used for).
;)
..
thank you jahman
very simple , you are genius always
this script purpose :
moving the topmost vertex in face to an average z value of the other two verts?
yes right
for roof style modification
thank you for good advice
i will use good name ~~
really thank you again~