Hi,
I’m trying to create a random moving point using for loop but the script outputs always all the points in the same location although the print command says otherwise. If someone could explain why this is happening I’ll be thankful.
NB: in the attached gh file I created two examples in another way that makes the script work fine but my question here is why I have those messages in the panel that doesn’t match with the outputs?
import rhinoscriptsyntax as rs
import random as r
#initial point
pt = rs.AddPoint(0,0,0)
#point list creation
listPt = []
#if condition for button as seed
if toggle == False:
#initializing for loop to move the initial point in random directions
for i in range (0,iteration):
pt1= rs.coerce3dpoint(pt)
v = rs.CreateVector(r.randint(-20,20), r.randint(-20,20), r.randint(-20,20))
print ("intial Point location for loop number " + str(i+1) + " is " + str(pt1))
print ("random vector is " + str(v))
movedPt = rs.MoveObject(pt, v)
listPt.append(movedPt)
pt = movedPt
#out putting the list
OutPts = listPt
accumulated random movement of a point.gh (18.3 KB)
8 posts - 3 participants
