Print Page | Close Window

How to auto select blockOLD and blockNEW is lisp r

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=5222
Printed Date: 18.May.2026 at 03:13


Topic: How to auto select blockOLD and blockNEW is lisp r
Posted By: kameron1967
Subject: How to auto select blockOLD and blockNEW is lisp r
Date Posted: 30.Jan.2011 at 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. Smile

 

(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

 




Replies:
Posted By: CarlB
Date Posted: 31.Jan.2011 at 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))
 
 



Print Page | Close Window