NCF参数化建筑论坛

标题: grasshopper中的vb编程问题求助 [打印本页]

作者: clearlove33    时间: 2022-10-18 10:44
标题: grasshopper中的vb编程问题求助
本帖最后由 clearlove33 于 2022-10-18 10:45 编辑

出现未声明onutil,可能因其保护级别而不可访问的错误
Private Sub RunScript(ByVal PenroseString As String, ByVal Length As Double, ByRef PenroseLines As Object)
    Dim Pt As New Point3d(0.0, 0.0, 0.0)

    Dim arrPoints As New List( Of Point3d )

    Dim V As New Vector3d(1.0, 0.0, 0.0)

    Dim PtStack As New List( Of Point3d )
    Dim VStack As New List( Of Vector3d )

    Dim count As Integer = PenroseString.Length
    Dim i As Integer
    Dim Rule As Char

    For i = 0 To count - 1
      Rule = PenroseString(i)

      If Rule = "+" Then
        V.Rotate(OnUtil.On_DEGREES_TO_RADIANS * (+36.0), OnUtil.On_zaxis)
      End If

      If Rule = "-" Then
        V.Rotate(OnUtil.On_DEGREES_TO_RADIANS * (-36.0), OnUtil.On_zaxis)
      End If(error(BC30451)未声明onutil,可能因其保护级别而不可访问)

      If Rule = "1" Then
        Dim newPt1 As New Point3d(Pt)
        arrPoints.Add(newPt1)

        Dim newPt2 As New Point3d
        newPt2 = Pt + (V * Length)
        arrPoints.Add(newPt2)

        Pt = newPt2
      End If

      If Rule = "[" Then
        Dim newPt As New Point3d(Pt)
        PtStack.Add(newPt)

        Dim newV As New Vector3d(V)
        VStack.Add(newV)
      End If

      If Rule = "]" Then
        Pt = PtStack(PtStack.Count() - 1)
        V = VStack(VStack.Count() - 1)

        PtStack.RemoveAt(PtStack.Count() - 1)
        VStack.RemoveAt(VStack.Count() - 1)
      End If

    Next
    Dim allLines As New List( Of Line )
    For i = 1 To arrPoints.Count() - 1 Step 2
      Dim line As New Line(arrPoints(i - 1), arrPoints(i))
      allLines.Add(line)
    Next
    PenroseLines = allLines
  End Sub
————————————————
求求帮帮小弟了 快哭了
作者: clearlove33    时间: 2022-10-18 15:28
顶一下!!!!!!!!!!





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