Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5875

Why it doesnt show in rhino?

$
0
0

@marjan wrote:

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)

Posts: 7

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5875

Trending Articles