Forgot password?

Create an account!

Forum

« back

RhinoScript – Identify neighboring lines

Messages

Please log in to write a message.

  • 9. alibek (Oct 04, 2016 19.39):

    Thank's a lot sir.
    That is what I was looking for. Actually did not know how to put points in the array. You made my day.

  • 8. alibek (Oct 04, 2016 19.37):

    I have two ideas how to solve it, but could not write a script or them..
    1) To insert a function which will check if the point already exist before adding it.
    2) Or, to delete deuplicate points after the script adds all of them.

  • 7. pulgarata (Oct 04, 2016 19.19):

    With ".CullDuplicatePoints" you can remove the duplicated points in an array, so you have to put the points in the array. I would do of this way:

    Sub ControlPoints()
            Dim line,i,spoint,epoint,A,N,PNTS
            ReDim PNTS(0)
            N = 0
            line = Rhino.GetObjects("Pick line segments")
            If IsNull(line) Then Rhino.Print("Nothing selected")
            If IsArray(line) Then
                    For i=0 To Ubound(line)
                            ReDim Preserve PNTS(N)
                            PNTS(N) = Rhino.CurveStartPoint(line(i))
                            N = N + 1                      
                            ReDim Preserve PNTS(N)
                            PNTS(N) = Rhino.CurveEndPoint(line(i))
                            N = N + 1
                    Next
            End If
           
            PNTS = Rhino.CullDuplicatePoints(PNTS)
            Rhino.AddPoints(PNTS)
           
    End Sub
  • 6. alibek (Oct 04, 2016 18.47):

    I have two ideas how to solve it, but could not write a script or them..
    1) To insert a function which will check if the point already exist before adding it.
    2) Or, to delete deuplicate points after the script adds all of them.

  • 5. alibek (Oct 04, 2016 18.42):

    Thank yuo for reply.
    I make window selection.
    The script works properly, but it creates too many points. At the intersection of two lines it creates two points (one from each line). That is my problem, I want to remove the duplicate points, but cannot do it...

  • 4. pulgarata (Oct 04, 2016 17.33):

    Hi Alibek,
    The script seems be OK. I think you are drawing too many lines.
    Are you picking them one by one, or making a window selection?

    Sebastian

  • 3. alibek (Oct 04, 2016 16.59):

    Here it is...

    Identify neighboring lines
  • 2. alibek (Oct 04, 2016 16.57):

    Here is my picture of lines. The script adds end/start points, but there are too many of them, so that at each line intersection there are always two or three points. How can I delete those duplicate points?

  • 1. alibek (Oct 04, 2016 16.52):

    Hello everybody. I am a new user of Rhino and currently trying to write a script which will generate T spline mesh from given drawings. But, the first step is to put control points at the curve ends and identify the lines which intersect each other (most probably PointClosestObject command can be used).
    My current progress is adding start/end point to the curves, but the problem is that it adds several points at the same position... I have already spent two days trying to eliminate duplicate points, but did not succeed. Any help will be appreciated.

    Sub ControlPoints()
    Dim line,i,spoint,epoint,PNTS,A
    line = Rhino.GetObjects("Pick line segments")
    If IsNull(line) Then Rhino.Print("Nothing selected")
    If IsArray(line) Then
    For i=0 To Ubound(line)
    spoint = Rhino.CurveStartPoint(line(i))
    epoint = Rhino.CurveEndPoint(line(i))
    Rhino.AddPoint spoint
    Rhino.AddPoint epoint
    Next
    End If
    End Sub

Recommend

Why are these buttons gray?