tm20038175 发表于 2011-7-16 18:23:47

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

1,前提是曲线上的点,点都在曲线上,或者距离曲线在容差范围内。
2,选择一批点,得到list点集。
3,按照距离曲线起点距离排序,得到新的list点集。
4,结束!…

ynhh 发表于 2020-7-6 09:01:34

本帖最后由 ynhh 于 2020-7-7 08:36 编辑

Gu_xl 发表于 2011-7-16 23:01
回复 tm20038175 的帖子
谢谢G版

露水2 发表于 2011-7-16 19:31:12

可以 利用vlax-curve-getParamAtPoint

tm20038175 发表于 2011-7-16 21:39:49

这个可能比较困难吧………

tm20038175 发表于 2011-7-16 21:40:33

不知道有没有人这么做过。

mandala 发表于 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

Gu_xl 发表于 2011-7-16 23:01:20

回复 tm20038175 的帖子


(defun SortPointByCurve (points curve / pl1 xx nn)
(setq        pl1 (mapcar '(lambda (xx /)
                     (vlax-curve-getparamatpoint
                       curve
                       (vlax-curve-getclosestpointto curve xx)
                     )
                     )
                  points
          )
)
(mapcar '(lambda (nn) (nth nn points))
            (vl-sort-i pl1 '<)          
)
)

tm20038175 发表于 2011-7-16 23:45:09

回复 Gu_xl 的帖子

哈哈,好人啦,谢谢呵~~~~
突发的想法,回头我要好好研究下~~~

tm20038175 发表于 2011-7-17 23:07:26

回复 Gu_xl 的帖子

程序挺好的,能不能加一个带容差过滤重复点的功能呀,谢谢了………

jh1005 发表于 2011-7-19 00:01:37

回复 tm20038175 的帖子

;删除表中多余重复点(允许误差)
(defun del-rept (ptLst fuzz / pt1 x)
;pts:表fuzz:精度
(cond ((= (length ptLst) 1) ptLst)
(t
   (setq pt1 (car ptLst))
   (cons pt1
   (vl-remove-if
   '(lambda (x) (equal pt1 x fuzz))
   (del-rept (cdr ptLst) fuzz)
   )
   )
)
)
)

tm20038175 发表于 2011-7-19 09:42:28

回复 jh1005 的帖子

好程序,来的及时!
谢啦。。。。。。
页: [1] 2
查看完整版本: lisp可以实现曲线上的点沿曲线排序吗?