Jump to content

getreal


Ajmal

Recommended Posts

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))

 

Link to comment
Share on other sites

(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))

 

  • Like 1
  • Agree 1
  • Thanks 1
Link to comment
Share on other sites

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. 

image.png.6f1def26575363cebdd4f5ec01dfe882.png

 

The initget has advantage of forcing a number.

Edited by BIGAL
  • Agree 1
Link to comment
Share on other sites

 

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)

 

 

Link to comment
Share on other sites

(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))

 

  • Thanks 1
Link to comment
Share on other sites

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" ) )

 

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...