Here's one I scratched out for someone a while back.
Code:
;;; Edit Block Description
;;; Required Subroutines: AT:GetString
;;; Alan J. Thompson, 10.16.09
(defun c:EBD (/ #Obj #Name #Block #Desc)
(and
(setq #Obj (car (entsel "\nSelect block to add description: ")))
(eq "INSERT" (cdr (assoc 0 (entget #Obj))))
(if (vlax-property-available-p (setq #OBj (vlax-ename->vla-object #Obj)) 'EffectiveName)
(setq #Name (vla-get-EffectiveName #Obj))
(setq #Name (vla-get-Name #OBj))
) ;_ if
(setq #Block (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) #Name))
(setq #Desc (AT:GetString "Change block description:" (vla-get-comments #Block)))
(vl-catch-all-apply 'vla-put-comments (list #Block #Desc))
) ;_ and
(princ)
) ;_ defun
You'll need this subroutine:
Code:
;;; Getstring Dialog Box
;;; #Title - Title of dialog box
;;; #Default - Default string within edit box
;;; Alan J. Thompson, 08.25.09
(defun AT:GetString
(#Title #Default / #FileName #FileOpen #DclID #NewString)
(setq #FileName (vl-filename-mktemp "" "" ".dcl")
#FileOpen (open #FileName "W")
) ;_ setq
(foreach x '("TempEditBox : dialog {" "key = \"Title\";"
"label = \"\";" "initial_focus = \"Edit\";" "spacer;"
": row {" ": column {" "alignment = centered;"
"fixed_width = true;" ": text {" "label = \"\";" "}" "}"
": edit_box {" "key = \"Edit\";" "allow_accept = true;"
"edit_width = 40;" "fixed_width = true;" "}" "}"
"spacer;" ": row {" "fixed_width = true;"
"alignment = centered;" ": ok_button {" "width = 11;" "}"
": cancel_button {" "width = 11;" "}" "}" "}//"
)
(write-line x #FileOpen)
) ;_ foreach
(close #FileOpen)
(setq #DclID (load_dialog #FileName))
(new_dialog "TempEditBox" #DclID)
(set_tile "Title" #Title)
(set_tile "Edit" #Default)
(action_tile
"accept"
"(setq #NewString (get_tile \"Edit\"))(done_dialog)"
) ;_ action_tile
(action_tile "cancel" "(done_dialog)")
(start_dialog)
(unload_dialog #DclID)
(vl-file-delete #FileName)
#NewString
) ;_ defun