多段线部分的长度
你好是否有lisp脚本来测量多段线的长度部分?我想选择(仅一条)多段线,现在选择多段线上的点A,以及多段线上的下一个点B。然后我得到这条多段线的一部分长度(不切割这条多段线…)。
问候语 (Defun c:demo (/ p1 p2 obj)
(and
(setq p1 (getpoint "\nPick Point A"))
(setq
p2 (getpoint p1 "\nPick point B")
)
(setq obj (car (nentselp p1)))
(print (abs (- (vlax-curve-getdistatpoint
obj
(vlax-curve-getclosestpointto obj p1)
)
(vlax-curve-getdistatpoint
obj
(vlax-curve-getclosestpointto obj p2)
)
)
)
)
)(princ)
) 我看到pBe打败了我。
这是我的密码。
(defun c:Test (/ _LW-p 1p o 2p a b d e)
;; Tharwat 11. Mar. 2014 ;;
;; Measure distance on Polyline by ;;
;; picking two points ;;
(defun _LW-p (p / e o n)
(if (setq e (ssget p '((0 . "LWPOLYLINE"))))
(setq o (cdr (assoc -1 (entget (setq n (ssname e 0))))))
)
(list o n)
)
(if (and (setq 1p (getpoint "\n Specify point on Polyline :"))
(car (setq o (_LW-p 1p)))
(setq 2p (getpoint "\n Specify point on the same Polyline :"))
(if (eq (car o) (car (_LW-p 2p)))
t
(alert "You should pick two points on the same polyline ")
)
)
(progn (cond ((equal (setq a (vlax-curve-getdistatpoint (setq e (cadr o)) 1p))
(setq b (vlax-curve-getdistatpoint e 2p))
1e-8
)
(setq d 0.)
)
(t
(if (> a b)
(setq d (- a b))
(setq d (- b a))
)
)
)
(alert (strcat "Distance is : < " (rtos d 2) " > ."))
)
)
(princ)
)
(vl-load-com)
嗨,塔尔瓦特。我觉得少了点什么。如果在多段线上有2个特定点,并使用osnap节点选择lisp停止的第一个点。
我认为那样会更有用
1) 选择多段线
2) 指定多段线上的第一个点
3) 指定多段线上的第二个点
4) (警报(strcat“距离为:.”)
我知道,它停止了,因为你在点对象上选择了一个点,而不是在多段线上。 这是我不久前做的一个。。。
http://cadtips.cadalyst.com/distance/determine-distance-between-points-entity
非常好!谢谢分享 非常感谢。
页:
[1]