AutoLISP: извличане на точки във файл
Публикувано на: Вто Фев 12, 2008 1:09 pm
знам че има много други начини, но все пак реших да кача и този скрипт .
след като се зареди се стартирва с getpnt след което се посочва името на изходния файл и се селектират последователно точката и номера на точката.
http://dyp.data.bg/Software/Acad%20tool ... GETPNT.LSP(defun C:GETPNT ()
(setvar "CMDECHO" 0)
(setq fn (getstring "\nEnter output filename: "))
(setq p T pl ())
(while p (progn
(command "OSNAP" "NOD")
(setq p (entsel "\nSelect a point to save: "))
(command "OSNAP" "NON")
(if p (progn
(setq e (entget (car p)))
(if (= (cdr (assoc 0 e)) "POINT") (progn
(setq p (assoc 10 e) y (cadr p) x (caddr p) z (cadddr p))
(setq p (entsel "\nSelect point number: "))
(if p (progn
(setq e (entget (car p)))
(if (= (cdr (assoc 0 e)) "TEXT")
(setq n (cdr (assoc 1 e))) (setq n " "))
) (setq n " "))
(while (< (strlen n) 6) (setq n (strcat " " n)))
(setq x (rtos x 2 3) y (rtos y 2 3) z (rtos z 2 3))
(while (< (strlen x) 10) (setq x (strcat " " x)))
(while (< (strlen y) 10) (setq y (strcat " " y)))
(while (< (strlen z) 10) (setq z (strcat " " z)))
(setq s (strcat n "," x "," y "," z))
(princ "\n") (princ s)
(setq pl (cons s pl) p t)
) (princ "\n\nThis is no point !!!"))
))
))
(setq pl (reverse pl))
(setq f (open fn "w"))
(while pl (progn
(setq p (car pl) pl (cdr pl))
(write-line p f)
))
(close f)
)
след като се зареди се стартирва с getpnt след което се посочва името на изходния файл и се селектират последователно точката и номера на точката.