JRM Posted February 23, 2012 Posted February 23, 2012 Hello, Looking for some code that can help extract both attribute information and multiple lines of text out of one block so i can insert it into another. i have been able to do one or the other but not both in one block at the same time. Thanks, Jess Quote
pBe Posted February 24, 2012 Posted February 24, 2012 sample [retirieve text strings] (defun c:sample (/ a e txtlst atbtlst) (if (setq txtlst nil a (ssget "_:S:E" '((0 . "INSERT")))) (progn (setq e (vlax-ename->vla-object (ssname a 0))) (vlax-for itm (vla-item (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-get-effectivename e)) (if (wcmatch (vla-get-ObjectName itm) "AcDb*Text") (setq txtlst (cons (vla-get-TextString itm) txtlst)))) (setq atbtlst (mapcar (function (lambda (j) (vla-get-textstring j))) (vlax-invoke e 'GetAttributes))) ) ) (foreach itm (list '("TEXT" txtlst) '("ATTRIB" atbtlst)) (if (eval (cadr itm)) (progn (print (car itm)) (foreach str (eval (cadr itm)) (princ (strcat "\n\t\t" str))) ) ) ) (princ) ) Quote
Lee Mac Posted February 24, 2012 Posted February 24, 2012 What's with your code formatting pBe? Are you using Tabs? Quote
pBe Posted February 24, 2012 Posted February 24, 2012 I guess i am. somehow on vlide, when i click format selection it does that. before the indention is not that wide. tried revert to default but still no joy. Quote
JRM Posted February 24, 2012 Author Posted February 24, 2012 That worked great, thanks a lot. Jess Quote
pBe Posted February 25, 2012 Posted February 25, 2012 That worked great, thanks a lot. Jess You are welcome Jess Glad i could help Cheers 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.