PDA

View Full Version : Measure lenght of a curve between two point



maksolino
17th Jun 2010, 01:30 pm
hello to all
Rhino question.
it is possible to make a lisp for :
Measure lenght of a curve between two point.
Thanks

alanjt
17th Jun 2010, 01:36 pm
I posted this one a while back...
http://www.theswamp.org/index.php?topic=32677.0


http://www.theswamp.org/screens/alanjt/dbp.gif

ReMark
17th Jun 2010, 01:38 pm
Does Rhino support the use of lisp? I thought it relied upon VBscript?

alanjt
17th Jun 2010, 01:39 pm
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.

ReMark
17th Jun 2010, 01:46 pm
Alan. Don't give them what they ask for...give them what they need!:lol:

Maybe the OP can clear up the confusion.:?

ReMark
17th Jun 2010, 01:50 pm
I found a paper written in 2004 that clearly mentions that Rhiniceros uses vbScript.

http://www.rhino3d.com/tutorials/vbscript/RhinoScript.pdf

alanjt
17th Jun 2010, 03:12 pm
Alan. Don't give them what they ask for...give them what they need!:lol:

Maybe the OP can clear up the confusion.:?
LoL, noted. :)

I found a paper written in 2004 that clearly mentions that Rhiniceros uses vbScript.

http://www.rhino3d.com/tutorials/vbscript/RhinoScript.pdf

Well, that answers that question.

SEANT
20th Jun 2010, 10:26 am
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