Forgot password?

Create an account!

Forum

« back

RhinoScript – How to save and plot a point field in Rhino

Messages

Please log in to write a message.

  • 2. Ning (Jun 10, 2010 16.20):

    Hi, guys,

    I already found the problem.

    Just puting another row "InputBimNode=arrBimNode" at tne end of Function InputBimNode() sorts the problem out.

    Thank you for your time.


    Regards

    ning

  • 1. Ning (Jun 10, 2010 15.16):

    I have a another problem in the code below, which is based on the code I described before. In the code, I save a point text file into an array and plot it in Rhino. However, I got an error associated with UBound
    First, let me show me the format of my point text file, which has 15000 line and each line has three cocordinate values

    503.256789971;-261.378431993;0.0
    517.926788564; -261.372005769; 0.0
    526.8115; -249.255109375; 0.0
    522.81146875; -249.256859375; 0.0
    522.8099375; -245.718453125; 0.0
    526.81075; -247.626703125; 0.0

    Secondly, the current code is below:

    Option Explicit

    Function InputBimNode()
    Dim file_path
    Rhino.MessageBox("Bim node file is required")
    file_path = Rhino.OpenFileName("Open", "Text Files (*.txt)|*.txt|All Files|*.*")
    If (IsNull(file_path)) Then Exit Function

    Dim contents1
    Dim arrBimPoint(2)

    contents1 = Rhino.ReadtextFile(file_path, True, True)

    Dim i, m, k0
    m=0
    k0=UBound(contents1)
    ReDim arrBimNode(k0)

    For i = 0 To k0

    Dim fragments1
    fragments1 = Split(contents1(i), ";")

    arrBimPoint(0) = CDbl(fragments1(0))
    arrBimPoint(1) = CDbl(fragments1(1))
    arrBimPoint(2) = CDbl(fragments1(2))

    arrBimNode(m) = array (arrBimPoint(0),arrBimPoint(1),arrBimPoint(2))
    m=m+1

    If i=200 Then
    Call Rhino.print(Rhino.Pt2Str(arrBimPoint))

    End If

    Next

    End Function

    Call plot_node()
    Rhino.MessageBox("Bim input finished")
    Sub plot_node()
    Call Rhino.AddLayer("Bim_node",RGB(255,0,0))
    Call Rhino.CurrentLayer("Bim_node")

    Dim arrBim

    arrBim = InputBimNode()

    Dim k1
    For k1=0 To UBound(arrBim)
    Call Rhino.AddPoint(arrBim(k1))
    Next

    End Sub
    Finally, I am again asking for your help. For me Ubound is a very simple function and I cannot fix it out. Could you please spent your time to help me? Thank you.

    Regards

    Ning

Recommend

Why are these buttons gray?