Author Topic: [XDrX-PlugIn(31)] Mleader Lead direction freely changed (up, down, left, right..  (Read 951 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
Supports the direction change operation after turning MLEADER into BLOCK

Code - Auto/Visual Lisp: [Select]
  1. (defun c:XDTB_MLeaderFX (/ ents old sel ss str tf x)
  2.    (xd::doc:checkacadversion '>= "2008" "")
  3.    (xdrx-begin)
  4.    (xdrx-initssget "\nSelect multileader <exit>:")
  5.    (if (setq ss (xdrx-ssget
  6.                   '((-4 . "<or")
  7.                     (0 . "MULTILEADER")
  8.                     (2 . "XMLEADER*")
  9.                     (-4 . "or>")
  10.                    )
  11.                 )
  12.        )
  13.      (progn
  14.        (setq ents (xdrx_pickset->ents ss))
  15.        (while (and
  16.                 (xdrx-initget "D A E")
  17.                 (setq sel
  18.                        (getkword
  19.                          "\rInput direction [Up/Down(E)|Left/Right(D)|Oblique(A)<Exit>:"
  20.                        )
  21.                 )
  22.               )
  23.          (mapcar
  24.            '(lambda (x)
  25.               (if (setq tf (xdrx_object_isa x "AcDbBlockreference"))
  26.                 (progn (setq old x)
  27.                        (xdrx-entity-explode x)
  28.                        (setq x (entlast))
  29.                 )
  30.               )
  31.               (cond ((= sel "E") (xdrx-setpropertyvalue x "mirror" 1))
  32.                     ((= sel "D") (xdrx-setpropertyvalue x "mirror" 0))
  33.                     ((= sel "A") (xdrx-setpropertyvalue x "mirror" 2))
  34.               )
  35.               (if tf
  36.                 (progn
  37.                   (setq str (strcat "XMLEADER-"
  38.                                     (xdrx-getpropertyvalue x "handle")
  39.                             )
  40.                   )
  41.                   (xdrx-block-make
  42.                     str
  43.                     x
  44.                     (xdrx-getpropertyvalue x "firstvertex" 0)
  45.                     t
  46.                   )
  47.                   (xdrx-entity-setpropertiesfrom (entlast) x)
  48.                   (xdrx-object-swapid (entlast) old)
  49.                 )
  50.               )
  51.             )
  52.            ents
  53.          )
  54.        )
  55.      )
  56.    )
  57.    (xdrx_end)
  58.    (princ)
  59. )
« Last Edit: December 03, 2023, 08:50:49 AM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net