Author Topic: Leader Lisp  (Read 3722 times)

0 Members and 1 Guest are viewing this topic.

Scott

  • Bull Frog
  • Posts: 244
Leader Lisp
« on: October 02, 2008, 09:17:16 PM »
Does anyone have a leader lisp that will automatically increment numbers they would be willing to share?

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Leader Lisp
« Reply #1 on: October 03, 2008, 10:10:26 AM »
there is a little one..

Code: [Select]
(defun c:leadnum (/ lm)
(vl-load-com)
  (setq lm (vlax-ldata-get "leadnum" "currentnum"))
  (if (not lm)
    (setq lm (vlax-ldata-put "leadnum" "currentnum" 0))
   )
  (vl-cmdf "_Leader" pause pause "" (rtos lm) "")
  (vlax-ldata-put "leadnum" "currentnum" (1+ lm))
)
 
Keep smile...

fixo

  • Guest
Re: Leader Lisp
« Reply #2 on: October 03, 2008, 02:37:25 PM »
Here is another one

Code: [Select]
(defun C:ld  (/ num osm pt)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 0)
  (setvar "cmdecho" 0)
  (setq num (getint "\nEnter an initial number: "))
  (while
    (setq pt (getpoint
       "\nSpecify leader start point: (or hit ENTER to Exit) "))
     (command "._leader" pt pause "" (itoa num) "")
     (setq num (1+ num)))
  (setvar "cmdecho" 1)
  (setvar "osmode" osm)
  (princ)
  )
(princ "\nStart command with LD")
(princ)

~'J'~

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Leader Lisp
« Reply #3 on: July 31, 2012, 04:26:36 PM »
Hey, guys.
I'd like to put prefix  in this routine. Anybody Could help me please?
e.g. BLS 1, BLS 2 ...

(defun C:ld  (/ num osm pt)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 0)
  (setvar "cmdecho" 0)
  (setq num (getint "\nEnter an initial number: "))
  (while
    (setq pt (getpoint
           "\nSpecify leader start point: (or hit ENTER to Exit) "))
     (command "._leader" pt pause "" (itoa num) "")
     (setq num (1+ num)))
  (setvar "cmdecho" 1)
  (setvar "osmode" osm)
  (princ)
  )
(princ "\nStart command with LD")
(princ)

Kind Regards

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: Leader Lisp
« Reply #4 on: July 31, 2012, 04:28:25 PM »
Change:
Code - Auto/Visual Lisp: [Select]
  1. (itoa num)

to:
Code - Auto/Visual Lisp: [Select]
  1. (strcat "BLS " (itoa num))

Welcome to the Swamp Fabricio   8-)

[PS: Read this also  :-) ]

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Leader Lisp
« Reply #5 on: July 31, 2012, 04:36:25 PM »
Thanks Lee,
You're awsome!!!!
 :lmao:

rlxozzang

  • Guest
Re: Leader Lisp
« Reply #6 on: July 31, 2012, 09:04:55 PM »
THANK YOU "Andrea"
GOOD CODE : vlax-ldata-put
"vlax-ldata-put" function to have learned here.
there is a little one..

Code: [Select]
(defun c:leadnum (/ lm)
(vl-load-com)
  (setq lm (vlax-ldata-get "leadnum" "currentnum"))
  (if (not lm)
    (setq lm (vlax-ldata-put "leadnum" "currentnum" 0))
   )
  (vl-cmdf "_Leader" pause pause "" (rtos lm) "")
  (vlax-ldata-put "leadnum" "currentnum" (1+ lm))
)