How to get Array[Point3d]() from rs.LineLineIntersection

How to get ArrayPoint3d from one Guid object (line) and list of Guid objects (lines) intersections?

Example :

line = “Guid object”
lines = “list of Guid objects”

Intersections =

for i in lines:
IntersectionPoint = rs.LineLineIntersection(i, line)
Intersections.append(IntersectionPoint)

print(Intersections)

Output :

[(<Rhino.Geometry.Point3d object at 0x0000000000000329 [100,30,0]>, (<Rhino.Geometry.Point3d object at 0x000000000000032B [92.5925925925926,30,20]>)]

Looking for output :

Array[Point3d]((<Rhino.Geometry.Point3d object at 0x00000000000002FF [0,30,0]>, <Rhino.Geometry.Point3d object at 0x0000000000000301 [0,30,40]>))

Array is normally the IronPython .Net typed array, not the Python one. Try:


import System
print(System.Array[Rhino.Geometry.Point3d](Intersections))

https://ironpython.net/documentation/dotnet/dotnet.html#net-arrays

Hello James.

It gives:
Error: Runtime error (TypeErrorException): expected Point3d, got tuple

You need an array of tuple(Point3d) then. Try,

System.Array[tuple(Rhino.Geometry.Point3d)]

or

System.Array[System.Tuple[Rhino.Geometry.Point3d]]

or unpack the list and let it cast the tuple to Array instead:


*Intersections

I have just checked
https://developer.rhino3d.com/api/RhinoScriptSyntax/#line-LineLineIntersection

it returns:
tuple(point, point): containing a point on the first line and a point on the second line if successful

so

Intersections.append(IntersectionPoint[0]) works for me.

Thank you.