本帖最后由 song宋_74729 于 2022-4-4 14:52 编辑
XYP1964版主 谢谢
(defun c:tt () (vl-load-com) (setq en(car (entsel))) (setq lst(list (mapcar '(lambda (x) (rtos x 2 3)) (vlax-curve-getStartPoint en)) (mapcar'(lambda (x) (rtos x 2 3)) (vlax-curve-getEndPoint en)) ) ) ) (setq ffn (getfiled "坐标写入文本文件" "D:/" "TXT" 1)) (setq opf (open ffn "w")) (setq ss (ssget '((0 . "*LINE")))) (setq kg " ") (setq txt (strcat kg "X坐标"kg "Y坐标")) (write-line txt opf) ;(princ (strcat kg "X坐标" kg "Y坐标") opf) (setq i -1) (setq key 10) (repeat (sslength ss) (setq ent (entget (ssname ss (setq i (1+ i))))) (setq count 1) (foreach xy ent (if (eq (car xy) key) (progn (setq pe (cdr xy)) (setq x (rtos(cadr pe)2 3)) (setq y (rtos(car pe)2 3)) (write-line (strcat (itoa count) kg x kg y) opf) ;(princ "\n" opf) ;(princ (strcat (itoa count) kg x kg y) opf) (setq count (1+ count)) ) ) ) )
|