Hi all,
I've beat my head against the wall trying to understand and alter this useful LSP routine that was provided to me.
Its purpose is to change the description of Cogo Points. It prompts for the desired New Description, then asks for a selection of points, and then changes the description of the selected points to the New Description.
The routine works well, but I wish it cleanly ended the command after the first iteration. Instead, it prompts for the New Description once more.
Can anyone suggest an alteration to the routine so that it stops after this first iteration? Thanks in advance!
Code:
(defun c:chdesc (/ doc ss obj newdesc olddesc)
(vl-load-com)
(setq doc
(vla-get-activedocument (vlax-get-acad-object)))
(while (and (setq newdesc (getstring "\nNew point description:"))
(not (eq newdesc ""))
(setq ss (ssget '((0 . "AECC_COGO_POINT"))))
(setq ctr -1)
)
(vla-startundomark doc)
(while (setq obj (ssname ss (setq ctr (1+ ctr))))
(setq obj (vlax-ename->vla-object obj))
(vlax-put obj 'rawdescription newdesc))
(vla-endundomark doc)
)
(princ)
)