Print Page | Close Window

How to remove prompt and specify block name

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=5473
Printed Date: 10.Jun.2026 at 21:02


Topic: How to remove prompt and specify block name
Posted By: kameron1967
Subject: How to remove prompt and specify block name
Date Posted: 14.Mar.2011 at 15:55
I'm looking to replace the selection option to it automatically selecting "BlockA".  How would you change this, please.
Code:

(setq ss (nth 3
  (vlax-invoke
    (vlax-ename->vla-object (car (entsel "\nSelect Block: ")))
    'GetAttributes)))



Replies:
Posted By: CarlB
Date Posted: 14.Mar.2011 at 20:55
One way:
 
Instead of
(car (entsel "\nSelect Block: "))

use
 
(ssname (ssget "_X" '((0 . "INSERT")(2 . "BlockA"))) 0)


Posted By: kameron1967
Date Posted: 14.Mar.2011 at 21:49
Carl - does it replace the code above?  If not, I wonder how I would put that information in there so that it reads the block name, instead of asking for it.  Thanks!


Posted By: CarlB
Date Posted: 14.Mar.2011 at 23:10
This is the complete code after substitution:
 
(setq ss (nth 3
  (vlax-invoke
    (vlax-ename->vla-object
       (ssname (ssget "_X" '((0 . "INSERT")(2 . "BlockA"))) 0))
    'GetAttributes)))


Posted By: kameron1967
Date Posted: 14.Mar.2011 at 23:26
Excellent.  Thanks, CarlB! Smile



Print Page | Close Window