找回密码
 注册
搜索
查看: 17690|回复: 6

[心得体会] 新手求助,官网上的这个运行不了?

[复制链接]
发表于 2009-12-3 15:43:28 | 显示全部楼层 |阅读模式
Public Overrides Function RunCommand(ByVal context As RMA.Rhino.IRhinoCommandContext) _
    As RMA.Rhino.IRhinoCommand.result
    ' Select two curves to intersect
    Dim go As New MRhinoGetObject()
    go.SetCommandPrompt("Select two curves")
    go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.curve_object)
    go.GetObjects(2, 2)
    If (go.CommandResult() <> IRhinoCommand.result.success) Then
      Return go.CommandResult()
    End If


    ' Validate input
    Dim curveA As IOnCurve = go.Object(0).Curve()
    Dim curveB As IOnCurve = go.Object(1).Curve()
    If (curveA Is Nothing Or curveB Is Nothing) Then
      Return IRhinoCommand.result.failure
    End If


    ' Calculate the intersection
    Dim intersection_tolerance As Double = 0.001
    Dim overlap_tolerance As Double = 0.0
    Dim xEvents As New ArrayOnX_EVENT()
    Dim count As Integer = curveA.IntersectCurve(curveB, xEvents, intersection_tolerance, _
                                                 overlap_tolerance)


    ' ON_EPSILON will be added to future builds of the SDK
    ' For now just use a hard coded value
    Dim epsilon As Double = 0.00000000000000022204460492503131


    ' Process the results
    If (count > 0) Then
      Dim line As New OnLine()
      For i As Integer = 0 To xEvents.Count() - 1
        Dim e As IOnX_EVENT = xEvents(i)
        Dim ptA As New On3dPoint(e.m_pointA(0))
        Dim ptB As New On3dPoint(e.m_pointB(0))
        context.m_doc.AddPointObject(ptA)
        Dim distance As Double = ptA.DistanceTo(ptB)
        If (distance > epsilon) Then
          context.m_doc.AddPointObject(ptB)
          line.from = ptA
          line.to = ptB
          context.m_doc.AddCurveObject(line)
        End If
      Next
      context.m_doc.Redraw()
    End If


    Return IRhinoCommand.result.success
  End Function
 楼主| 发表于 2009-12-3 16:54:51 | 显示全部楼层
自己顶自己
回复

使用道具 举报

发表于 2009-12-6 17:58:30 | 显示全部楼层
楼下帮你顶  话说最近逛的坛子都关了   是怎么一回事?
回复

使用道具 举报

发表于 2009-12-8 01:01:07 | 显示全部楼层
脚本都不全 当然运行不了
回复

使用道具 举报

发表于 2009-12-8 01:04:00 | 显示全部楼层
下半部分倒是没错 上部分在哪 建议你把gh的图贴上来

你该不会认为这是犀牛脚本吧!
回复

使用道具 举报

发表于 2009-12-11 17:17:56 | 显示全部楼层
这个是什么~?
回复

使用道具 举报

发表于 2011-12-6 15:46:45 | 显示全部楼层
这个是vb的脚本吧。虽然我还不是很会。。。但是也看得出来
回复

使用道具 举报

NCFZ微信公众号

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

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

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

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