Dear All,

Can you please advise how to extract intersection coordinates from the following Python script?

import rhinoscriptsyntax as rs

startPoint = [1.0, 2.0, 0.0]

endPoint = [4.0, 5.0, 0.0]

line1 = [startPoint, endPoint]

line1ID = rs.AddLine(line1[0],line1[1]) # Adds a line to the Rhino Document and returns an ObjectID

startPoint2 = [1.0, 4.0, 0.0]

endPoint2 = [4.0, 2.0, 0.0]

line2 = [startPoint2, endPoint2]

line2ID = rs.AddLine(line2[0],line2[1]) # Returns another ObjectID

int1 = rs.LineLineIntersection(line1ID,line2ID) # passing the ObjectIDs to the function.

For example I want to use Y-coordinate of above lines intersection in my further calculations.

Thank you for any advise.

Hope this help:

```
import rhinoscriptsyntax as rs
lineA = rs.AddLine([1.0, 2.0, 0.0],[4.0, 5.0, 0.0])
lineB = rs.AddLine([1.0, 4.0, 0.0], [4.0, 2.0, 0.0])
pointA, pointB = rs.LineLineIntersection(lineA, lineB)
print pointA[1] #y coordinate of the intersection point on the first line
```

Thank you very much!

It works and this is what I was looking for.

Could you please advise also how to get (or reference for sample script) Line/Curve intersection and Line/PolySurface intersection with next extraction of coordinates?

Here I have found sample of CurveSurface intersection, but cannot extract coordinates

And herebelow I scripted Line/Curve intersection. And as result I do get intersection coordinates in output, but cannot extract coordinates in list Y = Y.append(PointA[1]) and to use in further calculations.

import rhinoscriptsyntax as rs

import Rhino

L = rs.GetReal(“X Length of curve projection”)

B = 8

H = 4

WL = rs.GetObject(“Select Curve”, rs.filter.curve)

x0 = rs.GetReal(“x0”)

z = rs.GetReal(“z”)

n = rs.GetReal(“Number of coordinates”)

def WLY():

x = x0

Y = #here should be rectangular brackets for empty list

for x in rs.frange(x, L, L/n):

lineA = [[x, 0, z], [x, B/2, z]]

lineAID = rs.AddLine(lineA[0],lineA[1])

pointA = rs.CurveCurveIntersection(lineAID, WL)

print pointA

x=x0 + L/n

print (Y)

WLY()

Appreciate any advise. Thank you.

Have you checked the function references on rhinoscriptsyntax?

CurveCurveIntersection

CurveBrepIntersect

If you’re using the internal Python script editor, you should have access to these references right after calling a function:

Indeed, I am using the internal Python script editor.

Thank you, I will study these examples.