Jump to content

alanjt's Misc. Useful Lisp Subroutines


Recommended Posts

Posted
;; Extract textstring (with symbols) from text object
;; Works on: MText, Text, Attrib, Attdef, Multileader
;; Obj - Object to extract textstring from
;; Alan J. Thompson, 11.24.09 / 04.13.10
(defun AT:TextString (Obj)
 (if Obj
   ((lambda (e s)
      (cond ((eq (cdr (assoc 0 e)) "MULTILEADER") (cdr (assoc 304 e)))
            ((vl-position (cdr (assoc 0 e)) '("ATTDEF" "ATTRIB" "MTEXT" "TEXT"))
             (foreach x e (and (vl-position (car x) '(1 3)) (setq s (strcat s (cdr x)))))
             s
            )
      )
    )
     (cond ((vl-consp Obj) (entget (car Obj)))
           ((eq (type Obj) 'ENAME) (entget Obj))
           ((eq (type Obj) 'VLA-ObjECT) (entget (vlax-vla-Object->ename Obj)))
     )
     ""
   )
 )
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...