Jump to content

Recommended Posts

Posted
On 4/9/2010 at 3:25 PM, Lee Mac said:

Try this:

 

 


(defun c:subtxt (/ ParseNumbers GR NUM1 NUM2 P RES)
 (vl-load-com)
 ;; Lee Mac  ~  09.04.10

 (defun ParseNumbers (str / lst Num Aph x rtn)
   ;; Lee Mac  ~  20.09.09
   (setq lst (vl-string->list str) Num "" Aph "")
   
   (while (setq x (car lst))
     (setq lst (cdr lst))
     
     (cond (  (and (/= "" Num) (= 46 x))
              (setq Num (strcat Num (chr x))))
           
           (  (< 47 x 58)
              (setq Num (strcat Num (chr x))
                    rtn (cons Aph rtn) Aph ""))
           
           (t (setq Aph (strcat Aph (chr x))
                    rtn (cons (read Num) rtn) Num ""))))
   
   (vl-remove nil
     (vl-remove ""
       (reverse (cons Aph (cons (read Num) rtn))))))


 (mapcar
   (function
     (lambda (sym str / ent)
       (while
         (progn
           (setq ent (car (nentsel str)))

           (cond (  (eq 'ENAME (type ent))

                    (if (wcmatch (cdr (assoc 0 (entget ent))) "*TEXT")

                      (if (not
                            (set sym
                              (car
                                (vl-remove-if-not
                                  (function
                                    (lambda (x)
                                      (vl-position
                                        (type x) '(INT REAL))))

                                  (ParseNumbers
                                    (cdr
                                      (assoc 1 (entget ent))))))))

                        (princ "\n** Text Must Contain a Number **"))

                      (princ "\n** Object Must be Text **")))

                 (  (princ "\n** Nothing Selected **")))))))
   
   '(num1 num2) '("\nSelect Text to Subtract from: " "\nSelect Text to Subtract: "))

 (if (and num1 num2
          (setq res (entmakex (list (cons 0 "TEXT")
                                    (cons 10  (getvar 'VIEWCTR))
                                    (cons 40  (getvar 'TEXTSIZE))
                                    (cons 7   (getvar 'TEXTSTYLE))
                                    (cons 50  (/ pi 2))
                                    (cons 1   (rtos (- num1 num2) (getvar 'LUNITS) 2)))))
          (setq res (entget res)))

   (while (and (= 5 (car (setq gr (grread 't 13 0))))
                 (listp (setq p (cadr gr))))

       (entupd
         (cdr
           (assoc -1
             (setq res
               (entmod
                 (subst (cons 10 p) (assoc 10 res) res))))))))
 (princ))
 

 

This lisp result how to place in End point

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    7

  • ayman

    6

  • alanjt

    3

  • Shaheensha976

    3

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.


×
×
  • Create New...