Thursday, August 27, 2009

Deforming a polyline


import py2rhino as p2r

p1 = (0,10,0)
p2 = (-10,0,0)
p3 = (10,0,0)
p4 = (0,-10,0)

v1 = (-2,0,2)
v2 = (0,0,2)
v3 = (0,0,2)
v4 = (2,0,2)

lines = []

for counter in range(10):

line = p2r.obj.Polyline.create( (p1,p2,p3,p4) )
lines.append(line)

#p1 = (p1[0] + v1[0], p1[1] + v1[1], p1[2] + v1[2])
p1 = p2r.util.vector.add(p1, v1)
p2 = p2r.util.vector.add(p2, v2)
p3 = p2r.util.vector.add(p3, v3)
p4 = p2r.util.vector.add(p4, v4)

#now do something with your lines

print "done"

No comments:

Post a Comment