一段程式的奇怪现象,大家看看
;如下一段程试,当将座标转动任意角度后执行不了;在世界座标下正常;不明白为什么这段产生异常
;(setq pt (vlax-curve-getClosestPointTo (car en) (cadr en)))
;(setq endata (entget (car en))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:test1 ( );(/ a0 a50 a51 a40 endata str zb enpaa pbb);enpt
(vl-load-com)
(while (not (and (setq en (entsel "\n请选择要拉伸多段线:"))
(ssget (cadr en)
(list (cons -4 "<or")
(cons 0 "*polyline")
(cons 0 "line")
(cons 0 "spline")
(cons 0 "mline")
(cons 0 "arc")
(cons -4 "or>")
)
)
)
)
)
(setq pt (vlax-curve-getClosestPointTo (car en) (cadr en)))
(setq endata (entget (car en))
)
(setq newdyx (car en))
(if (or (= "LWPOLYLINE" (dxf 0 newdyx)) (= "SPLINE" (dxf 0 newdyx)) (= "MLINE" (dxf 0 newdyx)))
(progn
(command "explode" newdyx)
))
(setq enpt (car (nentselp pt)))
(command "erase" enpt ""))
;;获取群码
(defun dxf (n ename)
(cdr (assoc n (entget ename)))
)
函数vlax-curve-getClosestPointTo 在wcs坐标系里才会返回真确的值。
页:
[1]