Jump to content

Measure lenght of a curve between two point


maksolino

Recommended Posts

Does Rhino support the use of lisp? I thought it relied upon VBscript?

Beats me. :unsure: He said LISP, so that's what I provided.

Link to comment
Share on other sites

This would be a RhinoScript version of that particular task:

 

Option Explicit

Sub LenBetweenPts
Dim crv
Dim stParam, ndParam
Dim msg
Dim stpt, ndpt
Dim arrSubDomain(1), dblLen

 With Rhino
   crv = .GetObject("Pick a curve", 4)
   .EnableRedraw False   
     If (VarType(crv) <> vbString) Then Exit Sub
       stpt = .GetPointOnCurve (crv,  "Pick first Point:")
       If Not IsArray(stpt) Then Exit Sub
       stParam = .CurveClosestPoint(crv, stpt)
       
       ndpt = .GetPointOnCurve (crv, "Pick next Point:")
       If Not IsArray(ndpt) Then Exit Sub
       ndParam = .CurveClosestPoint(crv, ndpt)
       
       If stparam > ndparam Then
         arrSubDomain(1) = stParam
         arrSubDomain(0) = ndParam
       Else
         arrSubDomain(0) = stParam 
         arrSubDomain(1) = ndParam
       End If
       
       dblLen = Rhino.CurveLength(crv,, arrSubDomain)
       
       If IsNumeric(dblLen) Then
         msg = "Length between points: " & CStr(dblLen)    
         .Print msg
       End If
       
   .EnableRedraw True
 End With
End Sub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...