I have a circle in 3d space, i want to randomly generate a specified number of points on its circumference. which Python Rhino API could be of use please?

Oh, dunno, this could be done in several waysâ€¦

For example you could generate a large number of evenly spaced points on the circle using something like Divide>Number, then choose a random smaller subset of those pointsâ€¦ Or a bunch of vectors from the circle center at random angles that intersect with the circleâ€¦ Or create a bunch of random points somewhere near the circle and then pull them to the circle with ClosestPt()â€¦ All this can be done with Python + rhinoscriptsyntax no problem.

1 Like

PointAtNormalizedLength() is another method that does a bunch of stuff for you:

```
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as R
import random
# produces n points along a curve
guid = rs.GetObject('select curve')
curve = rs.coercecurve(guid)
if curve:
n = 100
for i in range(n):
point = curve.PointAtNormalizedLength(random.random())
sc.doc.Objects.AddPoint(point)
```

Output:

3 Likes

Awesome. Thanks!