Dayananda Posted November 9, 2019 Posted November 9, 2019 How can I get the name of the block by Auto Lisp (not from visual lisp). Quote
dlanorh Posted November 9, 2019 Posted November 9, 2019 4 hours ago, Dayananda said: How can I get the name of the block by Auto Lisp (not from visual lisp). If the block is not dynamic this will return the name of the block (cdr (assoc 2 (entget (car (entsel "\nSelect Block : "))))) 1 Quote
Lee Mac Posted November 9, 2019 Posted November 9, 2019 To cater for standard or dynamic blocks, you could the following Vanilla AutoLISP function, published on my site here: ;; Effective Block Name - Lee Mac ;; ent - [ent] Block Reference entity (defun LM:al-effectivename ( ent / blk rep ) (if (wcmatch (setq blk (cdr (assoc 2 (entget ent)))) "`**") (if (and (setq rep (cdadr (assoc -3 (entget (cdr (assoc 330 (entget (tblobjname "block" blk) ) ) ) '("AcDbBlockRepBTag") ) ) ) ) (setq rep (handent (cdr (assoc 1005 rep)))) ) (setq blk (cdr (assoc 2 (entget rep)))) ) ) blk ) Call the above with a block reference entity name, e.g.: (if (and (setq e (car (entsel "\nSelect block: "))) (= "INSERT" (cdr (assoc 0 (entget e)))) ) (LM:al-effectivename e) ) 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.