How to retrieve a 3D point from CurveBrepIntersect output in GH Python Script

Hello,
I am experiencing difficulties with CurveBrepIntersection in RhinoscriptSyntax (rs). It outputs a list where first element with index [0] is empty and a second element with an intersection point. Lets say I want to draw a line from (0,0,0) to my generated intersection point with index [1].

In this instance I am receiving an error saying "Could not convert [<System.Guid object at 0x000000000000004E [ff5f66f7-b652-493a-a26a-538cf92d665d]>] to a Point3d
Any advise how extract Rhino geometry of that point? I tried Coerce3dPoint, nothing happens.
Example file is here: example_sphere_line_intersection.gh (11.6 KB)

Hi,

CurveBrepIntersect returns 2 lists: curves and points. To only capture the points (2nd list) you can ignore the 1st returned parameter with an underscore:

_,int_pt_list = rs.CurveBrepIntersect(int_line, sphere)

and then reference the [0] element of the points list.

1 Like

Thank Alain,
I does work now!

if Radius:
sphere = rs.AddSphere(rs.AddPoint(0,0,0), Radius)
int_line = rs.AddLine(rs.AddPoint(0,1,0), rs.AddPoint(0,1,-Radius))
crv_list, int_pt_list = rs.CurveBrepIntersect(int_line, sphere)
print int_pt_list[0]
line = rs.AddLine(rs.AddPoint(0,0,0), int_pt_list[0])