明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2354|回复: 11

lisp可以实现曲线上的点沿曲线排序吗?

  [复制链接]
发表于 2011-7-16 18:23:47 | 显示全部楼层 |阅读模式
1,前提是曲线上的点,点都在曲线上,或者距离曲线在容差范围内。
2,选择一批点,得到list点集。
3,按照距离曲线起点距离排序,得到新的list点集。
4,结束!…
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2020-7-6 09:01:34 | 显示全部楼层
本帖最后由 ynhh 于 2020-7-7 08:36 编辑
Gu_xl 发表于 2011-7-16 23:01
回复 tm20038175 的帖子

谢谢G版

发表于 2011-7-16 19:31:12 | 显示全部楼层
可以 利用vlax-curve-getParamAtPoint
 楼主| 发表于 2011-7-16 21:39:49 | 显示全部楼层
这个可能比较困难吧………
 楼主| 发表于 2011-7-16 21:40:33 | 显示全部楼层
不知道有没有人这么做过。
发表于 2011-7-16 22:42:22 | 显示全部楼层
很简单啊。

返回曲线从开始点到指定点的曲线段的长度

(vlax-curve-getDistAtPoint curve-obj point)
参数

curve-obj

要测量的 VLA 对象。

point

curve-obj 上的三维点表(在 WCS 中)。

返回值

如果成功则返回实数,否则返回 nil。

示例

在下例中,假定 splineObj 指向 vlax-curve-getDistAtParam 样例中的样条曲线。

设置 OSNAP 为“切点”并选择直线与曲线相切的点:

_$ (setq selPt (getpoint))
(4.91438 6.04738 0.0)
确定从曲线开始点到选定点的距离:

_$ (vlax-curve-getDistAtPoint splineObj selpt)
5.17769
发表于 2011-7-16 23:01:20 | 显示全部楼层
回复 tm20038175 的帖子

  1. (defun SortPointByCurve (points curve / pl1 xx nn)
  2.   (setq        pl1 (mapcar '(lambda (xx /)
  3.                        (vlax-curve-getparamatpoint
  4.                          curve
  5.                          (vlax-curve-getclosestpointto curve xx)
  6.                        )
  7.                      )
  8.                     points
  9.             )
  10.   )
  11.   (mapcar '(lambda (nn) (nth nn points))
  12.             (vl-sort-i pl1 '<)          
  13.   )
  14. )
 楼主| 发表于 2011-7-16 23:45:09 | 显示全部楼层
回复 Gu_xl 的帖子

哈哈,好人啦,谢谢呵~~~~
突发的想法,回头我要好好研究下~~~
 楼主| 发表于 2011-7-17 23:07:26 | 显示全部楼层
回复 Gu_xl 的帖子

程序挺好的,能不能加一个带容差过滤重复点的功能呀,谢谢了………
发表于 2011-7-19 00:01:37 | 显示全部楼层
回复 tm20038175 的帖子
  1. ;删除表中多余重复点(允许误差)
  2. (defun del-rept (ptLst fuzz / pt1 x)
  3.   ;pts:表  fuzz:精度
  4.   (cond ((= (length ptLst) 1) ptLst)
  5.   (t
  6.    (setq pt1 (car ptLst))
  7.    (cons pt1
  8.    (vl-remove-if
  9.      '(lambda (x) (equal pt1 x fuzz))
  10.      (del-rept (cdr ptLst) fuzz)
  11.    )
  12.    )
  13.   )
  14.   )
  15. )
 楼主| 发表于 2011-7-19 09:42:28 | 显示全部楼层
回复 jh1005 的帖子

好程序,来的及时!
谢啦。。。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-18 03:18 , Processed in 0.187057 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表