subodh_gis Posted April 15, 2015 Posted April 15, 2015 How can i write a text integer more than 32767 using lisp. when i type 123456 the message is "Requires an integer between -32768 and 32767" Quote
Lee Mac Posted April 15, 2015 Posted April 15, 2015 Prompt for user input using getreal or getstring, test the validity of the input, and convert it to an integer. The 32767 limit is a remnant of the use of 16-bit signed integers in early releases of AutoCAD. Quote
subodh_gis Posted April 15, 2015 Author Posted April 15, 2015 Thanks Lee . But i am not getting this is my code what to do ? (defun C:kk (/ input start rot count ang inc pt1) (setq count (getint "Enter Starting No.: ")) (if (null count) (setq count 1)) (setq inc 1) (setq th (getint "\nEnter text height: ")) (if (null th) (setq th 1.27)) ;; set continue flag to True (setq continue T) (while continue (setq input (getpoint (strcat "\nInsertion point for number"))) ;; evaluate user input (cond (T (command "text" "s" "Standard" "mc" input 2 0 count) (setq pt1 input) (setq count (+ count inc))) ) ) (princ) ) Quote
rkmcswain Posted April 15, 2015 Posted April 15, 2015 Maybe something like this? (initget 5) (setq lgint (fix (getreal "\nEnter value "))) Quote
Lee Mac Posted April 15, 2015 Posted April 15, 2015 RK's solution is good - Alternatively, here are two more options to imitate the behaviour of the standard getint function whilst lifting the 16-bit limit: (defun mygetint ( msg / rtn ) (while (and (setq rtn (getreal msg)) (not (equal rtn (setq rtn (atoi (rtos rtn 2 0))) 1e-) ) (princ "\nRequires an integer value.") ) rtn ) (defun mygetint ( msg / rtn ) (while (and (setq rtn (getstring msg)) (/= 'int (type (setq rtn (read rtn)))) ) (princ "\nRequires an integer value.") ) rtn ) (defun c:test ( ) (mygetint "\nEnter a number: ") ) Quote
subodh_gis Posted April 16, 2015 Author Posted April 16, 2015 Dear RK & Lee when i m giving input 123456 the output is -7616 Quote
rkmcswain Posted April 16, 2015 Posted April 16, 2015 Dear RK & Lee when i m giving input 123456 the output is -7616 Strange. It works here. _$ (initget 5) nil _$ (fix (getreal "\nEnter value ")) <---- I entered "123456" at the command prompt. 123456 Quote
subodh_gis Posted April 16, 2015 Author Posted April 16, 2015 Dear RK It is not working. see my full code. (defun C:kk (/ input start rot count ang inc pt1) ;(setq count (getint "Enter Starting No.: ")) _$ (initget 5) nil _$ (setq count (fix (getreal "\nEnter value "))) (if (null count) (setq count 1)) (setq inc 1) (setq th (getint "\nEnter text height: ")) (if (null th) (setq th 1.27)) ;; set continue flag to True (setq continue T) (while continue (setq input (getpoint (strcat "\nInsertion point for number"))) ;; evaluate user input (cond (T (command "text" "s" "Standard" "mc" input 2 0 count) (setq pt1 input) (setq count (+ count inc))) ) ) (princ) ) Quote
marko_ribar Posted April 16, 2015 Posted April 16, 2015 Maybe : (setq count (fix (+ (float count) inc))) Quote
Recommended Posts
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.