Rhinoscriptsyntax into Rhino Common - frange function/method

I would like to use floats and decimals in my Rhino Common scripts when importing math.sin and math.cos
I also want to move away from rhino.scriptsyntax in my ghpython nodes.

How does one change a rhinoscriptsyntax
for i in rs.frange(0.0,100.0, 0.1):


for i in Rhino.?(0.0, 100.0, 0.1)
a Rhino Common function/method in order to deal with floats in the range function?

What namespace follows Rhino.? to access floats in range in Rhino common?


All rhinoscriptsyntax scripts are easily scrutinized by adding a break at it and stepping in

def fxrange(start, stop, step):
    "float version of the xrange function"
    if step==0: raise ValueError("step must not equal 0")
    x = start
    if start<stop:
        if step<0: raise ValueError("step must be greater than 0")
        while x<=stop:
            yield x
        if step>0: raise ValueError("step must be less than 0")
        while x>=stop:
            yield x

def frange(start, stop, step):
    "float version of the range function"
    return [x for x in fxrange(start, stop, step)]


Many kind thanks.


1 Like

You can also use this method, that’ll work in GHPython as well (or inspect the source code directly, also covered in this thread):