2010-03-09

[script] Study [I]

Option Explicit
'Script written by
'Script copyrighted by
'Script version 2010年3月9日 下午 11:39:10

Call Main()
Sub Main()
    Call rhino.AddLayer("box",RGB(255,0,0))  (定義圖層顏色)
   
    Dim strobject,X,Y,Z (定義X,Y,Z)
    Dim arrcorn(7) (定義矩形八個點的位置)

   
    X = rhino.GetReal("put the length of X ",2)
    If (X<=0) Then Exit Sub
   
    Y = rhino.GetReal("put the wide of Y ",2)
    If (Y<=0) Then Exit Sub
   
    Z = rhino.GetReal("put the high of Z ",2)
    If (Z<=0) Then Exit Sub
   
    (控制XYZ的變因參數,小於或等於零即無效)


    arrcorn(0) = array(((-1*X)/2),((-1*Y)/2),0)
    arrcorn(1) = array(((X)/2),((-1*Y)/2),0)
    arrcorn(2) = array(((X)/2),((Y)/2),0)
    arrcorn(3) = array(((-1*X)/2),((Y)/2),0)
    arrcorn(4) = array(((-1*X)/2),((-1*Y)/2),Z)
    arrcorn(5) = array(((X)/2),((-1*Y)/2),Z)
    arrcorn(6) = array(((X)/2),((Y)/2),Z)
    arrcorn(7) = array(((-1*X)/2),((Y)/2),Z)
   

    strObject = rhino.AddBox (arrcorn)
    Call rhino.objectLayer(strobject,"box")

End Sub

沒有留言:

張貼留言