Forgot password?

Create an account!

Forum

« back

RhinoScript – Where is the probrem ?

Messages

Please log in to write a message.

  • 2. Hanno (Apr 20, 2011 16.53):

    Hi,

    the problem can only be that you do have a 0 (or something that converts to 0) in your array. I did not test your script, but in the "READ LINE BY LINE" section it looks to me as if you start filling your array only at index 1...

    Regards

    Hanno

  • 1. n.katsu (Apr 16, 2011 13.46):

    Hello All,

    I have a problem with the following script.
    I want to pick up the minimum number from the number list.

    When I used "Rhino.Max", rhino uneventfully picked up the maximum number.
    But When I used "Rhino.Min" under the same conditions, rhino picked up "0" at any time!

    Could you tell me where is the problem ?


    Option Explicit
    'Script written by <insert name>
    'Script copyrighted by <insert company name>
    'Script version 2011?4?15? 6:31:43

    Call Main()
    Sub Main()
    Dim objFS, objText, help, strLine, i
    ReDim myText(1)

    Dim arrCount(1), arrPoints(24), nCount, h, j, k
    'GET TEXT DATA--------------------------------------------------
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objText = objFS.OpenTextFile("C:¥Users¥(username)¥Deskto¥Tokyo.txt")


    'READ LINE BY LINE----------------------------------------------
    Dim count : count = 0
    Do While objText.AtEndOfStream <> True
    strLine = objText.ReadLine
    If Not IsNull(strLine) Then

    count = count + 1
    help = FormatNumber (strLine)

    ReDim Preserve myText(count)
    myText(count) = help

    End If
    Loop

    For i = 0 To Ubound(myText) Step 1

    print CStr(myText(i))

    Next

    objText.Close

    'GET THE MINIMUM NUMBER FROM TEXT DATA--------------------------
    Dim MinNum
    Dim FmyText(11)
    Dim a

    For a = 0 To 11 Step 1
    If IsArray(myText) Then

    FmyText(a) = CDbl(myText(a))
    If IsNull(FmyText) Then

    Exit Sub
    End If
    End If
    Next

    MinNum = Rhino.Min(FmyText)
    print CStr(MinNum)

    End Sub

    Where is the probrem ?
Recommend

Why are these buttons gray?