Jump to content

Poline/line entering lenght value (25.64-15.45)=


Recommended Posts

Posted

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?

Posted

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

Posted
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. :)

Posted
Transparently. :)

 

That's the one, thanks Alan :P

Posted

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

Posted

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

Posted

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]:

Posted
sorry a just little slip of the lisp

LoL ............

Posted

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'~

Posted

Fixo, have you recived my private message?

Posted
Fixo, have you recived my private message?

 

See my response

Cheers :)

 

~'J'~

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