NCF参数化建筑论坛

标题: addline 小问题 [打印本页]

作者: qq56    时间: 2011-9-26 14:54
标题: addline 小问题
本帖最后由 qq56 于 2011-9-26 14:58 编辑

AddLine
Adds a line curve to the current model.

Syntax
Rhino.AddLine (arrStart, arrEnd)

Parameters
arrStart
Required.  Array.  The starting point of the line.

arrEnd
Required.  Array.  The ending point of the line.


Returns
String
The identifier of the new object if successful.

Null
If not successful, or on error.


Example
Dim arrStart, arrEnd

arrStart = Rhino.GetPoint("Start of line")

If IsArray(arrStart) Then

arrEnd = Rhino.GetPoint("End of line")

If IsArray(arrEnd) Then

Rhino.AddLine arrStart, arrEnd

End If

End If

以上是addline在rhino中提供的帮助,下面是小问题:
按照帮助文件里面的提示,我如下的写,运行提示错误。
Call Main()
Sub Main()
               
        Dim arrStart, arrEnd,line1

        arrStart = rhino.addpoint (array(0,0,0))
        arrEnd = rhino.addpoint(array(2,2,2))
        
        line1=rhino.AddLine(arrstart,arrend)

End Sub

如下这样写可以得到结果(将上面的赋值的点转换为坐标的形式,那addline的参数应该是坐标,而不是点才对,这和Required.  Array.  The starting point of the line.

的要求是矛盾的,谁能解答下,谢谢)
Call Main()
Sub Main()
               
        Dim arrStart, arrEnd,line1

        arrStart = array(0,0,0)
        arrEnd = array(2,2,2)
        
        line1=rhino.AddLine(arrstart,arrend)

End Sub
作者: wenchongyun    时间: 2011-9-27 11:50
rhino.addpoint返回的是一个string类型的数据,不能代入到Rhino.AddLine中
作者: weiwei    时间: 2011-12-29 02:14
你應該這樣寫,但是這樣是繞圈子

'CurveDomainOption Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version 2011年12月29日 上午 02:00:59


Call Main()
Sub Main()
               
        Dim arrStart, arrEnd,line1

        arrStart = rhino.addpoint (array(0,0,0))
        arrEnd = rhino.addpoint(array(2,2,2))
        arrStart = rhino.PointCoordinates(arrStart)
        arrEnd = rhino.PointCoordinates(arrEnd)
       
        line1=rhino.AddLine(arrstart,arrend)

End Sub




欢迎光临 NCF参数化建筑论坛 (http://www.ncf-china.com/) Powered by Discuz! X3.2