本帖最后由 夜神 于 2010-5-31 09:58 编辑
楼主 可否清楚的说明这个古建的哪部分是rhinoscript编的?还有可否把编程流程说明一下?屋脊的鸱首不会也是编的吧?
freeze23 发表于 2010-5-31 01:22
这个是入口程序:
注意:这个程序会更改背景色为黑色,以便跟建筑师熟悉AutoCAD一致。
Option Explicit
go_SoloPalace
SUB go_SoloPalace
'文件模式
'Rhino.DocumentModified vbFalse
'Rhino.Command "-New N "
'视图模式
Rhino.CurrentView "Perspective"
Rhino.Command "SetMaximizedViewport Perspective "
'禁用自动保存功能(文件太大,浪费时间)
Rhino.Command "-Options Files Autosave Enabled=No Enter Enter Enter "
'显示模式
'Rhino.Command "RenderedViewport "
Rhino.Command "WireframeViewport "
'背景色
Rhino.AppearanceColor 0,0
Rhino.Command "-LoadScript C:\rvb\02_Palace\settings.rvb "
settings
DIM arrItems(8), arrValues
arrItems(0)="台基"
arrItems(1)="柱"
arrItems(2)="梁檩"
arrItems(3)="椽"
arrItems(4)="斗栱:枋/垫栱板"
arrItems(5)="斗栱:角科"
arrItems(6)="斗栱:柱头科"
arrItems(7)="斗栱:平身科"
arrItems(8)="瓦"
'arrValues=Array(1,1,1,1,1,0,1)
DIM strMessage : strMessage="请选择要建模的部分"
DIM strTitle : strTitle="单檐庑殿建筑建模"
arrValues=Rhino.CheckListBox (arrItems, Array(1,1,1,1,0,0,0,0,0), strMessage, strTitle)
DIM pi : pi=4*Atn(1)
DIM r : r=5000 '视域半径
DIM n : n=1 '视线角度alfa=n*pi/12
DIM alfa
IF arrValues(0)=vbTRUE THEN
alfa=n*pi/12
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\platform_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
viewRotate n,2,1.5*r,45,360+45
END IF
IF arrValues(1)=vbTRUE THEN
alfa=n*pi/12
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\pillars_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n,2,r,45,360+45
END IF
IF arrValues(2)=vbTRUE THEN
alfa=n*pi/12
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\beams_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n,2,r,45,360+45
END IF
IF arrValues(3)=vbTRUE THEN
alfa=n*pi/12
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\roof_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
viewRotate n,3,r,45,360+45
END IF
IF arrValues(4)=vbTRUE THEN
alfa=0
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\archs_枋_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n-1,3,r,45,360+45
END IF
IF arrValues(5)=vbTRUE THEN
alfa=0
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\archs_角科_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n-1,3,r,45,360+45
END IF
IF arrValues(6)=vbTRUE THEN
alfa=0
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\archs_柱头科_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n-1,3,r,45,360+45
END IF
IF arrValues(7)=vbTRUE THEN
alfa=0
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\archs_平身科_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n-1,3,r,45,360+45
END IF
IF arrValues(8)=vbTRUE THEN
alfa=n*pi/12
Rhino.ViewCameraTarget Rhino.CurrentView, Array(r*cos(alfa)*cos(pi*45/180),-r*cos(alfa)*sin(pi*45/180),r*sin(alfa)), Array(0,0,300)
Rhino.Command "-LoadScript C:\rvb\02_Palace\tiles_单檐庑殿.rvb " ': Rhino.Command "Zoom Extents "
'viewRotate n,3,r,45,360+45
END IF
viewRotate 0,3,r,45,360+45
END SUB
'---------------------------------------------------------------------------------------------------
' 旋转展示子程序
'---------------------------------------------------------------------------------------------------
FUNCTION viewRotate(n,AngleStep,r,startAngle,endAngle)
DIM i,j,pi : pi=4*Atn(1)
DIM pause
DIM arrCamera,arrTarget
DIM alfa
arrTarget=Array(0,0,300)
FOR j=n TO n
alfa=j*pi/12 '视线与地面夹角
FOR i=startAngle TO endAngle STEP AngleStep
arrCamera=Array(r*cos(alfa)*cos(pi*i/180),-r*cos(alfa)*sin(pi*i/180),r*sin(alfa))
Rhino.ViewCameraTarget Rhino.CurrentView, arrCamera, arrTarget
NEXT
NEXT
END FUNCTION |