Rs.dividecurve


#1

hey there!
I’m all new to the topic of scripting in rhino. So excuse my very basic questions.

if i want to divide a curve into “x” segments, how can i access the points afterwards?

i want to access them, each of them being be the starting point of another event…

please help:

code should look like this:

import rhinoscriptsyntax as rs

#draws simple circle
def draw_circle(center, radius):
circle = rs.AddCircle(center, radius)

“”“divide circle and take the new divisionalpoints as center for new circles with half of the last circle’s radius”""

def divide_circle(center, radius, division):
#draws 1st circle
circle = draw_circle(center, radius)
#divides circle into “division” segments
divcircle = rs.DivideCurve(circle, division, False, True)
#takes last radius and divides it by 2
radius = radius/2
return radius
#sets the division points of circle as new center
#?? center = divcircle[] ?? how can i access the points??


(NARUTO) #2

hey there!
You should use a loop, such as pictures

code
import rhinoscriptsyntax as rs

def draw_circle(center, radius):
circle = rs.AddCircle(center, radius)
return circle

“”“divide circle and take the new divisionalpoints as center for new circles with half of the last circle’s radius”""

def divide_circle(center, radius, division):
#draws 1st circle
circle = draw_circle(center, radius)
#divides circle into “division” segments
divcircle = rs.DivideCurve(circle, division, False, True)
#takes last radius and divides it by 2
radius = radius/2
for i in divcircle:
circles=draw_circle(i, radius)
#sets the division points of circle as new center
#?? center = divcircle[] ?? how can i access the points??

def main():
center=rs.GetPoint(“Pick a center”)
radius=rs.GetReal(“Radius of new circle”,10)
division=rs.GetReal(“division”,8)
divide_circle(center, radius, division)

main()