maksolino 发表于 2022-7-8 17:34:24

沿曲线滑动点

又是你好
我需要一个脚本沿曲线滑动一个点
命令DIVIDE WITH option Lenght,始终从曲线起点开始。
我找到了这个RhinoScript,但它只适用于Rhino 4。
Rhino 3不支持命令CurveArcLengthPoint。
有人能为Rhino 3制作一个类似的脚本吗。
谢谢
 
' 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

maksolino 发表于 2022-7-8 19:10:20

又是你好
我对这个帖子有一个建议
 
对我来说,使用divide lenght命令就足够了
但是有可能选择起点。
 
当做
页: [1]
查看完整版本: 沿曲线滑动点