eyeofnewt555 Posted January 31, 2017 Posted January 31, 2017 Hey guys, So, is it possible to have a lisp that automatically labels a block based on an attribute? Ideally, it would also be a field so that if the attribute changed, the mulitleader text would as well. For example, let's say I have a dynamic block for an Oak Tree, which has three sizes: 2", 3", & 4". It'd be great if I could run a LISP that would create a multileader that read " 2"-Oak Tree ". It'd be doubly great if the 2" part of that was a field that updated if the dynamic block was changed to its 4" state. For reference, this wonderful Lee Mac LISP is what I currently use for my labeling and it's brilliant. Ideally, I'll end up combining the attribute/field labeling component with this lisp somehow. Lastly, I'm not great at all with writing LISPs, but I'd like to figure out how this one would work so that I can modify it as need be on my own. Thanks for any help! Quote
Grrr Posted February 5, 2017 Posted February 5, 2017 (edited) ; Attribute to mleader with field (defun C:test ( / p ) (and (setq p (nentsel "\nSelect attribute: ")) (= 2 (length p)) (= "ATTRIB" (cdr (assoc 0 (entget (car p))))) (progn (command "_.MLEADER") (while (= (logand (getvar 'cmdactive) 1) 1) (command pause)) ; this is required for multisegment mleader (vla-put-TextString (vlax-ename->vla-object (entlast)) (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectId (vlax-ename->vla-object (car p)))) ">%).TextString>%" ) ) (vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport) ); progn ); and (princ) ); defun Good luck! Edited February 5, 2017 by Grrr 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.