乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 127|回复: 1

[综合讨论] 沿曲线滑动点

[复制链接]

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-8 17:34:24 | 显示全部楼层 |阅读模式
又是你好
我需要一个脚本沿曲线滑动一个点
命令DIVIDE WITH option Lenght,始终从曲线起点开始。
我找到了这个RhinoScript,但它只适用于Rhino 4。
Rhino 3不支持命令CurveArcLengthPoint。
有人能为Rhino 3制作一个类似的脚本吗。
谢谢
 
  1. ' Option Explicit
  2.   
  3.   Sub OffsetPointOnCurve
  4.   
  5.     ' Select the curve
  6.     Dim crv : crv = Rhino.GetObject("Select curve", 4)
  7.     If IsNull(crv) Then Exit Sub
  8.   
  9.     ' Select a point on the curve to offset from      
  10.     Dim pt : pt = Rhino.GetPointOnCurve(crv, "Select point on curve")
  11.     If IsNull( pt) Then Exit Sub
  12.   
  13.     ' Specify the offset distance   
  14.     Dim dist : dist = Rhino.GetReal("Distance to offset point")
  15.     If IsNull(dist) Then Exit Sub
  16.   
  17.     ' Get the closest point on the curve from the test point      
  18.     Dim t : t = Rhino.CurveClosestPoint(crv, pt)
  19.   
  20.     ' Get the curve's domain
  21.     Dim d : Dom = Rhino.CurveDomain(crv)
  22.   
  23.     ' Get the total length of the curve
  24.     Dim l : l = Rhino.CurveLength(crv)
  25.   
  26.     ' Determine the length from the start of the curve to the test point
  27.     Dim ls : ls = Rhino.CurveLength(crv,,Array(Dom(0),t))
  28.   
  29.     ' Offset a point in each direction   
  30.     Rhino.AddPoint Rhino.CurveArcLengthPoint(crv, ls + dist, True)
  31.     'Rhino.AddPoint Rhino.CurveArcLengthPoint(crv, l - ls + dist, False)
  32.   
  33.     ' Add the test point for reference
  34.     'Rhino.AddPoint pt
  35.   
  36.   End Sub
回复

使用道具 举报

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-8 19:10:20 | 显示全部楼层
又是你好
我对这个帖子有一个建议
 
对我来说,使用divide lenght命令就足够了
但是有可能选择起点。
 
当做
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 01:31 , Processed in 1.730875 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表