[0],basicplanepoints[o]
[1],\ basicplanepoints[o]
[2]] #以列表的形式提取点的三维坐标
pupoints.append(basicplanepointscor)
#建立类似于九宫格的点阵
pupoint1=[basicplanepointscor[0]+planeunit,\
basicplanepointscor[1],\
basicplanepointscor[2]]
pupoints.append(pupoint1)
rs.AddPoint(pupoint1)
pupoint2=[basicplanepointscor[0]+planeunit,\
basicplanepointscor[1]+planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint2)
rs.AddPoint(pupoint2)
pupoint3=[basicplanepointscor[0],\
basicplanepointscor[1]+planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint3)
rs.AddPoint(pupoint3)
pupoint4=[basicplanepointscor[0]-planeunit,\
basicplanepointscor[1]+planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint4)
rs.AddPoint(pupoint4)
pupoint5=[basicplanepointscor[0]-planeunit,\
basicplanepointscor[1],\
basicplanepointscor[2]]
pupoints.append(pupoint5)
rs.AddPoint(pupoint5)
pupoint6=[basicplanepointscor[0]-planeunit,\
basicplanepointscor[1]-planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint6)
rs.AddPoint(pupoint6)
pupoint7=[basicplanepointscor[0],\
basicplanepointscor[1]-planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint7)
rs.AddPoint(pupoint7)
pupoint8=[basicplanepointscor[0]+planeunit,\
basicplanepointscor[1]-planeunit,\
basicplanepointscor[2]]
pupoints.append(pupoint8)
rs.AddPoint(pupoint8)
#使用random.choice函数随机在各点阵中选择一个点
randomselectionp.append(random.choice(pupoints))
pupoints=[]
pupoints0=randomselectionp[:len(basicplanepoints[0])]
pupoints1=randomselectionp[len(basicplanepoints[0]):-len(basicplanepoints[0])]
pupoints2=randomselectionp[-len(basicplanepoints[0]):]
pupoints4sub=basicplanepoints[-1]
pupoints4=[]
for e in range(len(pupoints4sub)):
pupoints4.append([pupoints4sub[e][0],pupoints4sub[e][1],pupoints4sub[e][2]])
sectionpolylinesparts=[]
for q in range(len(pupoints0)):
#通过随机选择的点建立截面结构线
sectionpolylinesparts.append(rs.AddPolyline((pupoints0[q],pupoints1[q],\
pupoints2[q],pupoints4[q])))
return sectionpolylinesparts,pupoints4
#mainfunction函数时主要为interface code,建立于用户间的互动操作
def mainfunction():
basicpoint=rs.GetPoint('Select one point:')
if not basicpoint:return
values=[5,120,12,5,4,3,4,5]
lengthunit=values[0]
angle=values[1]
offsetvalue=values[2]
topbplineheight=values[3]
multiple1=values[4]
multiple2=values[5]
multiple3=values[6]
floorheight=values[7]
#与用户的互动程序,图为程序运行时Rhino命令行的提示,可以看到设计过程中主要用于控制建筑结构线的相关参数
while True:
prompt='Setting'
result=rs.GetString(prompt,'Insert:',('Lengthunit','Angle','Offsetvalue',\
'Topbplineheight','Multiple1','Multiple2','Multiple3', 'Floorheight','Insert'))
if not result:return
result=result.upper()
if result=='LENGTHUNIT':
f=rs.GetReal('Lengthunit:',values[0])
if f is not None:lengthunit=f
elif result=='ANGLE':
f=rs.GetReal('Angle(110-120):',values[1],110,120)
if f is not None:angle=f
elif result=='OFFSETVALUE':
f=rs.GetReal('Offsetvalue:',values[2])
if f is not Noneffsetvalue=f
elif result=='TOPBPLINEHEIGHT':
f=rs.GetReal('Topbplineheight:',values[3])
if f is not None:topbplineheight=f
elif result=='MULTIPLE1':
f=rs.GetReal('Multiple1:',values[4])
if f is not None:multiple1=f
elif result=='MULTIPLE2':
f=rs.GetReal('Multiple2:',values[5])
if f is not None:multiple2=f
elif result=='MULTIPLE3':
f=rs.GetReal('Multiple3:',values[5])
if f is not None:multiple3=f
elif result=='FLOORHEIGHT':
f=rs.GetReal('Floorheight:',values[5])
if f is not None: floorheight=f
elif result=='INSERT':break
bplines,offsetbplines,topbpline=basiclines(basicpoint,lengthunit,angle,\
offsetvalue,topbplineheight,multiple1,multiple2,multiple3,floorheight)
sectionpolylinespart0,pupoints40=basicpoints(bplines,lengthunit)
sectionpolylinespart1,pupoints41=basicpoints(offsetbplines,lengthunit)
topdivide=rs.DivideCurveLength(topbpline,lengthunit,True,True)
topdividepoints=[]
for a in range(len(topdivide)):
topdividepoints.append([topdivide[a][0],topdivide[a][1],topdivide[a][2]])
toppolylines=[]
for s in range(len(topdividepoints)):
toppolylines.append(rs.AddPolyline([pupoints40,topdividepoints,pupoints41]))
#执行函数
mainfunction()
运行过程中菜单显示:
在与用户的交互中,提取了几个主要用于控制建筑结构线形态的参数:
Lengthunit:截面间距单元控制距离;
Angle:建筑转折角度;
Offsetvalue:建筑进深;
Topbplineheight:屋脊线相对高度;
Multiple1:建筑开始段截面间距单元控制距离倍数;
Multiple2:建筑转折段截面间距单元控制距离倍数;
Multiple3:建筑结束段截面间距单元控制距离倍数;
Floorheight:建筑层高;
--Richie
0人已收藏
0人已打赏
免费0人已点赞
分享
景观规划设计
返回版块25.17 万条内容 · 275 人订阅
回帖成功
经验值 +10
全部回复(1 )
只看楼主 我来说两句 抢板凳