Thursday, August 20, 2009

Liyi Tower

Here is the twisted tower example:

import py2rhino as p2r
print p2r._version

#===============================================================================
# Parameters
#===============================================================================
pline = p2r.obj.Polyline("8132d141-be8d-4abe-84a3-1dbf37bd0960")
rot_cir = p2r.obj.Circle("b85bb2ea-6790-45a1-b16d-3604bc579637")
floor_height = 4
rot_angle = 1
num_floors = 50
#===============================================================================
# Main script
#===============================================================================

#create the surface and cap it
srf = p2r.obj.NurbsSurface.create_by_extrude_crv_straight(pline, (0,0,0), (0,0,floor_height))
srf.func.cap_planar_holes()

#get the centre of rotation
rot_pnt = rot_cir.prop.center_pnt()

#create floors
for floor in range(num_floors):

#copy
srf2 = srf.dupl.copy_move_by_vec((0,0,floor_height * floor))

#rotate
srf2.trfm.rotate(rot_pnt, rot_angle * floor, (0,0,1), False)

No comments:

Post a Comment