Lee Mac Posted June 15, 2009 Posted June 15, 2009 In your statement: (action_tile "sFN" ;When action_tile sFN is selected "(setq IMG $value) ;Set variable IMG ~ (Image) to list value (itoa 0) ;Return the conversion of an integer into a string (OLC_UFI)" ;Go to OLC_UFI Image Function Upon the user changing the tile with key "SFN", you are setting the variable "IMG" to the value of the tile ($value). Then, you have a stand-along statement (itoa 0), which is not being set to any variable, nor is it having any impact on the program - it is just another calculation for the computer to process. Then, you invoke your program: "OLC_UFI" which uses the value assigned to "IMG" to determine which image to display. Quote
Lee Mac Posted June 15, 2009 Posted June 15, 2009 Not keeping up with all the thread talk but I updated My version 4 with changed to the DCL fileand lisp. The functions have been Incorporated to keep variables local and some variables renamed. Alan, the call to the DCL file within the LISP needs to be changed to suit the DCL filename :wink: Quote
The Buzzard Posted June 15, 2009 Author Posted June 15, 2009 Not keeping up with all the thread talk but I updated My version 4 with changed to the DCL fileand lisp. The functions have been Incorporated to keep variables local and some variables renamed. Thanks CAB I will review it. At the moment I am out of it. Not much in the way of sleep lately. Quote
The Buzzard Posted June 15, 2009 Author Posted June 15, 2009 Thanks CAB I will review it. At the moment I am out of it.Not much in the way of sleep lately. CAB, I noticed you do not have the latest change to the calculations. there were a couple of missing abs that were fixed. ;;; F03 - Calculate Function - Calculate All Inputs. ;Describe function (defun OLC_CAI () ;Define function (setq c$plex "" S:FN (nth S:FN SFN_list)) ;Return the nth element of the list (setq SFN S:FN) ;Set SFN from value of S:FN (cond ;If one of the following conditions apply ((or ;Return the logical OR of a list of expressions (and ;Return the logical AND of the supplied arguments (member SFN '("1" "4" "6")) ;Search list for an occurrence of an expression (zerop KV4) ;Verify that a number evaluates to zero ) ;End and (and ;Return the logical AND of the supplied arguments (= SFN "5") ;SFN ~ (Select Formula No.) = 5 (zerop KV3) ;Verify that a number evaluates to zero ) ;End and (and ;Return the logical AND of the supplied arguments (member SFN '("3" "8" "10" "12")) ;Search list for an occurrence of an expression (zerop KV2) ;Verify that a number evaluates to zero ) ;End and (and ;Return the logical AND of the supplied arguments (= SFN "11") ;SFN ~ (Select Formula No.) = 11 (zerop KV1) ;Verify that a number evaluates to zero ) ;End and ) ;End or (OLC_DBZ) ;Goto OLC_DBZ Error Function ) ((= "1" SFN) ;SFN ~ (Select Formula No.) = 1 (setq E KV3 R KV4 I (/ E R) P (/ (* E E) R))) ;Calculate I ~ (Current) & P ~ (Power) ((= "2" SFN) ;SFN ~ (Select Formula No.) = 2 (setq I KV2 R KV4 E (* R I) P (* I I R))) ;Calculate E ~ (Voltage) & P ~ (Power) ((= "3" SFN) ;SFN ~ (Select Formula No.) = 3 (setq E KV3 I KV2 R (/ E I) P (* E I))) ;Calculate R ~ (Resistance) & P ~ (Power) ((= "4" SFN) ;SFN ~ (Select Formula No.) = 4 (setq P KV1 R KV4 E (sqrt (abs (* P R))) I (sqrt (abs (/ P R)))) ;Calculate E ~ (Voltage) & I ~ (Current) (and (minusp (* P R)) (setq c$plex "i"))) ((= "5" SFN) ;SFN ~ (Select Formula No.) = 5 (setq P KV1 E KV3 R (/ (* E E) P) I (/ P E))) ;Calculate R ~ (Resistance) & I ~ (Current) ((= "6" SFN) ;SFN ~ (Select Formula No.) = 6 (setq E KV3 R KV4 P (/ (* E E) R) I (/ E R))) ;Calculate P ~ (Power) & I ~ (Current) ((= "7" SFN) ;SFN ~ (Select Formula No.) = 7 (setq I KV2 R KV4 P (* I I R) E (* R I))) ;Calculate P ~ (Power) & E ~ (Voltage) ((= "8" SFN) ;SFN ~ (Select Formula No.) = 8 (setq P KV1 I KV2 R (/ P (* I I)) E (/ P I))) ;Calculate R ~ (Resistance) & E ~ (Voltage) ((= "9" SFN) ;SFN ~ (Select Formula No.) = 9 (setq P KV1 R KV4 I (sqrt (abs (/ P R))) E (sqrt (abs (* P R)))) ;Calculate I ~ (Current) & E ~ (Voltage) (and (minusp (* P R)) (setq c$plex "i"))) ((= "10" SFN) ;SFN ~ (Select Formula No.) = 10 (setq E KV3 I KV2 P (* E I) R (/ E I))) ;Calculate P ~ (Power) & R ~ (Resistance) ((= "11" SFN) ;SFN ~ (Select Formula No.) = 11 (setq P KV1 E KV3 I (/ P E) R (/ (* E E) P))) ;Calculate I ~ (Current) & R ~ (Resistance) ((= "12" SFN) ;SFN ~ (Select Formula No.) = 12 (setq P KV1 I KV2 E (/ P I) R (/ P (* I I)))) ;Calculate E ~ (Voltage) & R ~ (Resistance) ) ;End cond (OLC_DCO) ;Go to OLC_DCO Output Function ) ;End define function ;;;//////////////////////////////////////////////////////////////////////////// Quote
CAB Posted June 15, 2009 Posted June 15, 2009 Alan, the call to the DCL file within the LISP needs to be changed to suit the DCL filename :wink: Thanks Lee, file & ZIP updated. Quote
CAB Posted June 15, 2009 Posted June 15, 2009 CAB,I noticed you do not have the latest change to the calculations. there were a couple of missing abs that were fixed. I think I do. Notice I revised the section changing SFN$ to base zero! Eliminated the use of variables kV1 through kV4. Added some error checks for user input incase user enters invalid characters. Quote
Lee Mac Posted June 15, 2009 Posted June 15, 2009 Alan, good use of arguments as opposed to throwing variables between functions. Quote
The Buzzard Posted June 15, 2009 Author Posted June 15, 2009 I think I do.Notice I revised the section changing SFN$ to base zero! Eliminated the use of variables kV1 through kV4. Added some error checks for user input incase user enters invalid characters. CAB, The square root functions 4 & 9 are not working properly. I took a look at the calculation function and the calcs for 9 seem to be in 8. There is some sort of mixup going on there. Calc 8 of does not work either. Just thought I would point that out. Quote
The Buzzard Posted June 15, 2009 Author Posted June 15, 2009 CAB, The square functions 4 & 9 are not working properly. I took a look at the calculation function and the calcs for 9 seem to be in 8. There is some sort of mixup going on there. Calc 8 of does not work either. Just thought I would point that out. Tested the rest. Calc formulas 5, 11 & 12 are also not working. Quote
CAB Posted June 15, 2009 Posted June 15, 2009 Sorry, missplaced a paren. Please try this file. OLCv4-CAB.zip Quote
The Buzzard Posted June 15, 2009 Author Posted June 15, 2009 Sorry, missplaced a paren.Please try this file. Ok it checks out. The reason I was confused is your using the list position values 0 thru 11 where I use SNF variable value 1 thru 12. It makes sense to me now. Quote
The Buzzard Posted June 17, 2009 Author Posted June 17, 2009 Attention to All, Version 5 of the Ohm's Law Calculator Lisp has been posted to the first post. This version has some major improvements that were implemented by CAB. A revision list has also been posted. Great work CAB Thanks and enjoy the program, The Buzzard Quote
CAB Posted June 17, 2009 Posted June 17, 2009 Glad to have been of some assistance. I see you didn't care for the 'sub assembly definitions' in my version 4 DCL. Quote
The Buzzard Posted June 17, 2009 Author Posted June 17, 2009 Glad to have been of some assistance.I see you didn't care for the 'sub assembly definitions' in my version 4 DCL. Actually I did like it, But I am very familar with my method at the moment. I plan to read up on your method and become more comfortable with. Thank for the help. These codes I have been working on are not for me, But for the membeship here. I get more learning experience making an attempt at these codes with the level of knowledge that I have. I am very glad people here are willing to help each other. I hope to get better at this stuff in the future. This was a very interesting thread to say the least. It had a bit of eveything in it. Thanks, The Buzzard Quote
devitg Posted March 8, 2010 Posted March 8, 2010 Hi the buzzard When do a calc with WATS and Volts I got this error. Quote
The Buzzard Posted March 8, 2010 Author Posted March 8, 2010 With the first formula selected you need to supply values in E and R. You put values in E & P, So you will get a divide by zero error. When ever you select a formula, You need to supply the two value you have selected in their proper boxes. Quote
keithlaser Posted March 17, 2010 Posted March 17, 2010 Do I need express tools to make this work I have Acad 2010 mep Quote
The Buzzard Posted March 17, 2010 Author Posted March 17, 2010 No, Its a stand alone application. See this link on how to load and run lisp. http://www.cadtutor.net/forum/showthread.php?t=1390 Quote
keithlaser Posted March 17, 2010 Posted March 17, 2010 thanks It works great after I made a file path:D Quote
The Buzzard Posted March 17, 2010 Author Posted March 17, 2010 Good deal, When using dcl files you need to specify the path. Quote
Recommended Posts
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.