I’m trying to work my way through the Python for Rhinoceros 5 primer. I’m getting frustrated partly because I don’t have the example curves and surfaces that were used and partly because of errors in the python code. For example in some places there is a

for i in range(x,y,z) where the x,y, and z are real numbers instead of ints. My current problem is on page 77 about Interpolated curves. I’m doing fine till I get to the description where it says that the complete script is supplied in the article archive. ?? Where is the article archive? I’m trying to understand whether this primer was written just to give me ideas of what I might do? I am learning, but it’s hard sledding.

Perhaps the online version provides fixed/updated/missing code snippets:

Nope. In section 8.7.2 it still says the complete script is in the article archive. And in section 8.5 on planes I still find the problem with “for i in range” problem. Here’s the code snippet.

```
uStep = (uDomain[1] - uDomain[0]) / intCount
vStep = (vDomain[1] - vDomain[0]) / intCount
rs.EnableRedraw(False)
for u in range(uDomain[0],uDomain[1], uStep):
For v in range(vdomain[0],vDomain[1],vStep):
```

When I try this script with a surface I created, I get errors because the range values are real and fractional, not integers.

Hi @Joe4,

Try using a `while`

loop:

```
import rhinoscriptsyntax as rs
idSurface = rs.GetObject("Surface to frame", 8, True, True)
intCount = rs.GetInteger("Number of iterations per direction", 20, 2)
uDomain = rs.SurfaceDomain(idSurface, 0)
vDomain = rs.SurfaceDomain(idSurface, 1)
uStep = (uDomain[1] - uDomain[0]) / intCount
vStep = (vDomain[1] - vDomain[0]) / intCount
rs.EnableRedraw(False)
u = uDomain[0]
while u <= uDomain[1]:
v = vDomain[0]
while v <= vDomain[1]:
pt = rs.EvaluateSurface(idSurface, u, v)
if rs.Distance(pt, rs.BrepClosestPoint(idSurface, pt)[0]) < 0.1:
srfFrame = rs.SurfaceFrame(idSurface, [u, v])
rs.AddPlaneSurface(srfFrame, 1.0, 1.0)
v += vStep
u += uStep
rs.EnableRedraw(True)
```

– Dale

Perhaps the author meant to call the `rhinoscriptsyntax.frange`

function (i.e. a float version of the standard Python `range`

function).

Yes, thank you. Both solutions are possible. But I still wish I had access to the original Rhino files that were used. And where is the archive where the rest of the script for section 8.7.2 resides?