On 23/08/2014 at 18:17, xxxxxxxx wrote:
hi everyone
I begin to study, and python is still two months
I made a script for the first time
I made the script which displayed the points equally
In fact, only the point that you chose wants to make a script to display equally, do you know it?
Thank you for keeping company at poor English
import c4d
def PointModify(obj) :
pts = obj.GetAllPoints()
lisx = []
for c1 in xrange(op.GetPointCount()) :
lisx.append(obj.GetPoint(c1).x)
mx = max(lisx) #find max x position
nx = min(lisx) #find mini x position
bunbo = len(lisx)
for c in xrange(op.GetPointCount()) :
pts[c].x = ((bunbo -1 - c)*nx + c*mx)/(bunbo-1) #internally divide
obj.SetAllPoints(pts)
obj[c4d.SPLINEOBJECT_TYPE] = c4d.SPLINEOBJECT_TYPE_LINEAR
obj.Message(c4d.MSG_UPDATE)
if __name__=='__main__':
PointModify(op)
c4d.EventAdd()