Jump to content

autlisp


justAnIntern

Recommended Posts

Hello,

i implemented the folowing lines of code:

(

defun c:areas (/ ft_sqr)

(setq ft_sqr (getreal "\nenter an area in sqr feet: "))

(setq acre (/ ft_sqr 43560))

(rtos acre 2 2);

(princ " ACRES")

)

 

the output is ACRES" ACRES"

 

is there any reason why the rtos command doest not show the output of the variable, acre?

 

why is it outputing ACRES twice?

 

also, why are the quotations outputing?

 

Thank You!

Link to comment
Share on other sites

Have a look, this will control against nil values from getreal, etc.

 

(defun c:AREAS (/ SF)
 (if (setq SF (getreal "\nSpecify area in Square Feet: "))
   (princ (strcat "\n" (rtos (/ SF 43560.) 2 2) " ACRES"))
 )
 (princ)
)

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