sequential numbers

I am writing a lisp routine where I'm trying to get balloons
numbered/lettered sequentially, mostly, but sometimes out of sequence. The
first time through the routine you will always be prompted for a "grid mark"
and on subsequent passes you will be able to either choose the next one
sequentially or to start a new sequence from there. This is the subroutine I
am using. There are repeated calls to this routine until the user quits the
program. In the initial loading of the program count has been set (setq
count 0).
It seems to not work however. What am I doing wrong please?
(defun balloonstring ()
(setq count (+ count 1)) ;setq count
(if (> count 1)
(progn (setq balloontext (chr (+ 1 (ascii balloontext)))
promptstring (strcat "\nballoontext ")
newstring (getstring promptstring)
) ;setq balloon
(if (/= newstring "")
(progn (setq balloontext newstring)) ;progn
) ;if newstring
) ;progn
) ;if count
(if (= count 1)
(progn (setq newstring (getstring "\nEnter ballon text")) ;setq
(setq balloontext newstring)
) ;progn
) ;if count
)
Reply to
Chuck
Loading thread data ...
I don't understand the question. The function you posted seems to work = (although going from 9 to : to ;, etc seems strange)
What is it not doing that it should, or what is it doing that it = shouldn't?
Reply to
R.K. McSwain
Ok, here's the whole story. It quits half way through the routine for some reason. It seemed to work ok until I added the subroutine I mentioned earlier.
(DEFUN setup () (SETQ OsOLD (GETVAR "OSMODE") TEXTOLD (GETVAR "TEXTSIZE") LAYROLD (GETVAR "CLAYER") ORTHOLD (GETVAR "ORTHOMODE") ) (setq count 0) (if (= (tblsearch "layer" "GRID") nil) (progn (command "-layer" "n" "GRID" "c" "2" "GRID" "lt" "CENTER" "GRID" "" ) ) ) (if (= (tblsearch "layer" "BALLOON") nil) (progn (command "-layer" "n" "BALLOON" "c" "2" "BALLOON" "lt" "CONTINUOUS" "BALLOON" "" ) ) ) ) (defun balloonstring () (setq count (+ count 1)) ;setq count (if (> count 1) (progn (setq balloontext (chr (+ 1 (ascii balloontext))) promptstring (strcat "\nballoontext ") newstring (getstring promptstring) ) ;setq balloon (if (/= newstring "") (progn (setq balloontext newstring)) ;progn ) ;if newstring ) ;progn ) ;if count (if (= count 1) (progn (setq newstring (getstring "\nEnter ballon text")) ;setq (setq balloontext newstring) ) ;progn ) ;if count ) ;defun
(DEFUN BALLOON () (setq entgrid (entlast)) (setq entlist (entget entgrid)) (setq endpt1 (cdr (assoc 10 entlist)) endpt2 (cdr (assoc 11 entlist)) dwgtextsize (getvar "textsize") bubblesize (* 1.5 dwgtextsize) ) (balloonstring) (if (= (car endpt1) (car endpt2)) (progn (setq rota (/ pi 2))) ) (if (= (cadr endpt1) (cadr endpt2)) (progn (setq rota pi)) ) (setvar "clayer" "balloon") (command "circle" "2p" endpt1 (polar endpt1 rota (* 3 bubblesize)) "text" "mc" "cen" endpt1 bubblesize "" balloontext "circle" "2p" endpt2 (polar endpt2 rota (* -3 bubblesize)) "text" "mc" "cen" endpt2 bubblesize "" balloontext ) (setvar "textsize" dwgtextsize) (setvar "clayer" layrold) (setvar "osmode" osold) (setvar "orthomode" orthold) (DRAWNEXT) ) (DEFUN DRAWNEXT () (setq offdist (getstring "\nOffset to next grid? ") offdec (distof offdist 3) ) (command "offset" offdec entgrid pause "") (BALLOON) ) (DEFUN c:gl () (setup) (SETVAR "CLAYER" "GRID") (SETVAR "ORTHOMODE" 1) (ALERT "Let's draw the first grid line") (setq pt1 (getpoint "\nfirst point")) (command "line" pt1 pause "") (setq pt2 (getvar "lastpoint")) (BALLOON) )
I don't understand the question. The function you posted seems to work (although going from 9 to : to ;, etc seems strange)
What is it not doing that it should, or what is it doing that it shouldn't?
Reply to
Chuck
I solved it me self...........thx
Reply to
Chuck

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.