Forgot password?

Create an account!

Forum

« back

RhinoScript – The distance between the two points

Messages

Please log in to write a message.

  • 4. renjiez20 (Mar 09, 2011 15.54):

    Thank you!I'll try a go!

  • 3. Johannes (Mar 03, 2011 09.44):

    Hi, please use syntax highlight.

    Take a look on the following code:

            nBound1 = UBound(arrpoints1)

            ReDim arrPoints1( nBound1)

    Rhinoscript is not case sensitive. If you want to have a new array with the same size like the old one you should do it like that:

            nBound1 = UBound(arrpoints1)

            ReDim arrNewPoints1(nBound1)

    johannes

  • 2. renjiez20 (Mar 02, 2011 15.55):

    Who can help me?

  • 1. renjiez20 (Feb 26, 2011 19.18):

    Hey all
    I writed a simple code .I want to achieve the function like the picture.
    But something is going wrong!
    Thanks for any help or ideas and have a nice day.
    The code:

    Option Explicit
    'Script written by <insert name>
    'Script copyrighted by <insert company name>
    'Script version 2011?2?27? 2:16:36

    Call Main()
    Sub Main()
    Dim arrObjects,arrResults1,arrResults2
    Dim strSurface1,strSurface2
    Dim nBound,nBound1,nBound2,dblDistance
    Dim arrPoints,arrPoints1,arrPoints2
    Dim i,j ,k


    arrObjects = Rhino.GetObjects("Select points to project", 1)

    strSurface1 = Rhino.GetObject("Select surface1 to project onto", 8)

    strSurface2 = Rhino.GetObject("Select surfaces2 to project onto", 8)


    nBound = UBound(arrObjects)

    ReDim arrPoints( nBound )

    For i = 0 To nBound

    arrPoints(i) = Rhino.PointCoordinates( arrObjects(i) )

    Next



    arrResults1 = Rhino.ProjectPointToSurface(arrPoints, strSurface1, Array(0,0,-1))

    arrpoints1=Rhino.AddPoints (arrResults1)


    arrResults2 = Rhino.ProjectPointToSurface(arrPoints, strSurface2, Array(0,0,-1))

    arrpoints2=Rhino.AddPoints (arrResults2)


    nBound1 = UBound(arrpoints1)

    ReDim arrPoints1( nBound1)


    nBound2 = UBound(arrpoints2)

    ReDim arrPoints2(nBound2)


    For j = 0 To nBound1

    For k = 0 To nBound2

    arrPoints1(j) = Rhino.PointCoordinates( arrPoints1(j))
    arrPoints2(k) = Rhino.PointCoordinates( arrpoints2(k))

    dblDistance = Rhino.Distance(arrPoint2,arrPoints1)


    Rhino.Print "Distance: " & CStr(dblDistance)

    Next
    Next
    End Sub

    The distance between the two points
Recommend

Why are these buttons gray?