Rs Curvature Circle
Last changed: dale@mcneel.com-204.177.179.113

.
DeveloperRhinoScript
Version4.0
SummaryDemonstrates how to add curvature circles using RhinoScript.

Question

I find Rhino's Curvature command very useful for analyzing the curvature at a point on a curve. Is there anyway for Rhino to add the circle to the document when I pick on the curve (instead of just drawing it dynamically)?

Answer

There is no option on the Curvature command for leaving the circle that it draw dynamically. But, with the help of RhinoScript, you can write a subroutine that will. The following example RhinoScript code demonstrates how to do just this.

Note, if you want to run the following script, just download it. Then, extract the .rvb file from the zip file onto your desktop, and then drag it on top of Rhino and drop it. Finally, run the CurvatureCircle command.

  Option Explicit 


  Sub CurvatureCircle


    Dim crv, crv_pt, crv_t
    Dim arr, crv_pl, pl


    crv = Rhino.GetObject("Select curve for curvature measurement", 4, True)
    If IsNull(crv) Then Exit Sub


    Do    
      crv_pt = Rhino.GetPointOnCurve(crv, "Select point on curve for curvature measurement")
      If IsNull(crv_pt) Then Exit Do


      crv_t = Rhino.CurveClosestPoint(crv, crv_pt)
      If IsNull(crv_t) Then Exit Do


      arr = Rhino.CurveCurvature(crv, crv_t)
      If IsNull(arr) Then 
        RhinoApp().Print("Unable to compute curve curvature.")
        Exit Do
      End If


      crv_pl = Rhino.PlaneFromFrame(arr(0), arr(1), arr(4))
      pl = Rhino.MovePlane(crv_pl, arr(2))


      Rhino.AddCircle pl, arr(3)
      Rhino.AddPoint arr(0)
    Loop While Not IsNull(crv_pt)


  End Sub