本帖最后由 永不言弃 于 2024-4-28 21:18 编辑
请教一下vlax-curve-getDistAtPoint函数有时候返回不了多段线上任意一个距离起点的距离,怎么完善一下,谢谢
- (defun c:tt()
- (if (and
- (setq ent1 (car (entsel "\n 选择线")))
- (setq ss (ssget (list (cons 0 "INSERT"))))
- )
- (progn
- (setvar"OSMODE" 0)
- (setq obj (vlax-ename->vla-object ent1))
- (repeat (setq k (sslength ss))
- (setq ent (ssname ss (setq k (1- k))))
- (setq pt1 (cdr (assoc 10 (entget ent))))
- (setq pt2 (vlax-curve-getClosestPointTo obj pt1))
- (setq dis (vlax-curve-getDistAtPoint obj pt2))
- (if (= dis nil)
- (entmake (list '(0 . "CIRCLE") (cons 62 3)(cons 10 pt1) (cons 40 2.5)))
- )
- )
- )
- )
- )
|