Display full version of the post: How to auto select blockOLD and blockNEW is lisp r

kameron1967
30.01.2011, 17:42
I wonder if anyone could help me.  I have a routine that matches titleblock attributes, but it prompts me to choose blockOLD and blockNEW.  What I'd like to change is to make the routine automatically choose these two blocknames and carry it as a variable to replace the 2 prompts that it's asking.  This will be used in a script.  Thank you in advance.
 
[code](defun C:MTB (/)
   (setq baselist (list))     
   (setq ename (car (entsel "\nSelect Base Title Block:")))
   (while (= ename nil)
      (princ "\nNothing Picked")
      (setq ename (car (entsel "\nSelect Base Title Block:")))
   );end while
   (setq ename1 (car (entsel "\nSelect Title Block To Apply Changes:")))
   (while (= ename1 nil)
      (princ "\nNothing Picked")
      (setq ename1 (car (entsel "\nSelect Title Block To Apply Changes:")))
   );end while[/code]
 

CarlB
31.01.2011, 00:29
That code allows user to select the 2 blocks, and save the entity names.
 
If the 2 block names are known you can replace that code with:
 
(setq ename (ssname (ssget "x" '((2 . "nameofoldblock"))) 0))

(setq ename1 (ssname (ssget "x" '((2 . "nameofnewblock"))) 0))