- (defun c:3wzb()
- (vl-load-com)
- (setq filename0 (getfiled "请指定保存位置" "e:\\三维多段线坐标.txt" "txt" 1))
- (setq txtfile (open filename0 "w"))
-
- (if (setq ssa (ssget '((0 . "POLYLINE"))))
- (progn
- (setq i 0
- n (sslength ssa)
- ptb nil
- no 0
- )
- (repeat n
- (setq obj (vlax-ename->vla-object (ssname ssa i))
- pts (vlax-get-property obj "Coordinates")
- pts (vlax-safearray->list (vlax-variant-value pts))
- i (1+ i)
- m (/ (length pts) 3)
- )
- (repeat m
- (setq x (car pts)
- pts (cdr pts)
- y (car pts)
- pts (cdr pts)
- z (car pts)
- pts (cdr pts)
- pt (list x y z)
- ptb (cons pt ptb)
- no (1+ no)
- )
- (princ (strcat "\n顶点" (itoa no) " x=" (rtos x 2 3) " y=" (rtos y 2 3) " z=" (rtos z 2 3) ) )
- (write-line (strcat "顶点" (itoa no) "," (rtos x 2 3) "," (rtos y 2 3) "," (rtos z 2 3)) txtfile)
- )
- )
- (setq ptb (reverse ptb))
- (close txtfile)
- (startapp "notepad" filename0)
- )
- )
- (princ)
- )
|