 # Help generating growth algorithm from multiple points

Hi, I am new to python (started last month for class). I am unsure of how to combine my scripts together. I am trying to reproduce a growth algorithm from the points generated from my divided surface, but I am not sure how to use a for loop to implement multiple points into the next step.

To explain further:

^ I want to grow these spheres

^ Out of each point I generated here

^Those points came from this surface I made

I am just unsure how to combine it together without it giving me an error. I got it to work with one point, just not multiple.

This is the script I have so far:

“”"
How to generate growth from the points of a surface
“”"

import rhinoscriptsyntax as rs
import random

#-------------------------------------------------

#Selects the already created base surface from rhino

BASE = rs.GetObject(“Pick any object”)

if BASE:
print "Object identifier: ", BASE

#-------------------------------------------------

#Determines the number of divisions on the base surface

number_divisions = 15

def DivideSurface(BASE, divisions):
u_domain = rs.SurfaceDomain(BASE, 0) #Gets the original u-direction domain of the base surface
v_domain = rs.SurfaceDomain(BASE, 1) #Gets the original v-direction domain of the base surface
for i in range(divisions+1):
u = u_domain + (u_domain-u_domain)*i/divisions #Divides the original u-direction domain of the base surface
for j in range(divisions+1):
v = v_domain + (v_domain-v_domain)*j/divisions #Divides the original v-direction domain of the base surface
point = rs.EvaluateSurface(BASE,u,v)
rs.AddPoint(point) #Adds the points generated from the divisions onto the base surface

DivideSurface(BASE, number_divisions) ##Generates points based on the number of divisions and adds spheres onto the points

#-------------------------------------------------

rs.DeleteObject(BASE)

#-------------------------------------------------

from Rhino import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from Rhino.Input import *
from Rhino.Input.Custom import *
from scriptcontext import doc

#selects multiple points that already exists
#using the RhinoScript syntax
point_ids = rs.GetObjects(“Select point”, rs.filter.point)
for p_id in point_ids:
print “point id: {0}”.format(p_id)

#-------------------------------------------------

#Simple Growth script

import random #This module implements pseudo-random number generators for various distributions

def placePt(x_range,y_range,z_range):
x = random.uniform(0,x_range) #Random uniform gets a random number in the range specified
y = random.uniform(0,y_range)
z = random.uniform(0,z_range)
pt = [x,y,z] #Creates a point based on the random uniform generator
return pt

rs.EnableRedraw(False)

ptZero = [50,50,50] #Starting point where growth generates from
pts = #EmptyList
pts.append(ptZero) #Adds point zero to the list