Dear Helpers,
I have a lisp code that can copy single element from block and convert to cyan color.
I need a small change to the code that can copy multiple elements from block.
(DEFUN C:CN ()
(COMMAND "NCOPY" PAUSE "" "0,0" "@" "")
(COMMAND "CHANGE" "L" "" "P" "C" "4" ""))
Regards,
T.Brahmanandam
Solved! Go to Solution.
Solved by dbhunia. Go to Solution.
Solved by Moshe-A. Go to Solution.
@tnvsb hi,
your lisp command is very simple and apparently to make it select multiple entities is not.
first there is a need to collect the pick points in list and than to invoke ncopy and loop through these points.
when ncopy is finished, you have to collect all new entities that were added to drawing.
if you do not understand what I did just ask?!
note: I changed the command name.
discovered weird thing: ncopy turn cmdecho to on.
enjoy
moshe
(defun C:MCN (/ ename0 points^ pick ss) ; (command ".ncopy" pause "" "0,0" "@" "") ; (command ".change" "l" "" "p" "c" "4" "") (setvar "cmdecho" 0) (command "_.undo" "_begin") (setq ename0 (entlast)) ; store last entity name (setq points^ '()) ; reset list buffer (while (setq pick (entsel "\nSelect nested entity to copy: ")) (setq points^ (append points^ (list (cadr pick)))) ) (if points^ (progn (command "_.ncopy") ; start ncopy command (foreach pt points^ ; loop throuh picked points (command pt) ); foreach (command "" "0,0" "") ; finish ncopy (setvar "cmdecho" 0) ; turns out that ncopy set cmdecho on. ; create selection set (setq ss (ssadd)) (while (setq ename0 (entnext ename0)) (ssadd ename0 ss) ) (command "_.chprop" "_si" ss "_color" 4 "") ; change color ); progn ); if (command ".undo" "_end") (setvar "cmdecho" 1) (princ) )
try this
(defun c:DEBA (/ lastent ss)
(setq lastent (entlast))
(setq ss (ssadd))
(command "_.ncopy")
(while (> (getvar "cmdactive") 0)
(command pause "0,0" "0,0")
)
(while (setq lastent (entnext lastent))
(ssadd lastent ss)
)
(command "chprop" ss "" "C" 4 "")
)