ExtendCurve and bounadry objects


Is there a quick solution to get the only the closest boundary object’s ID that the connecting element has been connected ?

As we can set number of objects in the boundary object list. Otherwise I need to measure the distance between object to select the closest one.


hi @onrender,

there is rs.PointClosestObject() which you could use and test against the endpoint(s) of your connecting item. It would handle the distance measuring part for you. Alternatively, if only one object is intersecting the “connecting item” you could use rs.CurveCurveIntersection() to find the one which intersects…


Thanks Clement,

I eventually tried rs.CurveCurveIntersection()

and get

[(1, <Rhino.Geometry.Point3d object at 0x0000000000000063 [-15.6338448046463,19.4051846091331,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000064 [-15.6338448046463,19.4051846091331,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000065 [-15.6338448046463,19.4051846091331,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000066 [-15.6338448046463,19.4051846091331,0]>, 43.405189045484356, 43.405189045484356, 11.418795844012088, 11.418795844012088)]

However the description says two-dimensional list which should be [[1,2,3],[4,5,6]] however the result is like [(1,2,3)]. A list in in parenthesis inside square brackets and not square brackets in a square bracket. Is it the right syntax? I can make a 2d loop but not able to query elements sequentially [0][1].


all ist right, it’s just how Rhino prints a list it if you print the whole list as a single variable. Try iterating over the list, you can query the elements sequentially by using indices too:

import Rhino

# 3 points
pt1 = Rhino.Geometry.Point3d(1,2,3)
pt2 = Rhino.Geometry.Point3d(4,5,6)
pt3 = Rhino.Geometry.Point3d(7,8,0)

# a list of 3 points
pts = [pt1, pt2, pt3]

# access by index (second point, Z-coordinate)
print pts[1][2]

and for the result of rs.CurveCurveIntersection note what the helpfile states. It does not print only points, but also the event types. The first number you have in your list from above is not a point but the intersection event type. The example shown here might help to understand the return values…

Thanks Clement,

Without loop it works like you wrote but when we place it in a for loop it says:
‘NoneType’ object is unsubscriptable.

i as curves;

for i in listBaseJoin:
    intSect = rs.CurveCurveIntersection (listToJoinTemp[0], i, tolerance=-1)
    print intSect[0][1]

Hi @onrender,

check if intSect is not None before printing intSect[0][1]. Then check if you’re accessing items which do not exist. Ps. It would be helpful if you post example code and geometry to test what you’re doing.


Thanks Clement,

It was a bit more complicate than expacted. One of the list member was None but I used :

if intSect is not None:

So it is now resolved.
Thanks again.