Forgot password?

Create an account!

Forum

« back

RhinoScript – Mininum length

Messages

Please log in to write a message.

  • 3. triplexpresso (Oct 17, 2012 02.44):

    Hi Hanno,
    Thank you for your help. it works well.
    Regards, James

  • 2. Hanno (Oct 13, 2012 14.21):

    Hi James,

    in Rhinoscript there is the very convenient function PointArrayClosestPoint. You could use it to find the closest point and directly draw the shortest line.

    Hope that helps!

    Hanno

  • 1. triplexpresso (Oct 13, 2012 13.09):

    Hi all,
    I would like to find a shortest line from lines created from arrPoint1 to arrPoints as per below script. if anyone has ever done this please help as I really no idea how to figure out?
    Thank very much,
    James

    Option Explicit
    'Script written by <insert name>
    'Script copyrighted by <insert company name>
    'Script version 13 ?????? 2555 20:23:41

    Call Main()
    Sub Main()
           
            Dim strObject, arrPoints, arrPoint, arrPoint1, intSeg, dblDistance, strLine, dblLineL
           
            strObject = Rhino.GetObject("Select one curve")
           
            If IsNull(strObject) Then Exit Sub
           
            intSeg = Rhino.GetReal("Input segment to be divided = ",5, 1, 25)
           
            If Rhino.IsCurve(strObject) Then
                    arrPoints = Rhino.DivideCurve(strObject, intSeg)
                    If IsArray(arrPoints) Then
                            arrPoint1 = Rhino.GetPoint("Select one point")
                            If IsArray(arrpoint1) Then
                                    For Each arrPoint In arrPoints
                                            Rhino.AddPoint arrPoint
                                            dblDistance = Rhino.Distance(arrPoint1, arrPoint)

                                            If Not IsNull(dblDistance) Then

                                                    Rhino.Print "Distance: " & CStr(dblDistance)
                                                    StrLine = rhino.AddLine (arrPoint1, arrPoint)
                                                    dblLineL = rhino.CurveLength(strLine)

                                            End If
                                           
                                    Next
                           
                                   

                                    'dblMindis = rhino.Min(dblDistance)
                                    'rhino.Print "Min distance: " & CStr(dblMinDis)
                            End If
                    End If
            End If
    End Sub
    Mininum length
Recommend

Why are these buttons gray?