Line Tangent Perpendicular through API?

Continuing the discussion from Trying to emulate "Line Tangent Perpendicular":

Can this command be somehow scripted by RhinoCommon or a combination of them? I need to recursively draw this many times.

Hi @Will_Wang,

The basis for this command option are these two methods:

Curve.GetLocalTangentPoint

Curve.GetLocalPerpPoint

An example of Curve.GetLocalPerpPoint:

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

arr = rs.GetCurveObject("Select curve")
pt0 = rs.GetPoint("Pick point")
crv = sc.doc.Objects.Find(arr[0]).Geometry
b, crv_t = crv.GetLocalPerpPoint(pt0, arr[4])
if b:
    pt1 = crv.PointAt(crv_t)
    line = Rhino.Geometry.Line(pt0, pt1)
    sc.doc.Objects.AddLine(line)
    sc.doc.Views.Redraw()

Does this help?

– Dale

1 Like

thanks!!