@Anonymous:
Looks like either you copied and pasted maybe not the whole thing, or maybe what works in 2002 doesn't work in 2014 MEP.
Are you sure that tmp.lsp is actually my code, as below again? It might be that you have another tmp.lsp that you are loading.
At the command prompt, enter (findfile "tmp.lsp") and see what folder it points to. Then open the file (in like NotePad) and see if it is the same as I have posted (ignore the blue color you see here as the color doesn't matter). I don't know what else to tell you.
@Kent1Cooper, @ВeekeeCZ, @dbroad: Could you please try my code and indicate what release(s) you used? Many thanks.
(defun c:AddAtts ( / ss i blk blks def AttObj)
(and
(setq ss (ssget '((0 . "INSERT"))))
(setq i (sslength ss))
(while (> i 0)
(setq blk (cdr (assoc 2 (entget (ssname ss (setq i (1- i)))))))
(if (not (vl-position blk blks))(setq blks (cons blk blks)))
)
)
(foreach blk blks
(setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk))
(setq AttObj
(vla-addattribute def
8 ;; height
acAttributeModeInvisible
"YOUR PROMPT"
(vlax-3D-point 72 84) ;; location
"YOUR TAG"
"YOUR DEFAULT VALUE"
)
)
(vlax-put AttObj 'Alignment acAlignmentmiddle) ;; 4
;(command "_.attsync" "_N" blk)
)
(princ)
)
(vl-load-com) (princ)