import py2rhino as p2r
#------------------------------------------------------------------------------
#globals
building_height = 50
num_floors = 10
num_panels = 8
points = ((0,0,0), (10,0,0), (5,5,0))
#------------------------------------------------------------------------------
def get_step_size():
domain_u = srf.prop.domain(0)
domain_v = srf.prop.domain(1)
u_range = domain_u[1] - domain_u[0]
v_range = domain_v[1] - domain_v[0]
u_step = u_range / num_floors
v_step = v_range / num_panels
return u_step, v_step
def draw_panels(u_param):
for panel_num in range(num_panels):
v_param = panel_num * v_step
#get the main parameter
param_1 = (u_param, v_param)
#get 3 neighbours
param_2 = (u_param + u_step, v_param)
param_3 = (u_param + u_step, v_param + v_step)
param_4 = (u_param, v_param + v_step)
#get the 4 points by evaluating the srf
point_1 = srf.eval.evaluate(param_1)
point_2 = srf.eval.evaluate(param_2)
point_3 = srf.eval.evaluate(param_3)
point_4 = srf.eval.evaluate(param_4)
#draw the panel
p2r.obj.NurbsSurface.create_by_corner_pnts((point_1, point_2, point_3, point_4))
#------------------------------------------------------------------------------
elp = p2r.obj.Ellipse.create_by_3pt(points[0], points[1], points[2])
srf = p2r.obj.NurbsSurface.create_by_extrude_crv_straight(elp, (0,0,0), (0,0,building_height))
u_step , v_step = get_step_size()
for floor_num in range(num_floors):
u_param = floor_num * u_step
#for each floor, draw a set of facade panels
draw_panels(u_param)
print "done"
Thursday, August 27, 2009
Grid on a surface
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment