Jump to content

Multileader That Inserts An Attribute From A Block


rod_smithsr
 Share

Recommended Posts

Help! I need a lisp that allows a multileader to automatically insert a block attribute after I associate that multileader with the dynamic block. For instance, i have a few dynamic blocks with attributes in model space and I am tagging them in paper space. After i choose a multileader (that I created with a block) I would like that multileader to automatically insert the number of the device that Im tagging. Help!!

Link to comment
Share on other sites

No I have not. Can it be done in that method?

Not sure about your current release, but it can be done on A2009:

 

(defun C:attm (/  acsp adoc blk fld id mlead p1 p2 ptarr sset )
 (vl-load-com)
 (or adoc
     (setq adoc
     (vla-get-activedocument
       (vlax-get-acad-object)
       )
    )
     )
 (if (and
(= (getvar "tilemode") 0)
(= (getvar "cvport") 1)
)
   (setq acsp (vla-get-paperspace adoc))
   (setq acsp (vla-get-modelspace adoc))
   )
 (while
(setq sset (ssget "+.:S:E:L" (list (cons 0 "insert")(cons 66 1))))
(setq blk (vlax-ename->vla-object (ssname sset 0)))
(foreach att (vlax-invoke blk 'getattributes)
 (if (eq "MYTAG" (vla-get-tagstring att));<--- Change attribute tag here
   (setq id (vla-get-objectid att))))
(setq  fld (strcat "%<[url="file://\\AcObjProp"]\\AcObjProp[/url] Object(%<[url="file://\\_ObjId"]\\_ObjId[/url] " (rtos id 2 0) " >%).TextString [url="file://\\f"]\\f[/url] \"%tc1\">%"))
     (setq p1 (getpoint  "\nLeader Arrow >> \n")
    p2 (getpoint p1 "\nText location >> \n")
    )
     (setq ptarr (vlax-make-variant
     (vlax-safearray-fill
       (safearray vlax-vbdouble '(0 . 5))
       (apply 'append (list p1 p2))))
    )
     (setq mlead (vla-addmleader acsp ptarr 0))
     (vla-put-contenttype mlead acMTextContent)
      ;; change to your standards here:
     (vla-put-textheight mlead(getvar "dimtxt"))
     (vla-put-landinggap mlead 0.09)      
     (vla-put-doglegged mlead :vlax-true)
     (vla-put-dogleglength mlead 0.05)
    (vla-put-textstring mlead fld)
     ;;borrowed from Lee Mac:
     (vla-setdoglegdirection
mlead
0
(vlax-3D-point
  (list
    (if (<= (car p1) (car p2))
      1
      -1)
    0
    0
    )
  )
)
     (if (>= (car p2) (car p1))
     (vla-put-TextJustify mlead acAttachmentPointMiddleLeft)
     (vla-put-TextJustify mlead acAttachmentPointMiddleRight)
)
     (vla-put-TextLeftAttachmentType mlead acAttachmentBottomOfTopLine)
     (vla-put-TextRightAttachmentType mlead acAttachmentBottomOfTopLine)
     (vla-put-leaderlineweight mlead acLnWt025)
     (vla-put-leadertype mlead 1)
     )
 (vla-regen adoc acactiveviewport)
 (princ)
)
(prompt "\n")
(prompt "\t\t<<< Start command with ATTM ...\t>>> ")
(princ)

 

~'J'~

Link to comment
Share on other sites

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
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.

 Share

×
×
  • Create New...