Jump to content

Help edit lisp Number not automatic fit into text


Recommended Posts

Posted

Hi, everybody.

I have a lisp collected automatically numbered.

However, while the number of small numbers fits in the circle (with wipeout) but when bigger numbers, it does not automatically fit into that circle.

Please help me to the circle automatically fits numbered (with wipeout).

Thank you very much!

Please view file attach:

 

case1.jpg

 

case2.jpg

DSTT.lsp

2case.dwg

Posted

Try to set Text Height or Width Factor as per text string length.

Posted

Try this program that I have just wrote and added to my tool box :)

 

(defun c:test (/ *error* _bx cm ss s i wp tx e d mid)
 ;;------------------------------------;;
 ;; Author : Tharwat 15.09.2015	;;
 ;; Resize texts inside wipeouts	;;
 ;;------------------------------------;;
 (defun *error* (msg)
   (if cm
     (setvar 'cmdecho cm)
   )
   (if (and msg (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*"))
     (princ (strcat "\n ** Error : " msg " **"))
   )
   (princ)
 )
 (defun _bx (o / l r a b c d)
   (vla-getboundingbox (vlax-ename->vla-object o) 'l 'r)
   (setq a (vlax-safearray->list l)
         b (vlax-safearray->list r)
         c (list (car b) (cadr a))
         d (distance a c)
   )
   (list a b c d)
 )
 (if (setq ss (ssget '((0 . "WIPEOUT"))))
   (repeat (setq i (sslength ss))
     (setq wp (_bx (ssname ss (setq i (1- i)))))
     (if (setq s (ssget "_C"
                        (car wp)
                        (cadr wp)
                        '((0 . "TEXT"))
                 )
         )
       (progn
         (setq e  (ssname s 0)
               tx (_bx e)
               d  (last wp)
               cm (getvar 'cmdecho)
         )
         (setvar 'cmdecho 0)
         (command
           "_.scale"
           e
           ""
           (setq mid (mapcar '(lambda (q p) (/ (+ q p) 2.))
                             (car wp)
                             (cadr wp)
                     )
           )
           "_r"
           "_none"
           (car tx)
           "_none"
           (caddr tx)
           (- d (/ d 5.))
         )
         (setq tx (_bx e))
         (command
           "_.move"
           e
           ""
           "_none"
           (mapcar '(lambda (q p) (/ (+ q p) 2.)) (car tx) (cadr tx))
           "_none"
           mid
         )
       )
     )
   )
 )
 (*error nil)
 (princ)
)(vl-load-com)

Posted
Try this program that I have just wrote and added to my tool box :)

 

(defun c:test (/ *error* _bx cm ss s i wp tx e d mid)
 ;;------------------------------------;;
 ;; Author : Tharwat 15.09.2015	;;
 ;; Resize texts inside wipeouts	;;
 ;;------------------------------------;;
 (defun *error* (msg)
   (if cm
     (setvar 'cmdecho cm)
   )
   (if (and msg (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*"))
     (princ (strcat "\n ** Error : " msg " **"))
   )
   (princ)
 )
 (defun _bx (o / l r a b c d)
   (vla-getboundingbox (vlax-ename->vla-object o) 'l 'r)
   (setq a (vlax-safearray->list l)
         b (vlax-safearray->list r)
         c (list (car b) (cadr a))
         d (distance a c)
   )
   (list a b c d)
 )
 (if (setq ss (ssget '((0 . "WIPEOUT"))))
   (repeat (setq i (sslength ss))
     (setq wp (_bx (ssname ss (setq i (1- i)))))
     (if (setq s (ssget "_C"
                        (car wp)
                        (cadr wp)
                        '((0 . "TEXT"))
                 )
         )
       (progn
         (setq e  (ssname s 0)
               tx (_bx e)
               d  (last wp)
               cm (getvar 'cmdecho)
         )
         (setvar 'cmdecho 0)
         (command
           "_.scale"
           e
           ""
           (setq mid (mapcar '(lambda (q p) (/ (+ q p) 2.))
                             (car wp)
                             (cadr wp)
                     )
           )
           "_r"
           "_none"
           (car tx)
           "_none"
           (caddr tx)
           (- d (/ d 5.))
         )
         (setq tx (_bx e))
         (command
           "_.move"
           e
           ""
           "_none"
           (mapcar '(lambda (q p) (/ (+ q p) 2.)) (car tx) (cadr tx))
           "_none"
           mid
         )
       )
     )
   )
 )
 (*error nil)
 (princ)
)(vl-load-com)

 

Good routine. you are most helpful.:thumbsup:

Posted
Good routine. you are most helpful.:thumbsup:

 

Haha .. thanks.

 

Actually I needed this routine once or twice before but I was lazy in that time to write one , so today I pushed me self to write a complete one and I think I did it. :shock:

 

Enjoy.

Posted

The other way is to look at the number of characters and increase the circle diameter as you create.

Posted
Try this program that I have just wrote and added to my tool box :)

 

(defun c:test (/ *error* _bx cm ss s i wp tx e d mid)
 ;;------------------------------------;;
 ;; Author : Tharwat 15.09.2015	;;
 ;; Resize texts inside wipeouts	;;
 ;;------------------------------------;;
 (defun *error* (msg)
   (if cm
     (setvar 'cmdecho cm)
   )
   (if (and msg (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*"))
     (princ (strcat "\n ** Error : " msg " **"))
   )
   (princ)
 )
 (defun _bx (o / l r a b c d)
   (vla-getboundingbox (vlax-ename->vla-object o) 'l 'r)
   (setq a (vlax-safearray->list l)
         b (vlax-safearray->list r)
         c (list (car b) (cadr a))
         d (distance a c)
   )
   (list a b c d)
 )
 (if (setq ss (ssget '((0 . "WIPEOUT"))))
   (repeat (setq i (sslength ss))
     (setq wp (_bx (ssname ss (setq i (1- i)))))
     (if (setq s (ssget "_C"
                        (car wp)
                        (cadr wp)
                        '((0 . "TEXT"))
                 )
         )
       (progn
         (setq e  (ssname s 0)
               tx (_bx e)
               d  (last wp)
               cm (getvar 'cmdecho)
         )
         (setvar 'cmdecho 0)
         (command
           "_.scale"
           e
           ""
           (setq mid (mapcar '(lambda (q p) (/ (+ q p) 2.))
                             (car wp)
                             (cadr wp)
                     )
           )
           "_r"
           "_none"
           (car tx)
           "_none"
           (caddr tx)
           (- d (/ d 5.))
         )
         (setq tx (_bx e))
         (command
           "_.move"
           e
           ""
           "_none"
           (mapcar '(lambda (q p) (/ (+ q p) 2.)) (car tx) (cadr tx))
           "_none"
           mid
         )
       )
     )
   )
 )
 (*error nil)
 (princ)
)(vl-load-com)

 

Thank Tharwat very much! Good luck for you.

Posted
The other way is to look at the number of characters and increase the circle diameter as you create.

 

Thank BIGAL very much!

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...