Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/20/2018 in all areas

  1. Try the following: ;; Select Blocks by Attribute Tag and/or Value - Lee Mac ;; Selects all attributed blocks in the current layout which contain a specified attribute value. (defun c:selblkbyatt ( / att atx ent idx sel str tag ) (setq str (strcase (getstring t "\nSpecify attribute value <any>: ")) tag (strcase (getstring (strcat "\nSpecify attribute tag" (if (= "" str) ": " " <any>: ")))) ) (if (not (= "" str tag)) (if (and (setq sel (ssget "_X" (list '(000 . "INSERT") '(066 . 1) (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model") ) ) ) ) (progn (repeat (setq idx (sslength sel)) (setq ent (ssname sel (setq idx (1- idx))) att (entnext ent) atx (entget att) flg nil ) (while (and (= "ATTRIB" (cdr (assoc 0 atx))) (not (and (or (= "" str) (wcmatch (strcase (cdr (assoc 1 atx))) str)) (or (= "" tag) (wcmatch (strcase (cdr (assoc 2 atx))) tag)) ) ) ) (setq att (entnext att) atx (entget att) ) ) (if (= "SEQEND" (cdr (assoc 0 atx))) (ssdel ent sel) ) ) (< 0 (sslength sel)) ) ) (sssetfirst nil sel) (princ "\nNo blocks found.") ) ) (princ) )
    1 point
×
×
  • Create New...