Ajmal Posted July 29, 2023 Share Posted July 29, 2023 if I press enter without typing anything why getting "nil" actually, if I need to set the same value showing what there showing what i must do??? (if (null tmp) (setq tmp 25)) (initget 6) (and (setq tmp (getreal (strcat "\nSpecify the psize <" (vl-princ-to-string tmp)"> : "))) (setq psize tmp)) Quote Link to comment Share on other sites More sharing options...
Steven P Posted July 29, 2023 Share Posted July 29, 2023 Yes, enter on its own will produce nil. 1 Quote Link to comment Share on other sites More sharing options...
Ajmal Posted July 29, 2023 Author Share Posted July 29, 2023 How can i set if there is already an value. with out typing just pressing enter or space set the same vale Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted July 29, 2023 Share Posted July 29, 2023 (if (null tmp) (setq tmp 25)) (initget 6) (and (setq tmp (cond ( (getreal (strcat "\nSpecify the psize <" (vl-princ-to-string tmp)"> : ") ) ( tmp ) )) (setq psize tmp)) 1 1 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 30, 2023 Share Posted July 30, 2023 (edited) Another (if (null psize)(setq psize 25.0)) (setq tmp (getreal (strcat "\nSpecify the psize <" (rtos psize 2 2) "> : "))) (if (null tmp)(princ)) You can use my Multigetvals can save the last value for re-use. The initget has advantage of forcing a number. Edited July 30, 2023 by BIGAL 1 Quote Link to comment Share on other sites More sharing options...
Ajmal Posted July 30, 2023 Author Share Posted July 30, 2023 16 hours ago, marko_ribar said: (if (null tmp) (setq tmp 25)) (initget 6) (and (setq tmp (cond ( (getreal (strcat "\nSpecify the psize <" (vl-princ-to-string tmp)"> : ") ) ( tmp ) )) (setq psize tmp)) Error: bad function: 25 (if (null tmp) (setq tmp 25)) (initget 6) (and (setq tmp (cond ( (getreal (strcat "\nSpecify the pipe size <" (vl-princ-to-string tmp)"> : ")) ( tmp )))) (setq pipesize tmp)) (setq dia (/ pipesize 2.0) start 0) Quote Link to comment Share on other sites More sharing options...
Tsuky Posted July 30, 2023 Share Posted July 30, 2023 (if (zerop (getvar "USERR1")) (setvar "USERR1" 25.0) ) (initget 6) (setq pipesize (getreal (strcat "\nSpecify the pipesize <" (vl-princ-to-string (getvar "USERR1"))"> : "))) (if (not pipesize) (setq pipesize (getvar "USERR1")) (setvar "USERR1" pipesize)) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 30, 2023 Share Posted July 30, 2023 Tsuky as USERR1 is a variable any code can get at and change I have started using LDATA it resides in the dwg, you provide the container name and a key then value. (vlax-ldata-put "AlanH" "Ahscale" 100) (setq ahsc (vlax-ldata-get "AlanH" "Ahscale")) (setq layname (vlax-ldata-get "AlanH" "Layoutname" ) ) Quote Link to comment Share on other sites More sharing options...
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.