Hi, I am stuck and hoping someone can help please…
I have successfully generated circles with random radii from a list of points and I am trying to then get random lengths of extrusions from the collection of circles. I can only seem to get one random extrusion to all the circles…clearly my last two lines are not correct…
for i in range(len(ptList)):
#generate random integer within a range - use as radius
radius = rnd.randint(1,3)
#create circle using random value as radius
rs.AddCircle(ptList[i], radius)
#works up to this line but the following only gives me one random extrusion for all the circles…
rs.Command(“SelCrv”)
rs.Command(“ExtrudeCrv”,rnd.randint(10,30))
Maybe something like this (using native rhinoscriptsyntax methods):
import rhinoscriptsyntax as rs
import random
#(need to have your point list)
rs.EnableRedraw(False)
for i in range(len(ptList)):
#generate random integer within a range - use as radius
radius = random.randint(1,3)
#create circle using random value as radius - stored in variable circle
circle=rs.AddCircle(ptList[i], radius)
#get circle plane
plane=rs.CurvePlane(circle)
#create end point for extrusion - add random length vector to circle ctr pt.
end_pt=plane.Origin+plane.ZAxis*random.randint(10,30)
#extrude the circle to random height.
rs.ExtrudeCurveStraight(circle,ptList[i],end_pt)
yes that worked perfectly…thank you so much…I got stuck finding a way to feed the GUID’s of the circles into ExtrudeCurveStraight…had tried circles=ExtrudeCurveStraight but didnt know how to connect ptList(i) to that.
thanks again
Giusseppe