Placing the intersection point between two lines using rhino python vsc

I use this code to select two lines. Then I am trying to place a point in the middle of each line and a point in the intersection between those two lines. Also, is there any option to offset a point

import rhinoscriptsyntax as rs
import math
import Rhino as rc

first_line = rs.GetObjects(“Select first edge”, rs.filter.curve, True, True)
perp_line = rs.GetObjects(“select perpendicular edge”, rs.filter.curve, True, True)


In order to add a point to the middle of a curve you need to evaluate it:

import rhinoscriptsyntax as rs

crv_id1 = rs.GetObjects(“Select first curve”, rs.filter.curve, True, True)
crv_id2 = rs.GetObjects(“Select second curve”, rs.filter.curve, True, True)

crv_ids = [crv_id1, crv_id2]
for crv_id in crv_ids:
    dom = rs.CurveDomain(crv_id)
    t = dom[1]  * 0.5   # parameter in the middle of the curve
    pt = rs.EvaluateCurve(crv_id, t)

The intersection point between two lines can be found like this:

import rhinoscriptsyntax as rs

line1 = rs.GetLine(message1=“Select first line”)
line2 = rs.GetLine(message1=“Select second line”)

points = rs.LineLineIntersection(line1, line2)  # intersection point on first and second line
if points:

To offset or move a point you can simply add it to a vector, describing the desired translation.

Thank you very much for your reply, but unfortunately, both script gives me this error

Your " are the problem! If you’re on macOS, you need to go to the system preferences under “Keyboard” > “Text” turn off “Smart quotes and quotations”.

I am using windows os

Simply replace the prettified with regular ones ".

1 Like