飞哥,下面是我写的,请指教:
-
- (defun getTwoPts (pt0 ptList / ss0 i lastent ptEnd1 ptEnd2)
- (setq var1 (getvar "osmode"))
- (setvar "osmode" 0)
- (setq i 0)
- (repeat (- (length ptList) 1)
- (vl-cmdf "line" (nth i ptList) (nth (+ 1 i) ptList) "")
- (setq lastent (entlast))
- (if (equal (vlax-curve-getClosestPointTo
- (vlax-ename->vla-object lastent)
- pt0
- )
- pt0
- )
- (progn
- (setq ptEnd1 (nth i ptList)
- ptEnd2 (nth (+ 1 i) ptList)
- )
- )
- )
- (setq i (+ 1 i))
- (vl-cmdf "ERASE" lastent "")
- )
- (setvar "osmode" var1)
- (append (list ptEnd1) (list ptEnd2))
- )
pt0要为3D点,ptlist的长度是变化也可用。 |