Unknow command but can run..

Discussion in 'AutoCAD' started by nalsur8, Mar 6, 2004.

  1. nalsur8

    nalsur8 Guest

    Direction Of Keyway :Unknown command "KEY". Press F1 for help
    only for horizontal side the massage Unknow comeout
    for vertical side is ok, any guys can review my lisp what the problem

    ;;//draw box and pick line to make keyway
    (defun dtr(a)
    (* pi(/ a 180.0)))
    (defun c:key ()
    (setq l2 nil l3 nil l4 nil i2 nil i3 nil i4 nil
    dist nil dist1 nil pt1 nil pt2 nil pt3 nil)
    (setvar "cmdecho" 0)
    (setq Os(getvar "osmode"))
    (setq ot(getvar "orthomode"))
    (setvar "orthomode" 1)
    (setvar "osmode" 512);snap to nearest
    (setq tri(entsel "\nPick Line To Make Keyway :"))
    (redraw(car tri)3)
    (setq pt1 (getpoint "\nFirst Point To Break :"))
    (setq pt2 (getpoint pt1 "\nSecond Point To Break :"))
    (setvar "osmode" 0);off
    (setq pt3 (getpoint pt1 "\nDirection Of Keyway :"))
    (if(=(cadr pt1)(cadr pt2))
    (progn
    (setq dist(distance pt1 pt2))
    (setvar "osmode" 0)
    (if (<= (cadr pt1) (cadr pt3))
    (setq l2 (polar pt1 (dtr 90.0) 1))
    (setq l2 (polar pt1 (dtr 270.0) 1))
    );if
    (if(<=(car pt1) (car pt2))
    (setq l3(polar l2(dtr 0.0) (atoi(rtos dist))))
    (setq l3(polar l2(dtr 180.0) (atoi(rtos dist))))
    );if
    (if(<=(cadr pt1)(cadr pt3))
    (setq l4(polar l3(dtr 270.0)1))
    (setq l4(polar l3(dtr 90.0)1))
    );if
    (command "_line" "_none" pt1 l2 "")
    (setq l22(entlast))
    (command "_line" "_none" l2 l3 "")
    (command "_line" "_none" l3 l4 "")
    (setq l44(entlast))
    (command "_trim" "" tri "")
    (command "_line" "_none" pt1 l4 "")
    (command "_line" "_none" pt1 i4 ""
    "_change" "last" "" "p" "lt" "hidden" "s" 5 "c" 3 "")
    );progn
    (progn
    (setq dist1(distance pt1 pt2))
    (setvar "osmode" 0)
    (if (<= (car pt1) (car pt3))
    (setq i2 (polar pt1 (dtr 0.0) 1))
    (setq i2 (polar pt1 (dtr 180.0) 1))
    );if
    (if(<=(cadr pt1) (cadr pt2))
    (setq i3(polar i2(dtr 90.0) (atoi(rtos dist1))))
    (setq i3(polar i2(dtr 270.0) (atoi(rtos dist1))))
    )
    (if(<=(car pt1)(car pt3))
    (setq i4(polar i3(dtr 180.0)1))
    (setq i4(polar i3(dtr 0.0)1))
    )
    (command "_line" "_none" pt1 i2 "")
    (setq i22(entlast))
    (command "_line" "_none" i2 i3 "")
    (command "_line" "_none" i3 i4 "")
    (setq i44(entlast))
    (command "_trim" "" tri "")
    (command "_line" "_none" pt1 i4 ""
    "_change" "last" "" "p" "lt" "hidden" "s" 5 "c" 3 "")
    );progn
    );if
    (setvar "osmode" Os)
    (setvar "orthomode" ot)
    (princ)
    );end
     
    nalsur8, Mar 6, 2004
    #1
  2. nalsur8

    ECCAD Guest

    In top portion of program:
    Change:
    (command "_line" "_none" pt1 i4 "" "_change" "last" "" "p" "lt" "hidden" "s" 5 "c" 3 "")
    To:
    (command "_line" "_none" pt1 l4 "" "_change" "last" "" "p" "lt" "hidden" "s" 5 "c" 3 "")
     
    ECCAD, Mar 6, 2004
    #2
  3. nalsur8

    Joe Burke Guest

    Bob,

    Actually it's not a change this to that. It's an extra line of code which needs to be
    deleted.

    (command "_line" "_none" pt1 l4 "")
    (command "_line" "_none" pt1 i4 "" < remove this line and adjust parens
    "_change" "last" "" "p" "lt" "hidden" "s" 5 "c" 3 "")

    Joe Burke
     
    Joe Burke, Mar 6, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.