Author Topic: [XDrX-PlugIn(38)] Create WIPEOUT for text and attributes  (Read 284 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 481
[XDrX-PlugIn(38)] Create WIPEOUT for text and attributes
« on: December 09, 2023, 12:40:55 PM »
word height ratio :

The outward offset distance of the border is the reciprocal of the proportional value of the current text height.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2.   (xdrx-begin)
  3.   (if (not #xd-var-offsetx)
  4.     (setq #xd-var-offsetx 5.0)
  5.   )
  6.   (if (setq offsetX (getreal (xdrx-string-format
  7.                                 "\nInput offset coefficient (word height ratio) <%0.1f>:"
  8.                                 #xd-var-offsetx
  9.                               )
  10.                      )
  11.        )
  12.     (setq #xd-var-offsetx offsetx)
  13.   )
  14.   (while (setq e (car (xdrx-nentselex
  15.                          "\nSelect text or attribute <Exit>:"
  16.                          '((0 . "text,attrib"))
  17.                        )
  18.                  )
  19.          )
  20.     (setq box       (xdrx-entity-box e)
  21.           box       (xdrx-points-ucs2wcs box)
  22.           box       (xd::pnts:close box)
  23.           txth      (xdrx-getpropertyvalue e "textheight")
  24.           offsetbox (xdrx-points-offset (/ txth #xd-var-offsetx) box)
  25.           randstr (xdrx-string-rand 6)
  26.           grpname (strcat "xd-att-wipeout-grp-" randstr)
  27.     )
  28.     (setq wipeout (xdrx-wipeout-make offsetbox))
  29.     (setq grp (xdrx-group-make grpname wipeout e))
  30.     (xdrx-draworder->top wipeout)
  31.     (if (xdrx-object-iskindof e "AcDbAttribute")
  32.       (progn
  33.         (setq blkref (xdrx-object-owner e))
  34.         (xdrx-draworder->top blkref);;Attrib
  35.       )
  36.       (progn
  37.         (xdrx-draworder->top e);;Normal Text
  38.       )
  39.     )
  40.   )
  41.   (xdrx-end)
  42.   (princ)
  43. )
« Last Edit: December 09, 2023, 12:44:47 PM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net