Jump to content

visual lisp accepting default values?


Recommended Posts

Posted

This may seem basic, but I am having a problem getting a simple lisp routine to accept a default value.

 

when I enter the following code:

(setq dst1 (getdist "\nEnter Post to Post spacing : "))

 

and accept the default, I get the response:

; error: bad argument type: numberp: nil

 

What am I doing wrong? I know it's got to be simple, but I can't seem to find any reference to accepting a default value anywhere.

 

By the way, I am new at this. Did you notice?

 

Thanks,

 

Joe B.

Posted

(setq dst1 "5'4.5")

 

After the defining of the function

Posted

you could try this, input needs to be in inches

(if (null dst)
(setq dst 64.5)
);if
(setq dst1 (getdist (strcat "\nEnter Post to Post spacing : <" (rtos dst 3 1) ">: "))
);setq
(if (not dst1)
(setq dst1 dst)
(setq dst dst1)
);if

Posted

Here is my version:

  (or dst (setq dst 64.5)) ; set default
 (and (setq ans (getdist (strcat "\nEnter Post to Post spacing : <" (rtos dst 3 1) ">: ")))
      (setq dst ans)
 )

Posted

Thank guys... I keep thinking life is simple.

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