Author Topic: Convert Txt 2 Attribute  (Read 3819 times)

0 Members and 1 Guest are viewing this topic.

nyah

  • Guest
Convert Txt 2 Attribute
« on: June 01, 2011, 11:58:55 AM »
Hello Everyone

Need my fix of help:

Problem have dumb text above a valve and need it to be converted to an attribute and if poss srrounded by a rect box

Any ideas as is it an express tool option or anyone have the lisp routine. I thought about the action macro for the box am I way off?

Thanks

Nyah

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Convert Txt 2 Attribute
« Reply #1 on: June 01, 2011, 12:07:25 PM »
Does this help?

Code: [Select]
;;-------------------=={ Text 2 Attribute }==-----------------;;
;;                                                            ;;
;;  Converts single-line text to an attribute definition.     ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:txt2att ( / el i ss st ) (vl-load-com)
 
  (if (setq ss (ssget "_:L" '((0 . "TEXT"))))
    (repeat (setq i (sslength ss))
      (setq el (entget (ssname ss (setq i (1- i))))
            st (vl-string-translate " " "_" (cdr (assoc 1 el)))
      )
      (if
        (entmakex
          (append '((0 . "ATTDEF"))
            (vl-remove-if '(lambda ( pair ) (member (car pair) '(0 100 73))) el)
            (list
              (cons 70  0)
              (cons 74 (cdr (assoc 73 el)))
              (cons  2 st)
              (cons  3 st)
            )
          )
        )
        (entdel (cdr (assoc -1 el)))
      )
    )
  )
  (princ)
)

As for the Rectangle, how about TCIRCLE from Express Tools  :-)