- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
This is propbably a simple one for author or for anyone who is good in lisp.
Attached is lisp which is adding command changing name of pasted already block by just selecting it.
It is very nice.
Only one thing which users do not so much may like is that it works such that you need to select the block after function is started.
I mean if user just select a block and start command he still need to select this block again.
Is it possible to adjust that lisp so that it will work in both cases: selecting before command is started and selecting after command is started ?
A nice addition would be also a window which appear on screen where one need to enter name, it kind of make user more aware of whats happening. This is tried self by pasting some code from other post but obviously it was not that simple.
Could you help ?
Here is lisp.
;beginning
;; RenameBlock.lsp [command name: RB]
;; To Rename a selected Block to a User-specified new
;; name, without needing to know its current name.
;; Kent Cooper, last edited 18 April 2013
(defun C:RB (/ old new cmde); = Rename user-selected Block
(while
(not
(and
(setq bent (car (entsel "\nSelect Block to Rename: ")))
(setq bdata (entget bent))
(= (cdr (assoc 0 bdata)) "INSERT")
(setq old (cdr (assoc 2 bdata)))
(not (assoc 1 (tblsearch "block" old))); not an Xref
); and
); not
(prompt "\nNothing selected, or not a Block.")
); end while
(setq new (getstring T (strcat "\nCurrent name = " old ". New Block Name: ")))
(if (/= new ""); User entered a new name
(progn ; then
(setq cmde (getvar 'cmdecho))
(setvar 'cmdecho 0)
(command "_.rename" "_block" old new)
(setvar 'cmdecho cmde)
); progn
); if
(princ)
); defun
;end
regards
miroko
Solved! Go to Solution.