NCF参数化建筑论坛

标题: 3.0:大侠帮看看这2段代码 [打印本页]

作者: licml    时间: 2011-1-2 15:12
标题: 3.0:大侠帮看看这2段代码
本帖最后由 licml 于 2011-1-2 16:44 编辑

Dim strObject, arrPoint, dblParam,arrPt
strObject = Rhino.GetObject("Select a curve")
If Rhino.IsCurve(strObject) Then
  arrPoint = Rhino.GetPointOnCurve(strObject, "Pick a test point")
  If IsArray(arrPoint) Then
    dblParam = Rhino.CurveClosestPoint(strObject, arrPoint)
    arrPt=Rhino.CurveEvaluate(strObject,dblParam)
    Rhino.AddPoint (arrPt)
    '哪错了?为啥老报:array required,arrPt是array啊
    Rhino.Print "Curve parameter: " & CStr(dblParam)
  End If
End If


----第二段代码---------------------------------------------------

Dim strSrf
Dim arrPt1,arrPt2,arrContour,arrPoints
strSrf=Rhino.GetObject("select a srf:")
arrPt1=Rhino.GetPoint("Select first point")
arrPt2=Rhino.GetPoint("select second point")
arrContour=Rhino.SurfaceContourPoints (strSrf,arrPt1,arrPt2)
If IsArray(arrContour) Then
  For Each arrPoints In arrContour
    '为啥arrPoints是in arrContour,arrPoints没有赋值啊
    rhino.AddCurve(arrPoints)
    rhino.addpoints(arrPoints)
  Next
End If
----------------------------------------
arrContour本身不就是点吗?why不能直接rhino.addpoints(arrContour)?
作者: 1235813    时间: 2011-1-2 17:38
Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version 2011年1月2日 17:34:35

Call Main()
Sub Main()
        Dim strObject, arrPoint, dblParam,arrPt
        strObject = Rhino.GetObject("Select a curve")
        If Rhino.IsCurve(strObject) Then
                arrPoint = Rhino.GetPointOnCurve(strObject, "Pick a test point")
                If IsArray(arrPoint) Then
                        dblParam = Rhino.CurveClosestPoint(strObject, arrPoint)
                        arrPt=Rhino.CurveEvaluate(strObject,dblParam,1)
                       
                        'Rhino.CurveEvaluate ( strObject, dblParameter, intDerivative)

                        'Parameters
                        'strObject
                        'Required.  String.  The object's identifier.

                        'dblParameter
                        'Required.  Number.  The evaluation parameter.

                        '        intDerivative
                        'Required.  Number.  The number of derivatives to evaluate.


                       
                        call Rhino.AddPoint(arrPt(0))
                        '哪错了?为啥老报:array required,arrPt是array啊
                        Rhino.Print "Curve parameter: " & CStr(dblParam)
                End If
        End If


少了参数
作者: 1235813    时间: 2011-1-2 17:39
多看帮助文件
作者: 1235813    时间: 2011-1-2 17:49
'为啥arrPoints是in arrContour,arrPoints没有赋值啊
arrPoints是什么没关系吧,这种for each in循环就是这样用的,只是提供了一个物理地址来存储变量
作者: licml    时间: 2011-1-2 18:14
嗯,明白了,多谢




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