if you send me the your email, and if not here is the text to insert near the top of the file.
;; PasteBlockWithName.lsp
;; To require a User-supplied Name for each Block created with the PasteBlock command,
;; at insertion, avoiding the native command's meaningless names, e.g. "A$C578A4EC7".
;; UNDEFINES and MAKES A NEW DEFINITION OF the PasteBlock command.
;; Kent Cooper, last edited 24 June 2015
;; To preserve AutoCAD's PasteBlock command definition, remove the following lines:
(setq cmde (getvar 'cmdecho))
(setvar 'cmdecho 0)
(command "_.undefine" "PASTEBLOCK")
(setvar 'cmdecho cmde)
(setq cmde nil)
;; and Redefine PasteBlock if necessary, CHANGE the COMMAND NAME in the
;; next line of code to something appropriate [it will then NOT be invoked by
;; Ctrl+Shift+V], and adjust descriptive comments above and prompt at end.
(defun C:PASTEBLOCK (/ newname cmde); new definition
(while
(not
(and
(setq newname (lisped "Name for Block to be Inserted"))
; calls up Text Editor with content pre-selected for replacement
(setq newname (vl-string-trim " " newname)); remove any leading/trailing space(s)
(/= newname ""); didn't either clear out or enter only space(s)
(/= newname "Name for Block to be Inserted"); didn't just hit Enter
(not (tblsearch "block" newname)); name not already in use
); and
); not
(alert
(cond
((= newname "") "Empty string or only space(s) not allowed;\nyou must supply a Block name.")
((= newname "Name for Block to be Inserted") "You must supply a new Block name."); Enter only
(T "\nThat Block name is already in use.")
); cond
); alert
); while
(command "_.pasteblock")
(while (> (getvar 'cmdactive) 0) (command pause))
;; finish _.PASTEBLOCK including possible Scale/Rotate options, etc.
(setq cmde (getvar 'cmdecho))
(setvar 'cmdecho 0)
(command "_.rename" "_block" (cdr (assoc 2 (entget (entlast)))) newname)
(setvar 'cmdecho cmde)
(princ)
); defun
my email is
[email protected]