Class Practice One – Wind Rose

This is the first in-class practice doing a simple declarative program that generates a wind rose in Rhinoceros.

Here is the Python Code:

 


#this links python to rhino
import rhinoscriptsyntax as rs

rs.DeleteObjects (rs.AllObjects ())

#use \ to break the line/command
#use comma between values, before the command ends, don't close it with parenthesis
dblTextHeight = rs.GetReal \
    ("Please insert text Height", \
    1.0)
dblCardinalLength = rs.GetReal \
    ("Please insert cardinal length", \
    15)

intCardinalPoints = rs.GetInteger ("Please insert number of points", 4)


#drafts a cardinal point
#there are 2 kuohao
rs.AddPolyline (([0,0,0],[2,1,0],[dblCardinalLength,0,0],[2,-1,0],[0,0,0]))

#drafts a subcardinal point
rs.AddPolyline (([0,0,0],[2,1,0],[4,4,0],[1,2,0],[0,0,0]))

#selests all
rs.SelectObjects(rs.AllObjects())

#copies around the center
print ("arrayPolar 0,0 " + str(intCardinalPoints) + "360 Enter")
rs.Command ("arrayPolar 0,0 " + str(intCardinalPoints) + "360 Enter")

#add the North
rs.AddText ("N", [-.5,dblCardinalLength +1.0,0], dblTextHeight)

rs.UnselectAllObjects()

Leave a Reply

Your email address will not be published. Required fields are marked *