Community
Hi,
For quite a long time that I have been working with this modified LISP from LeeMac:
(defun c:eg02 ( / lst-str pl4ext name_lines actual_name nomebase s l) (defun lst-str (lst del / st strout) (setq strout (car lst)) (foreach st (cdr lst) (setq strout (strcat strout del st)) ) strout ) (defun pl4ext ( / f i o ) (if (setq f (open actual_name "w")) (progn (repeat (setq i (sslength s)) (setq o (vlax-ename->vla-object (ssname s (setq i (1- i))))) (princ (apply 'strcat (vl-list* "\n\n+Layer+" (vla-get-layer o) "\n+ObjHd+" (vla-get-handle o) "\n+Width+" (rtos (vla-get-constantwidth o)) "\n" ( (lambda ( a ) (a (vlax-get o 'coordinates))) (lambda ( b ) (if b (cons (strcat "+"(rtos (car b)) "," (rtos (cadr b)) "\t") (a (cddr b)) ) ) ) ) ) ) f ) ) (close f) ) ) (princ) ) (setq nomebase (getstring "\nInsert name:")) (setq name_lines (strcat nomebase "_ln.txt")) (setq l "LINES") (setq s (ssget "_X" (list '(0 . "LWPOLYLINE") (cons 8 (strcat l "*"))))) (princ s) (setq actual_name name_lines) (pl4ext) (princ) ) (vl-load-com) (princ)
Suddenly, on a new drawing, it has just started to give me the error message
"; error: Automation Error. Invalid input"
This LISP is supposed to extract all the polylines and some related info from them.
Anyone?
You should have LWpolyline on layer LINES****** to let the code works as expected .
and to avoid this error to to be prompted when it does not match the above said issues , just add if function like this .
(if (setq s (ssget "_X" (list '(0 . "LWPOLYLINE") (cons 8 (strcat l "*"))) ) ) (progn (princ s) (setq actual_name name_lines) (pl4ext) ) )
Can't find what you're looking for? Ask the community or share your knowledge.