Instead of Starting numbers from "1", How to make it start from "0"?

Instead of Starting numbers from "1", How to make it start from "0"?

ImagenZeta
Participant Participant
673 Views
1 Reply
Message 1 of 2

Instead of Starting numbers from "1", How to make it start from "0"?

ImagenZeta
Participant
Participant
(defun c:vername (/ e i j m n p s x)
  (if (and (setq s (ssget '((0 . "LWPOLYLINE"))))
	   (setq x (getstring "\nSpecify prefix <enter for none>: "))
	   )
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i)))
	    n (cdr (assoc 210 (entget e)))
	    m (vlax-curve-getendparam e)
	    j -1
      )
      (while (<= (setq j (1+ j)) m)
	(setq p (trans (vlax-curve-getpointatparam e j) 0 e))
	(entmakex
	  (list
	    (cons 0 "TEXT")
	    (cons 7 (getvar 'TEXTSTYLE))
	    (cons 40 (getvar 'TEXTSIZE))
	    (cons 10 p)
	    (cons 11 p)
	    (cons 72 1)
	    (cons 73 2)
	    (cons 1 (strcat x (itoa (1+ j))))
	    (cons 210 n)
	  )
	)
      )
    )
  )
  (princ)
)
0 Likes
674 Views
1 Reply
Reply (1)
Message 2 of 2

pbejse
Mentor
Mentor

Replace

 

 

(cons 1 (strcat x (itoa (1+ j))))

 

with

 

 

(cons 1 (strcat x (itoa j)))