Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5762

Python "PlaneCurveIntersection" - index out of range" Error

$
0
0

@adams-m wrote:

Hello all,

I'm writing a script where I need to find the intersection of a series of created section curves with the centreline (World XZ plane)... I've got the folllowing code, but get an error for "index out of range: 1".

def curve_CL(curves):
    points = []
    plane = rs.WorldZXPlane()
    for crv in curves:
        int = rs.PlaneCurveIntersection(plane,crv)
        if not int:
            print "Error with plane-curve intersection"
        points.append(int[1])
    return points

I can see why this is - because the resulting point that I'm after is hidden inside a tuple, which itself is inside a list (see below from debugging).... but I can't understand why this is... the help file info for the PlaneCurveIntersection gives the return as just a list, where the point should be at index [1].

I'm sure this is a really rookie error, but any help would be much appreciated - it's driving me mad trying to find out where the problem lies.

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5762

Trending Articles