Jump to content

Recommended Posts

Posted

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

 

Posted

Yes, enter on its own will produce nil. 

  • Like 1
Posted

How can i set if there is already an value. with out typing just pressing enter or space set the same vale 

Posted
(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
Posted (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. 

image.png.6f1def26575363cebdd4f5ec01dfe882.png

 

The initget has advantage of forcing a number.

Edited by BIGAL
  • Agree 1
Posted

 

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)

 

 

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

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

 

 

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