Author Topic: [XDrX-PlugIn(18)] Text,Mtext Convert to MLeader  (Read 962 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
[XDrX-PlugIn(18)] Text,Mtext Convert to MLeader
« on: November 28, 2023, 08:13:57 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2. ;|
  3. Insertion point  : the insertion point of the same text
  4. Lead length      :     3 times word height
  5. Lead angle       : 45 degrees
  6. Horizontal length: 1 times the word height
  7. Arrow size       : (1/3) character height
  8. |;
  9.   (if (setq ss (xdrx-ssget
  10.                  "\nSelect the Text to be converted,Mtext<Exit>:"
  11.                  '((0 . "*text"))
  12.                )
  13.       )
  14.     (progn
  15.       (xdrx-begin)
  16.       (mapcar '(lambda (x)
  17.                  (xdrx-getpropertyvalue
  18.                    x "textstring" "position" "textheight" "rotation")
  19.                  (setq #length   (* #textheight 3.0)
  20.                        #rotation (+ #rotation (/ pi 4.0))
  21.                        doglen    #textheight
  22.                        arrowsize (/ #textheight 3.0)
  23.                  )
  24.                  (setq mleader (xdrx-mleader-make
  25.                                  #position     #rotation
  26.                                  #length       #textstring
  27.                                  #textheight   doglen
  28.                                  arrowsize
  29.                                 )
  30.                  )
  31.                  (xdrx-entity-matchprop x mleader)
  32.                  (xdrx-object-swapid x mleader)
  33.                  (xdrx-entity-delete mleader)
  34.                )
  35.               (xdrx-pickset->ents ss)
  36.       )
  37.       (xdrx-end)
  38.     )
  39.   )
  40.   (princ)
  41. )
  42.  
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