mfkozlow
17.10.2014, 16:18
Hell everyone.I currently have the following lisp file:[CODE](defun C:get_att() (if (setq ss (ssget "_F" '((7 2.5) (13.5 2.5)) '((0 . "INSERT"))))(progn (setq en (ssname ss 0)) (setq enlist(entget en)) ;- Get the DXF group codes (setq blkType(cdr(assoc 0 enlist))) ;- Save the type of entity (if (= blkType "INSERT") ;- If the entity type is an Insert entity (progn (if(= (cdr(assoc 66 enlist)) 1) ;- See if the attribute flag equals one (if so, attributes follow) (progn (setq en2(entnext en)) ;- Get the next sub-entity (setq enlist2(entget en2)) ;- Get the DXF group codes (setq enlist3(cdr(assoc 1 enlist2))) (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)) ;- Get the next sub-entity (setq enlist2(entget en2)) ;- Get the DXF group codes ) ) ) ;- Close the if group code 66 = 1 statement ) ) ;- Close the if block type = "ATTRIB" statement)) ;- Close the if an Entity is selected statement)[/CODE] The lisp above gathers many useful pieces of information from the block that it intersects. I use this information later on in variables.At the beginning of the lisp the ss get function is utilized. Instead of the way it is working right now, I would like to use the following code for the ss get function.[CODE](defun c:thaw ( / a ex)(setq ex nil)(while (setq a (tblnext "LAYER" (null a))) (if (and (or (> (cdr (assoc 70 a)) 0) (minusp (cdr (assoc 62 a))) ) (not (wcmatch (cdr (assoc 2 a)) "*|*")) ) (setq ex (cons (strcat "," (cdr (assoc 2 a)) ) ex)) ) ) ;;; For selection and processing ;;; ;;;(setq ss (ssget "_X" ;;; (append ;;; (list (cons 410 (getvar 'ctab))) ;;; (if ex ;;; (list ;;; '(-4 . "<NOT") ;;; (cons 8 (strcat (apply 'strcat ex))) ;;; '(-4 . "NOT>") ;;; ) ;;; '(8 . "*") ;;; ) ;;; ) ;;; ) ;;; ) ;;; (textscr) ;;; Demo purposes ;;; (princ "\nExcluded Layers from selection:") (foreach itm (reverse ex) (princ (strcat "\n" (substr itm 2))));;; ;;; (princ) )[/CODE] The lisp above scans for all the layers that are off and returns the names of these layers in a list format.So in conclusion, I would like the ss get function to scan for all the layers that are turned off and exclude those layers from my selection. Using that list I would like to use this exact function[CODE](if (setq ss (ssget "_X" '((2 . "SYSTEM_SP_Q"))))[/CODE]instead of using this[CODE](if (setq ss (ssget "_F" '((7 2.5) (13.5 2.5)) '((0 . "INSERT"))))[/CODE]So to clear things up. First the lisp file will scan for the layers that are turned off. Once it knows this list I want it to exclude all the layers in that list (the ones that are off) and use it along with this function:[CODE](if (setq ss (ssget "_X" '((2 . "SYSTEM_SP_Q"))))[/CODE]Thank you in advance for anyone who takes the time to read all of this.