;; dxfval.lsp ;; ;; A simple lisp, which prints the dxf properties of elements to the console ;; ;; Created by Peter Gyetvai ;; gyetpet@gmail.com ;; gyetvai-peter.hu (defun C:dxfval (/ i imax il j jmax jl x ss currElem code groupCode en2 enlist2 ) ;variables: (setq i 0);counter to zero (setq imax 1);while variable (setq j 0);counter to zero (setq jmax 1);while variable ;; (vl-load-com) (graphscr) (initget 1 "Pick All") (setq x (getkword "Pick elements or all? [Pick/All]")) (if (= x "Pick") (progn (prompt "\nSelect elements: [All]") (setq ss (ssget));asks for selection ) (setq ss (ssget "_X")) ) (setq il (sslength ss));length of selection (prompt "\nDxf group code: (leave empty for all) ") (setq groupCode (getint)) (print groupCode) (while imax (print ) (print ) (princ "Checking element ") (princ (1+ i)) (princ "/") (princ il) (setq currElem (entget (ssname ss i) )) (if groupCode (progn (print (cdr (assoc groupCode currElem))) ) (progn (setq jl (length currElem)) (while jmax (print (nth j currElem)) (setq j (1+ j));increments i (if (= j jl) (setq jmax nil));finish function if i equals il ) (setq j 0);counter to zero (setq jmax 1);while variable (setq en2(entnext (ssname ss i))) ;- Get the next sub-entity (if en2 (progn (print ) (princ "Sub entities: ") (setq enlist2(entget en2)) ;- Get the DXF group codes (while (/= (cdr(assoc 0 enlist2)) "SEQEND") ;- Start the while loop and keep ;- looping until SEQEND is found. (princ "\n ") ;-Print a new line (princ enlist2) ;- Print the attribute DXF group codes (setq en2(entnext en2)) (setq enlist2(entget en2)) (print "enlist2 ok") ) ) (progn (print ) (princ "No sub entities") ) ) ) ) (if (not (or (= il 1)(= (1+ i) il))) (progn (prompt "\nPress any key to continue to the next element: ") (setq code (grread)) ) ) ;while specific: (setq i (1+ i));increments i (if (= i il) (setq imax nil));finish function if i equals il ) (setq ss nil) (princ) )