Jump to content

Recommended Posts

Posted

I am finding difficulty in getting this well done. It does gives me the end result of the calculation but not in the way i actually want.

Please help.

 

(defun c:cf(/ sm,cfm,q)

(setq sm (getreal "\n PLEASE ENTER AREA IN SQ.MT : ")

q (getreal "\n PLEASE ENTER THE REF FACTOR : ")

cfm (getreal(* q(* 10.76 sm))))

(alert"THE REQUIRED CFM FOR THIS AREA IS" cfm))

Posted

Please take care that the GETREAL statement don’t accept another AutoLISP function as argument; however you can discontinue it’s usage since the result of the calculation is already a real number.

 

And ALERT accept only one argument, so you need to concatenate the string - don't forget to convert the number:

 

(alert (strcat "THE REQUIRED CFM FOR THIS AREA IS: " (rtos cfm)))

 

Regards,

Posted

Thanks for that. It made my life more easier

Posted

You are welcomed!

 

Reading again my post just realizes that I wasn’t just right: the GETREAL statement will not accept an AutoLISP expression as response; however you may use an expression to construct the prompter:

 

(getreal (strcat "Input the length <" (rtos Var 2 2) ">: "))

 

Sorry for inconvenience!

Regards,

Posted

Another issue that missed first time – the separator for local variables should be space not comma (even if this doesn’t raise a fatal error):

 

Wrong syntax:

defun c:cf(/ sm,cfm,q

 

Right syntax:

defun c:cf(/ sm fm q)

 

Regards,

Posted

Yes i got it at ur first reply itself.

thanks again.

Posted

You should look into cond, and, if statement use to trap errors. If you don't enter a value for SM or Q, the routine will error.

 

(defun c:CF (/ SM Q)
 (and (setq SM (getreal "\nArea in Sq. Mt: "))
      (setq Q (getreal "\nRef. Factor: "))
      (alert (strcat "Required CFM for area: " (rtos (* Q (* 10.76 SM)))))
 ) ;_ and
 (princ)
) ;_ defun

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