Butch Posted November 20, 2009 Posted November 20, 2009 Can this be done? Basicly its a little math done that you usualy do on your hand calculator but in this way you keep your hand on keyboard all the time. What do you think? Quote
Freerefill Posted November 20, 2009 Posted November 20, 2009 Math is done a little differently in LISP. Takes some getting used to, but it has a lot of advantages. (- 25.64 15.45) You can enter expressions "normally" by using the "CAL" command, just call it.. invisible? I forget the term.. toss a lil' ol' apostrophe in front of it. 'CAL Quote
alanjt Posted November 20, 2009 Posted November 20, 2009 Math is done a little differently in LISP. Takes some getting used to, but it has a lot of advantages. (- 25.64 15.45) You can enter expressions "normally" by using the "CAL" command, just call it.. invisible? I forget the term.. toss a lil' ol' apostrophe in front of it. 'CAL Transparently. Quote
Freerefill Posted November 20, 2009 Posted November 20, 2009 Transparently. That's the one, thanks Alan Quote
Butch Posted November 20, 2009 Author Posted November 20, 2009 Im sorry but I dont understand you Quote
JohnM Posted November 20, 2009 Posted November 20, 2009 Butch You can use lisp functions inside regular AutoCAD commands The lisp format is always inside parentheses ( ) the operator always comes first then the 2 numbers to be evaluated . But it calculates “first number” “operator” “second number” (+ 1 1) this will return 2. (+ 12.50 11.25) will return 23.75 (- 12.0 3) will return 9 (- 3 12.0) will return –9 (/ 6 2) 6 divided by 2 returns 3 (* 6 2) 6 times 2 returns 12 Command line use: AutoCAD line command: Line Specify first point: “pick your point” Specify next point or [undo] “type (+ 12.50 11.25) and make sure your mouse in going in the direction you want the line to be drawn. Same thing with any AutoCAD command that ask for a point Quote
JohnM Posted November 20, 2009 Posted November 20, 2009 Sorry I forgot about the cal function Same as above except you type in ‘cal (don’t forget the apostrophe) then type the expression without the parentheses Line Specify first point “pick your point” Specify second point: ‘cal "hit the enter key" then enter your expression + 12.50 10.375 Quote
alanjt Posted November 20, 2009 Posted November 20, 2009 The CAL function operates a little differently. Command: l LINE Specify first point: Specify next point or [undo]: 'cal >>>> Expression: 25+15 Resuming LINE command. Specify next point or [undo]: 40 Specify next point or [undo]: Quote
alanjt Posted November 21, 2009 Posted November 21, 2009 sorry a just little slip of the lisp LoL ............ Quote
fixo Posted November 21, 2009 Posted November 21, 2009 Just FYI ;; simple math string parser ;; arguments: ;; expr - the string in form: "A Space Symbol Space B" ;; where A and B the strings wich are represents a numeric values ;; i.e. "100 - 50", "100 / 50" etc (defun expresseval (expr / lst sym) (setq lst (read (strcat "(" expr ")")) sym (cadr lst)) (cond ((/= (length lst) 3) nil) ((equal sym '+) (+ (car lst) (caddr lst))) ((equal sym '-) (- (car lst) (caddr lst))) ((equal sym '*) (* (car lst) (caddr lst))) ((equal sym '/) (/ (car lst) (caddr lst))) (T nil) ) ) Usage: (setq plwid (expresseval "25.64 - 15.45")) ~'J'~ Quote
Butch Posted November 21, 2009 Author Posted November 21, 2009 Fixo, have you recived my private message? Quote
fixo Posted November 21, 2009 Posted November 21, 2009 Fixo, have you recived my private message? See my response Cheers ~'J'~ 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.