chavlji Posted March 23, 2009 Posted March 23, 2009 Hello To get Block Name of selected block entity I use: (setq Name (cdr (assoc 2 Ent)) ) It works fine but not with dynamic blocks. If I try to get name of dynamic block with it I get some strange names like *U126, *U123. How to get the real definition name of these blocks? Quote
David Bethel Posted March 23, 2009 Posted March 23, 2009 "*U" Block names are valid. They indicate the the BLOCK is anonymous. You can look up the BLOCK table definitions just as you can any other block ( tblsearch "BLOCK" *U123") What you can not assume is that the name will be the same every time that you open the drawing. The names change based on many others things. -David Quote
chavlji Posted March 23, 2009 Author Posted March 23, 2009 And if I know the *U name, how can I get the Name of this block definition? Like if I define dynamic block "DOORS". Then create entity of this doors that gets name "*U123", how do I know that "*U123" derives from "DOORS"? Quote
wizman Posted March 23, 2009 Posted March 23, 2009 please try: (defun c:dynname (/ ed) (prompt "\n....Select a Block...:") (and (assoc 360 (setq ed (entget (ssname (ssget "_:E:S" '((0 . "INSERT")))0)))) ;_ {setq (repeat 3 (setq ed (entget (cdr (assoc 360 ed))) ) ;_ {setq ) ;_ {repeat (setq ed (entget (cdr (assoc 340 ed)))) ) ;_ {and (setq ed (cdr (assoc 2 ed))) ) ;_ {defun Quote
wizman Posted March 23, 2009 Posted March 23, 2009 Wizman, you are a genius lee, thanks but im still studying....'-) Quote
ASMI Posted March 23, 2009 Posted March 23, 2009 Or (vla-get-EffectiveName (vlax-ename->vla-object (car(entsel "\nSelect block: ")))) Do not foget (vl-load-com). 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.