# Average vertices in z axis

I have multiple vertices to move at a certain height on the Z axis, and I'm looking for a fast way

http://s16.postimg.org/env48kb45/00000000.jpg

thankyou very much

AttachmentSize
00000000.jpg136.67 KB

## Comment viewing options ### thank for comment

thank for comment

i want to do facade/skin design,It can be Measure

and i must to do drawing (autocad)

i just want to average vertices in my curve
1.set height of top vertex
2.set height of base vertex
3.average vertices between base-top

i don't know how to do , method to do
i can do one by one, first i must be divide height and set height all vertices by my hand

It's my thesis, Faculty of architecture

Sorry, I'm not fluent in Enlish,but I will try my best explaining to you.

thank for help ### `

Oki,

I think this should work:

```(
local len = 0,
startPos = (getKnotPoint \$ 1 1),
endPos = (getKnotPoint \$ 1 (numKnots \$ 1)),
zDiff = endPos.z - startPos.z,
distFromStart = 0

---- get lenght of Z flatten spline
for k = 2 to numKnots \$ 1 do
(
knt0 = (getKnotPoint \$ 1 (k-1))
knt1 = getKnotPoint \$ 1 k
len += (distance [knt0.x, knt0.y, 0] [knt1.x, knt1.y, 0])
)

-- calculate and set avarage vert z axis pos
for k = 2 to (numKnots \$ 1) - 1 do
(
knt0 = (getKnotPoint \$ 1 (k-1))
knt1 = getKnotPoint \$ 1 k

distFromStart += distance [knt0.x, knt0.y, 0] [knt1.x, knt1.y, 0]

newPos = [knt1.x, knt1.y, (startPos.z + (distFromStart/len * zDiff))]

setKnotPoint \$ 1 k newPos
)
)```

It works only if you select single spline and run script.
Cheers,
Pixamoon

AttachmentSize
average_vertices_in_z_axis.ms 994 bytes ### re: heights

hi,

I'm not sure how you want to specify heights

Just with CurveControl or read values from txt/csv file ?