(ssget "_x" ;Creates a selection set from the selected objects
(list ;Start list
(cons 0 "INSERT") ;Filter for insertion
(cons 66 1) ;Filter for attribute
) ;End list
) ;End selection set
) ;End setq
(if ;If the following returns true
(/= ATROT nil) ;Selected blocks are not found
(progn ;Then do the following
(setq INDEX 0) ;Set INDEX to 0
(repeat ;Evaluate expression a specified number of times and return the last
(sslength ATROT) ;Return number of entities in the selection set
(setq ENAME (ssname ATROT INDEX)) ;Return the entity name of the indexed element of the selection set
(setq ELIST (entget ENAME)) ;Retrieve list of entities data
(while ;Continue to evaluate expression till nil
(/= (cdr (assoc 0 ELIST)) "SEQEND") ;Look for assoc list element, 0 entity type, If not =, End sequence
(setq ELIST (entget ENAME)) ;Retrieve entity's data
(if ;If the following returns true
(= "[color=red]TAP-VAL[/color]" (cdr (assoc 2 ELIST))) [color=red];If[/color][color=red] attribute tag is found ~ (Change the attribute tag value here.)[/color]
(progn ;Then do the following
(entmod ;Modify the definition data of an object (entity)
(subst ;Then substitute
(cons 50 (AVR_DTR A:ANG#)) ;New attribute angle
(assoc 50 ELIST) ELIST ;Replace old attribute angle
) ;End subst
) ;End entmod
(entupd ENAME) ;Update the attribute
) ;End progn
) ;End if
(setq ENAME (entnext ENAME)) ;Get the next attribute
) ;End while
(setq INDEX (1+ INDEX)) ;Add one to INDEX
) ;End repeat
) ;End progn
(ALERT "\nNo blocks were not found.") ;Display ALERT if selected blocks are not found
) ;End if
(setq *error* temperr) ;Restore error
(setvar "cmdecho" SUCE) ;Restore saved user cmdecho
(setvar "angbase" SUAB) ;Restore saved user angbase
(setvar "angdir" SUAD) ;Restore saved user angdir
(princ) ;Exit quietly
) ;End define function
(princ "\nAttribute Value Rotate Lisp, AVR.lsp Loaded....") ;Print Expression to command line
(princ "\nType AVR to start program.") ;Print Expression to command line