Forgot password?

Create an account!


« back

RhinoScript – CurveBooleanIntersection Not working :(


Please log in to write a message.

  • 2. ledisnomad (Aug 17, 2011 14.38):

    hey randamez.

    I'd like to try to help, but I don't understand yet what you are trying to accomplish. Have you made any progress since July 29 when you posted? Could you post an image of the final result you are looking for?

  • 1. randnamez (Jul 29, 2011 01.01):

    I've attached the code I'm having issues with.

    My long term goal is I'm attempting to make a program that takes two closed curves and has them move forward in a series of steps. One moves straight forward while the other follows a path, which is also defined by a line.

    Picture example of what I'd be working with.

    The issue is that using CurveBooleanIntersection, I end up with some steps not working and becoming null. This means that when I'm going back through and attempting to make all the new lines go in the same direction and have start points near each other, I have issues because some of the objects in the array are null objects rather than actual objects.

    My long goal is to be able to loft the resultant shape.

    DIRECT QUESTION: Why are some of my CurveBooleanIntersection's returning nulls? When I go back and do the shapes manually the program works?

    Option Explicit
    'Script written by Michael Senkow
    'Script version Monday, July 18, 2011 12:07:13 PM

    Call Main()
    Sub Main()
            Dim steps
            steps = Rhino.GetReal("Please choose a number of steps. This helps determine final smoothness.",20)
            ReDim curves1(steps)
            ReDim curves2(steps)
            Dim movementcurve

            'This parameter is set for 20 right now just for debugging, it should work using steps if changed to ReDim
            Dim arrBooleanedCurves(20)
            Dim ptArray
            Dim startPt1
            Dim startPt2
            Dim i
            Dim blnCompare
            curves1(0) = Rhino.GetObject("Select first curve, which moves along the path. Selecting out of order will alter the results negatively.",4)
            curves2(0) = Rhino.GetObject("Select second curve, which only moves straight forward.",4)
            movementcurve = Rhino.GetObject("Please select the curve that defines the movement desired.", 4)
            ptArray = Rhino.DivideCurve(movementcurve,steps)
            For i = 0 To steps
                    If i <= (steps-1) Then
                            startPt1 = Rhino.CurveStartPoint(curves1(i))
                            startPt2 = Rhino.CurveStartPoint(curves2(i))
                            curves1(i+1) = Rhino.CopyObject(curves1(i),startPt1,ptArray(i))
                            curves2(i+1) = Rhino.CopyObject(curves2(i),startPt2,Array(startPt2(0),ptArray(i)(1),startPt2(2)))
                    End If
            For i = 0 To steps
                    arrBooleanedCurves(i) = Rhino.CurveBooleanIntersection(curves1(i),curves2(i))

    End Sub

Why are these buttons gray?