这应该会更好。不要分割多段线;只需运行Lisp并在CSV文件中查看坐标
- (defun c:Plist( / s ss file f i en el a st)
- ;| Grabs the 3DPolylines found in the drawing
- and saves the vertices in a CSV file
- mfuccaro@hotmail.com 11 Oct 2011 |;
- (setq s ",") ;separator can be ";" or "," -Change to suit
- ;(setq s ";")
- (setq ss (ssget "X" '((0 . "POLYLINE")(-4 . "&=")(70 . )))
- (setq file (getfiled "Output file" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 3)) "Csv" 5))
- (setq f (open file "w"))
- (princ (strcat "\n" (itoa (setq i (sslength ss))) " polilines found \nX" s "Y" s "Z") f)
- (repeat i
- (setq en (entnext (ssname ss (setq i (1- i)))) el (entget en))
- (while (= (cdr (assoc 0 el)) "VERTEX")
- (setq a (mapcar 'rtos (cdr (assoc 10 el)))
- st (strcat (car a) s (cadr a) s (caddr a)))
- (princ (strcat "\n" st) f)
- (setq el (entget (setq en (entnext en))))
- )
- (princ "\n" f)
- )
- (close f)
- (setq s "File saved")
- )
|