找回密码
 注册
搜索
查看: 17067|回复: 4

[在线求助] 3.0:大侠帮看看这2段代码

[复制链接]
发表于 2011-1-2 15:12:24 | 显示全部楼层 |阅读模式
本帖最后由 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)?
发表于 2011-1-2 17:38:43 | 显示全部楼层
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


少了参数
回复

使用道具 举报

发表于 2011-1-2 17:39:13 | 显示全部楼层
多看帮助文件
回复

使用道具 举报

发表于 2011-1-2 17:49:44 | 显示全部楼层
'为啥arrPoints是in arrContour,arrPoints没有赋值啊
arrPoints是什么没关系吧,这种for each in循环就是这样用的,只是提供了一个物理地址来存储变量
回复

使用道具 举报

 楼主| 发表于 2011-1-2 18:14:50 | 显示全部楼层
嗯,明白了,多谢
回复

使用道具 举报

NCFZ微信公众号

手机版|小黑屋|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 ) 辽公网安备21021102000973号

GMT+8, 2026-11-23 19:19 , Processed in 0.046529 second(s), 18 queries , Gzip On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表