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
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)
rs.AddPoint(pt)
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:
rs.AddPoint(points[0])
To offset or move a point you can simply add it to a vector, describing the desired translation.