Jump to content

Slide a point along a curve in Rhino3


maksolino

Recommended Posts

hello again

i need a script to Slide a point along a curve

The command DIVIDE whith option Lenght , start always from the beginning of curve.

I found this RhinoScript but it works only whith Rhino 4 .

Rhino 3 don't support the command CurveArcLengthPoint.

Can somebody make a similar script for Rhino 3.

Thanks

 

' Option Explicit
  
  Sub OffsetPointOnCurve
  
    ' Select the curve
    Dim crv : crv = Rhino.GetObject("Select curve", 4)
    If IsNull(crv) Then Exit Sub
  
    ' Select a point on the curve to offset from      
    Dim pt : pt = Rhino.GetPointOnCurve(crv, "Select point on curve")
    If IsNull( pt) Then Exit Sub
  
    ' Specify the offset distance    
    Dim dist : dist = Rhino.GetReal("Distance to offset point")
    If IsNull(dist) Then Exit Sub
  
    ' Get the closest point on the curve from the test point      
    Dim t : t = Rhino.CurveClosestPoint(crv, pt)
  
    ' Get the curve's domain
    Dim d : Dom = Rhino.CurveDomain(crv)
  
    ' Get the total length of the curve
    Dim l : l = Rhino.CurveLength(crv)
  
    ' Determine the length from the start of the curve to the test point
    Dim ls : ls = Rhino.CurveLength(crv,,Array(Dom(0),t))
  
    ' Offset a point in each direction    
    Rhino.AddPoint Rhino.CurveArcLengthPoint(crv, ls + dist, True)
    'Rhino.AddPoint Rhino.CurveArcLengthPoint(crv, l - ls + dist, False)
  
    ' Add the test point for reference
    'Rhino.AddPoint pt
  
  End Sub

Link to comment
Share on other sites

  • 7 months later...

Hello again

I have one suggestion for this thread

 

It will be enough to me to use the command divide-lenght

but whith the possibility to select the start point.

 

regards

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...