Looping to make serial points

Hello, I have this simple definition to move a point.

However, instead of giving me 100 points spread out at 1 increment, it gave me 100 points in 1 location (p3)

Does anyone know how to fix this?

>def movepoint(point,distance):
    p = rs.PointCoordinates(point)
    px , py , pz = p[0] , p[1] , p[2]
    p2x = px + distance
    p2y = py
    p2z = pz
    p2 = p2x , p2y , p2z
    pt2 = rs.AddPoint(p2)
    return (pt2)

n = 20
point = rs.GetObject('')

p2 = movepoint(point,1)

count = 0
while count < 100:
    count += 1
    p3 = movepoint(p2,1)

This looks like it should be in a different category so it will be seen by people that can help.

I moved it to Scripting.

1 Like

Hi @Pieter_Prasetya,

How about this?

import Rhino
import scriptcontext as sc

point = Rhino.Geometry.Point3d.Origin
for i in range(0, 99):
    point.X += 1.0

ā€“ Dale

1 Like

Thankyou John

Thanks Dale for the reply, this script does the end goal but do it differently from how I need it to be. Iā€™m looking to make it into a definition, that can be looped, which then be put into a conditional statement.

Your script gave me an idea on how to tackle this differently, thanks!