Accomplising Circle Around Curve via Python API

Anyone know how to generate a circle around a curve via python API? Trying to use Circle(Point3d, Vector3d, Point3d) but I think I am missing something. I am trying to target one curve’s start and endpoint to dictate center point and direction (vector).

Thanks !

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext


master_obj_list = rs.AllObjects()

for obj in master_obj_list:
    if rs.ObjectType(obj) == 4:
        print("This is ID is the curve " + str(obj))
        target_crv = rs.coercecurve(obj)
        
print target_crv
print type(target_crv.PointAtLength(0))

vectorOne = Rhino.Geometry.Vector3d(target_crv.PointAtLength(0))

circleOne = Rhino.Geometry.Circle(target_crv.PointAtLength(0), vectorOne, target_crv.PointAtLength(1))

scriptcontext.doc.ActiveDoc.Views.Redraw

Hi @Derek_Comeau, below is one way to do it:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    crv_id = rs.GetObject("Curve", rs.filter.curve, True, False)
    if not crv_id: return
    
    point = rs.GetPointOnCurve(crv_id, "Point for circle")
    if not point: return
    
    curve = rs.coercecurve(crv_id, -1, True)
    rc, t = Rhino.Geometry.Curve.ClosestPoint(curve, point)
    if not rc: return
    
    plane = Rhino.Geometry.Plane(point, curve.TangentAt(t))
    circle = Rhino.Geometry.Circle(plane, radius=10)
    
    scriptcontext.doc.Objects.AddCircle(circle)
    scriptcontext.doc.Views.Redraw()
    
DoSomething()

_
c.

Thanks for the insight @clement ! Ill do some testing today. This looks promising though!