Results 1 to 10 of 10

Thread: Tharwat lisp - REQUEST

  1. #1
    100 Club
    Join Date
    2012-08
    Posts
    111

    Post Tharwat lisp - REQUEST

    Hi all,
    I've found a excellent lisp from Tharwat. I'd like to do a little modification, and I need some help.

    I wish to control the text size, like circle diameter.
    Can anybody help me, please?
    Code:
    (defun c:ncir (/ la ss)
    ;;; Tharwat 20. Nov. 2012   ;;;
      (if (and (setq *r* (cond ((getdist (strcat "\n Specify Diameter of Circle [Radius]"
                                                 (if *r*
                                                   (strcat "< " (rtos *r* 2 2) " > :")
                                                   " :"
                                                 )
                                         )
                                )
                               )
                               (t *r*)
                         )
               )
               (not (eq (setq la (getstring t "\n Enter Layer name :")) ""))
               (if (not (tblsearch "LAYER" la))
                 (progn (princ "\n Layer Name is not found !!") nil)
                 t
               )
               (setq ss (ssget '((0 . "*POLYLINE"))))
          )
        ((lambda (x / e i)
           (while (setq e (ssname ss (setq x (1+ x))))
             (setq i 0)
             (foreach dxf (entget e)
               (if (eq (car dxf) 10)
                 (progn (entmakex (list '(0 . "CIRCLE") dxf (cons 40 *r*) (cons 8 la)))
                        (entmakex (list '(0 . "TEXT")
                                        (cons 1 (itoa (setq i (1+ i))))
                                        '(40 . 0.2)
                                        (cons 10 (trans (list (+ (cadr dxf) (* *r* 1.1)) (caddr dxf) 0.) 1 0))
                                        (cons 8 la)
                                  )
                        )
                 ) ) )  ) ) -1
        )
        (princ)
      )
      (princ)
    )
    Kind Regards

  2. #2
    Member
    Join Date
    2007-10
    Posts
    5

    Default Re: Tharwat lisp - REQUEST

    so was
    Code:
    (defun c:ncir (/ la ss)
    ;;; Tharwat 20. Nov. 2012   ;;;
      (if (and (setq *r* (cond ((getdist (strcat "\n Specify Diameter of Circle [Radius]"
                                                 (if *r*
                                                   (strcat "< " (rtos *r* 2 2) " > :")
                                                   " :"
                                                 )
                                         )
                                )
                               )
                               (t *r*)
                         )
               )
    	   (setq Texthöhe (getreal "\nTexthöe angeben: "));;; Abfrage Texthöhe
               (not (eq (setq la (getstring t "\n Enter Layer name :")) ""))
               (if (not (tblsearch "LAYER" la))
                 (progn (princ "\n Layer Name is not found !!") nil)
                 t
               )
               (setq ss (ssget '((0 . "*POLYLINE"))))
          )
        ((lambda (x / e i)
           (while (setq e (ssname ss (setq x (1+ x))))
             (setq i 0)
             (foreach dxf (entget e)
               (if (eq (car dxf) 10)
                 (progn (entmakex (list '(0 . "CIRCLE") dxf (cons 40 *r*) (cons 8 la)))
                        (entmakex (list '(0 . "TEXT")
                                        (cons 1 (itoa (setq i (1+ i))))
                                        (cons 40 Texthöhe);; ändern
                                        (cons 10 (trans (list (+ (cadr dxf) (* *r* 1.1)) (caddr dxf) 0.) 1 0))
                                        (cons 8 la)
                                  )
                        )
                 ) ) )  ) ) -1
        )
        (princ)
      )
      (princ)
    )
    Kind Regards[/QUOTE]

  3. #3
    100 Club
    Join Date
    2012-08
    Posts
    111

    Default Re: Tharwat lisp - REQUEST

    Perfekt!
    Perfect heinz.dober!

    I really appreciate your kind help.

    Thanks
    Danke

    Billy

  4. #4
    I could stop if I wanted to Tharwat's Avatar
    Join Date
    2010-06
    Posts
    478

    Default Re: Tharwat lisp - REQUEST

    The same as the one that heinz modified but with a little bit dynamic with value ...

    Code:
    (defun c:ncir (/ la ss)
    ;;; Tharwat 20. Nov. 2012   ;;;
      (if (and (setq *r*
                      (cond
                        ((getdist (strcat "\n Specify Diameter of Circle [Radius] "
                                          (if *r*
                                            (strcat "< " (rtos *r* 2 2) " > :")
                                            " :"
                                          )
                                  )
                         )
                        )
                        (t *r*)
                      )
               )
               (setq *h*
                      (cond
                        ((getdist (strcat "\n Specify Height of the Text "
                                          (if *h*
                                            (strcat "< " (rtos *h* 2 2) " > :")
                                            " :"
                                          )
                                  )
                         )
                        )
                        (t *h*)
                      )
               )
               (not (eq (setq la (getstring t "\n Enter Layer name :")) "")
               )
               (if (not (tblsearch "LAYER" la))
                 (progn (princ "\n Layer Name is not found !!") nil)
                 t
               )
               (setq ss (ssget '((0 . "*POLYLINE"))))
          )
        ((lambda (x / e i)
           (while (setq e (ssname ss (setq x (1+ x))))
             (setq i 0)
             (foreach dxf (entget e)
               (if (eq (car dxf) 10)
                 (progn
                   (entmakex
                     (list '(0 . "CIRCLE") dxf (cons 40 *r*) (cons 8 la))
                   )
                   (entmakex
                     (list
                       '(0 . "TEXT")
                       (cons 1 (itoa (setq i (1+ i))))
                       (cons 40 *h*)
                       (cons
                         10
                         (trans
                           (list (+ (cadr dxf) (* *r* 1.1)) (caddr dxf) 0.)
                           1
                           0
                         )
                       )
                       (cons 8 la)
                     )
                   )
                 )
               )
             )
           )
         )
          -1
        )
        (princ)
      )
      (princ)
    )

  5. #5
    100 Club
    Join Date
    2012-08
    Posts
    111

    Default Re: Tharwat lisp - REQUEST

    Quote Originally Posted by Tharwat View Post
    The same as the one that heinz modified but with a little bit dynamic with value ...
    Hi Tharwat,
    You code is awesome as always!

    Many Thanks for support.
    Billy

  6. #6
    I could stop if I wanted to Tharwat's Avatar
    Join Date
    2010-06
    Posts
    478

    Default Re: Tharwat lisp - REQUEST

    Quote Originally Posted by BILLYJOW View Post
    Hi Tharwat,
    You code is awesome as always!

    Many Thanks for support.
    Billy
    Thank you Billy , it's very kind of you to say that .

  7. #7
    100 Club
    Join Date
    2012-08
    Posts
    111

    Default Re: Tharwat lisp - REQUEST

    Hi,guys
    Is it possible indicate the point where I wanna start the number?

    Sorry to bother you, guys.


    Kind Regards

  8. #8
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    397

    Default Re: Tharwat lisp - REQUEST

    Quote Originally Posted by BILLYJOW View Post
    Hi,guys
    Is it possible indicate the point where I wanna start the number?
    You mean for every location? or only once then use that as basis for the succeeding TEXT?

    Try this

    Code:
    (defun c:ncir (/ def la ss rpt ang dis _frompt)
    ;;; Tharwat 20. Nov. 2012   ;;;
    ;;;	      Mod by pBe 2013   ;;;
    (defun def (v msg) (cond
    	((getdist (strcat msg
      (if v (strcat " <" (rtos  v 2) ">: ") ": ") )))(v)))
      (if (and (setq rpt nil *r* (def *r* "\n Specify Diameter of Circle [Radius] "))
               (setq *h* (def *h* "\n Specify Height of the Text "))
               (setq la (getstring t "\nLayer name/press Enter/Space for current layer :")
                     la (if (or (eq la "") (wcmatch la " *"))(getvar 'clayer) la))
               (if (not (tblsearch "LAYER" la))
                 (progn (princ "\n Layer Name is not found !!") nil)
                 t
               )
               (setq ss (ssget '((0 . "*POLYLINE")))))
    			 (repeat (sslength ss)
                 (setq i 0)
              	(foreach pt (vl-remove-if-not '(lambda (x)
    															(= (car x) 10))(entget (ssname ss 0)))
                      (entmakex  (list '(0 . "CIRCLE") pt (cons 40 *r*) (cons 8 la)))
                      (if (null rpt)
                          (progn
                           (while (not  (setq rpt (getpoint "\nPick point for TEXT location:"))))
                           (setq ang (angle (cdr pt) rpt)
                                 dist (distance (cdr pt) rpt)
                                 _frompt (lambda (x)(polar x ang dist)))
             									);progn
                          );if
    									(entmakex
    					             (list
    					               '(0 . "TEXT")
    					               (cons 1 (itoa (setq i (1+ i))))
    					               (cons 40 *h*)
    					               (cons
    					                 10
    					                 (trans (_frompt (cdr pt)) 1 0)
    					                 )
    					               (cons 8 la)
    					             )
    					           )
                        )
    					(ssdel (ssname ss 0) ss)
                );repeat
          );if
      (princ)
    )
    HTH

    EDIT:getint to getdist
    Last edited by pbejse; 2013-01-17 at 06:20 AM.

  9. #9
    100 Club
    Join Date
    2012-08
    Posts
    111

    Default Re: Tharwat lisp - REQUEST

    Quote Originally Posted by pbejse View Post
    You mean for every location? or only once then use that as basis for the succeeding TEXT?

    HTH

    EDIT:getint to getdist
    Thanks pbejse,
    It's exactly I expect to.

    I really appreciate all help in this thread, guys.

    You're awesome!

    Billy

  10. #10
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    397

    Default Re: Tharwat lisp - REQUEST

    Quote Originally Posted by BILLYJOW View Post
    Thanks pbejse,
    Billy
    You are welcome Billyjow, kudos to tharwat, i only made a slight modification.

    Cheers

Similar Threads

  1. Request lisp Help
    By jwchambers in forum AutoLISP
    Replies: 4
    Last Post: 2012-03-16, 07:02 PM
  2. Request for a Lisp Routine
    By sorman in forum AutoLISP
    Replies: 10
    Last Post: 2010-01-04, 07:18 PM
  3. Lisp Request
    By sadikozer34 in forum AutoLISP
    Replies: 0
    Last Post: 2009-09-06, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •