NCF参数化建筑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索

关于rhinopython的小练习

已有 494 次阅读2015-12-26 17:34 |个人分类:python

#coding=utf-8
import rhinoscriptsyntax as rs
import math
#导入rhinoscriptsyntax模块以及math模块
a_radius=input("please enter a_radius:")
b_radius=input("please enter b_radius:")
FloorHeight=input("Please enter floor height of the building:")
FloorNumber=input("Please enter the floor numbers of the building:")
Angle=input("Please enter the floor angle of the rotating_action:")
#用户从命令行输入基本层平面形状的参数:半长轴,半短轴,层高,层数
if Angle<=2.0:
    origin=(FloorNumber+1)*[None]
    xaxis=(FloorNumber+1)*[None]
    yaxis=(FloorNumber+1)*[None]
#建立三个Plane构成参数的List,为后期平面进行在循环条件下的旋转提供参数
    for z in range(0,FloorHeight*(FloorNumber+1),FloorHeight):
        origin[int(z/FloorHeight)]= (0,0,z)
        A=(Angle/FloorNumber)*(z/FloorHeight)
        xaxis[int(z/FloorHeight)]= (math.sin(A*math.pi),math.cos(A*math.pi),0)
        yaxis[int(z/FloorHeight)]= (math.sin((A+1.0/2)*math.pi),math.cos((A+1.0/2)*math.pi),0)
#在循环条件下根据层高层数为origin列表,xaxis列表以及yaxis列表的索引值更改数据,使之不再是空列表
    id=(FloorNumber+1)*[None]
    for i in range(FloorNumber+1):
        ellipse=rs.AddEllipse(rs.PlaneFromFrame(origin[i],xaxis[i],yaxis[i]),a_radius,b_radius)
        id[i]=rs.FirstObject()
        print ellipse
    select_ellipse=(FloorNumber+1)*[None]
    for t in range(FloorNumber+1):
        select_ellipse[t]=rs.SelectObject(id[t])
        print select_ellipse[t]
    shape=rs.AddLoftSrf(id, start=None, end=None, loft_type=0, simplify_method=0, value=0, closed=False)

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

小黑屋|手机版|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 )    辽公网安备21021102000973号

GMT+8, 2024-3-28 23:29 , Processed in 0.149082 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部