Forgot password?

Create an account!

Forum

« back

RhinoScript – loop stopped when no intersection happens

Messages

Please log in to write a message.

  • 3. fnm1 (Nov 29, 2011 22.35):

    so where would this go in the original script?

    quote:

    If Not isnull(result1) then
        For x = 0 To UBound(result1)
            '...
        Next
    End If
  • 2. Hanno (Sep 17, 2011 21.37):

    Hi,

    if curves don't intersect, CurveCurveIntersection returns null. If you add checks like this:

    If Not isnull(result1) then
        For x = 0 To UBound(result1)
            '...
        Next
    End If

    your script should continue to run.

    Hope that helps!

    Hanno

  • 1. bbrown (Sep 16, 2011 11.59):

    Hello,
    I have performed a code to get the intersection point of several curves. The code have a loop to make the intersections.
    There are three groups of curves, but when one of the curves (from one group) doesn't intersect with other curves (from other group) the loop stop. I want to enhance the code to make it able to neglect this step and continue making the others intersections.
    The code is attached below.
    Thanks!

    Dim e, d, f, result1, result2, result3, x, y, z, w, i, j, l

    e = Rhino.GetObjects ("select int_long")
                                                                 
    d = Rhino.GetObjects ("select int_sec")

    f = Rhino.GetObjects ("select int_dec")

    If IsArray(a) Then
            For l = 0 To UBound(d)
              For j = 0 To UBound(e)
                For w = 0 To UBound(f)
               
                      result1 = Rhino.CurveCurveIntersection (d(l), e(j))
                      result2 = Rhino.CurveCurveIntersection (d(l), f(w))
                      result3 = Rhino.CurveCurveIntersection (f(w), e(j))
                     
          For x = 0 To UBound(result1)
           
                    If(result1(x,0) = 1) Then
                            Rhino.AddPoint result1(x,1)
                    End If
                   
          Next
         
          For y = 0 To UBound(result2)
           
                    If(result2(y,0) = 1) Then
                            Rhino.AddPoint result2(y,1)
                    End If
                   
          Next
         
         For z = 0 To UBound(result3)
           
                    If(result3(z,0) = 1) Then
                            Rhino.AddPoint result3(z,1)
                    End If
                   
          Next
         
              Next
              Next
            Next
           
            End If

Recommend

Why are these buttons gray?