Why it doesnt show in rhino?

Hi every body,
I write it in python, it shows any error. but draw any shape in rhino.
many thanks
marjan

snow.py (1.7 KB)

import rhinoscriptsyntax as rs 
import Rhino 

def snowflake_curve(position, direction, recursion_level):
     if (recursion_level== 0):
          return [position + direction] 
     else:
          up      = rs.VectorRotate(direction/3.0,  -60.0, [0,0,1]) 
          down    = rs.VectorRotate(direction/3.0,   60.0, [0,0,1]) 
          forward = direction/3.0 
          point_list = [] 
          point_list.extend (snowflake_curve (position,                       forward, recursion_level-1))
          point_list.extend (snowflake_curve (position + forward,             up,      recursion_level-1)) 
          point_list.extend (snowflake_curve (position + forward + up,        down,    recursion_level-1))
          point_list.extend (snowflake_curve (position + forward + up + down, forward, recursion_level-1)) 
          return point_list 
def rs_pointlist (points, depth):
     for i,p in enumerate(points):
          x = 300 + p.X
          y = 300 + p.Y 
          z = depth 
          if i == 0:
              rs.moveto(x,y,1)

recursion_level= 3
snowflake_size = 200
position  = Rhino.Geometry.Point3d (-50,-29,0) 
direction = Rhino.Geometry.Vector3d (snowflake_size,0,0) 

up       = rs.VectorRotate(direction,  -60.0, [0,0,1]) 
down     = rs.VectorRotate(direction,   60.0, [0,0,1]) 
forward  =  direction 
backward = -direction
point_list = [] 
point_list.extend (snowflake_curve (position,             up, recursion_level)) 
point_list.extend (snowflake_curve (position + up,        down, recursion_level)) 
point_list.extend (snowflake_curve (position + up + down, backward, recursion_level)) 
point_list.extend ([point_list[0]])  # we have to close the curve be adding the first point at the end

#rs.AddCurve (point_list, degree=1)

It works correct here after removing the # before rs.AddCurve (point_list, degree=1)

:blush: thank you

No problem. Everything after the # will be seen as a note :wink:

but it doesnt wotk too…astroid curves.py (589 Bytes)

import rhinoscriptsyntax as rs 
import math 
import Rhino 

a = 150.0 

fx_u = "200 + a * math.pow(math.cos(2*math.pi*u),3)" 
fy_u = "200 + a * math.pow(math.sin(2*math.pi*u),3)" 
fz_u = "depth" 

def cut_parametric (depth):
     n_u = 100
     points = []
     for i in range(0,n_u+1):
          u = 1.0 * i/n_u
          x = eval(fx_u)
          y = eval(fy_u)
          z = eval(fz_u)
          if i == 0:
               rs.moveto(x,y,1) 
          rs.cutto(x,y,z)
          p= Rhino.Geometry.Point3d(x,y,z)
          points.append(p)
     rs.AddCurve(points)

You dont call the function cut_parametric anywhere. So it does not run.
is it part of a bigger script?

you know that, I want to repeat and rotate this shape in a same center but with a smaller radius . but I dont know how !!:confused:
PLZ help me if you have time…

import rhinoscriptsyntax as rs 
import Rhino 


def snowflake_curve(position, direction, recursion_level):
      if (recursion_level== 0):
           return [position + direction] 
      else:
           up      = rs.VectorRotate(direction/3.0,  -60.0, [0,0,1]) 
           down    = rs.VectorRotate(direction/3.0,   60.0, [0,0,1]) 
           forward = direction/3.0 
           point_list = [] 
           point_list.extend (snowflake_curve (position,                       forward, recursion_level-1))
           point_list.extend (snowflake_curve (position + forward + up,        down,    recursion_level-1))
           return point_list 
recursion_level= 3
snowflake_size = 200
position  = Rhino.Geometry.Point3d (-50,-29,0) 
direction = Rhino.Geometry.Vector3d (snowflake_size,0,0) 

up       = rs.VectorRotate(direction,  -60.0, [0,0,1]) 
down     = rs.VectorRotate(direction,   60.0, [0,0,1]) 
forward  =  direction 
backward = -direction
point_list = [] 
point_list.extend (snowflake_curve (position,             up, recursion_level)) 
point_list.extend (snowflake_curve (position + up,        down, recursion_level)) 
point_list.extend (snowflake_curve (position + up + down, backward, recursion_level)) 
point_list.extend ([point_list[0]])  # we have to close the curve be adding the first point at the end



rs.AddCurve (point_list, degree=1)