AddLoftSrf problem

Hello

Here is what I’m trying to do:
1.make some small circle but in different height.
2.make some different size circle but in same height.
3.two different kind circle loft.

I don’t know how to make every circle can be loft.

and here is the code:

import rhinoscriptsyntax as rs
import random as ran

#import value for imax and jmax
imax = rs.GetInteger(‘input an int’, 30)
jmax = rs.GetInteger(‘input an int’, 30)
gmax = rs.GetInteger(‘input an int’, 30)
vmax = rs.GetInteger(‘input an int’, 30)

ptList =
ptList2 =

for i in range(imax):
for j in range(jmax):
x = i #+ ran.randint(1,3)
y = j #+ ran.randint(1,3)
z = ran.uniform(0.2,0.4)

    ptList.append((x,y,z))

for i in range(len(ptList)):
radius = 0.1 #ran.uniform(0.2,0.5)
frontCrv = rs.AddCircle(ptList[i], radius)

for g in range(gmax):
for v in range(vmax):
x = g
y = v
z = 0.3

    ptList2.append((x,y,z))

for g in range(len(ptList)):
radius2 = ran.uniform(0.2,0.5)
backCrv = rs.AddCircle(ptList2[g], radius2)

#rs.AddLoftSrf([frontCrv, backCrv])

You need to put the addloftsrf in a nested loop so it does it with the groups of curves I would guess. What is the difference between imax and gmax, are they not the same value? Same goes for jmax and vmax. Anyway, for what it’s worth here is something that will make lofts *using a similar code to yours) which may or may not help:

import rhinoscriptsyntax as rs
import random as ran

imax = rs.GetInteger("input an int", 5)
jmax = rs.GetInteger("input an int", 5)

ptList = []
ptList2 = []

for i in range(imax):
    for j in range(jmax):
        x = i
        y = j
        z = ran.uniform(0.2,0.4)
        ptList.append((x,y,z))
        x2 = i
        y2 = j
        z2 = 0.3
        ptList2.append((x2,y2,z2))

for i in range(len(ptList)):
    radius = 0.1
    frontCrv = rs.AddCircle(ptList[i], radius)
    radius2 = ran.uniform(0.2,0.5)
    backCrv = rs.AddCircle(ptList2[i], radius2)
    rs.AddLoftSrf([frontCrv, backCrv])

1 Like

Amazing!
Thank you very much,johnharding.

Your solution really does the job. I wouldn’t think it could be solved so easily.

About imax and gmax , there is no difference between these two values.
I thought it was possible to create two different circles in this way, but this way couldn’t make two circles loft.(I didn’t know that two different circles can code in same loop) :sweat:

Have a great day!

No problem, it’s nice to see people take their first steps into programming and nested loops, etc.
Always good to try and condense code where you can.