NCF参数化建筑论坛

标题: 新手求助,官网上的这个运行不了? [打印本页]

作者: zhuoranliu    时间: 2009-12-3 15:43
标题: 新手求助,官网上的这个运行不了?
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
作者: zhuoranliu    时间: 2009-12-3 16:54
自己顶自己
作者: lettle    时间: 2009-12-6 17:58
楼下帮你顶  话说最近逛的坛子都关了   是怎么一回事?
作者: panhao1    时间: 2009-12-8 01:01
脚本都不全 当然运行不了
作者: panhao1    时间: 2009-12-8 01:04
下半部分倒是没错 上部分在哪 建议你把gh的图贴上来

你该不会认为这是犀牛脚本吧!
作者: better    时间: 2009-12-11 17:17
这个是什么~?
作者: ninesuns    时间: 2011-12-6 15:46
这个是vb的脚本吧。虽然我还不是很会。。。但是也看得出来




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