Similar LISP not working

Similar LISP not working

Anonymous
Not applicable
545 Views
5 Replies
Message 1 of 6

Similar LISP not working

Anonymous
Not applicable

I Have 2 code, with the same structure but one works while the other doesn't (Unknown command) i'm really confused (cad12 and cad16 behave the same)

;;;---------------- Layer A-THICK --------------------   < this works
(DEFUN C:TYY (/ LAY)
  (COMMAND "-LAYER" "M" "A-THICK" "C" "33" "" "LW" "0.2" "" "")
  (PRINC)
)
(DEFUN C:TY () (ssget) 
  (COMMAND "-LAYER" "M" "A-THICK" "C" "33" "" "LW" "0.2" "" "")
  (command "change" "p" "" "p" "la" "A-THICK" ""))

;;;---------------- Layer A-GLASS --------------------  < error "Unknown command"
(DEFUN C:KII (/ LAY)
  (COMMAND "-LAYER" "M" "A-GLASS" "C" "154" "" "LW" "0.09" "" "")
  (PRINC)
)
(DEFUN C:KI () (ssget) 
  (COMMAND "-LAYER" "M" "A-GLASS" "C" "154" "" "LW" "0.09" "" "")
  (command "change" "p" "" "p" "la" "A-GLASS" ""))
0 Likes
Accepted solutions (1)
546 Views
5 Replies
Replies (5)
Message 2 of 6

hmsilva
Mentor
Mentor

Hello kevlee91 and welcome to the Autodesk Community!

 

Try

 

(defun C:TYY nil
    (command "_.-layer" "_U" "A-THICK" "_T" "A-THICK" "_M" "A-THICK" "_C" "33" "" "_LW" "0.2" "" "")
    (princ)
)
(defun C:TY nil
    (if (ssget)
        (command "_.-layer" "_U" "A-THICK" "_T" "A-THICK" "_M" "A-THICK" "_C" "33" "" "_LW" "0.2" "" "" "_.change" "_P" "" "_P" "_LA" "A-THICK" "")
    )
    (princ)
)

(defun C:KII nil
    (command "_.-layer" "_U" "A-GLASS" "_T" "A-GLASS" "_M" "A-GLASS" "_C" "154" "" "_LW" "0.09" "" "")
    (princ)
)
(defun C:KI nil
    (if (ssget)
        (command "_.-layer" "_U" "A-GLASS" "_T" "A-GLASS" "_M" "A-GLASS" "_C" "154" "" "_LW" "0.09" "" "" "_.change" "_P" "" "_P" "_LA" "A-GLASS" "")
    )
    (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 6

Anonymous
Not applicable
it still giving unknown command on "KI" and "KII"; "TY" and "TYY" still works
i'm putting all my LISP in acad2016doc.lsp file
0 Likes
Message 4 of 6

hmsilva
Mentor
Mentor
Accepted solution

@Anonymous wrote:
it still giving unknown command on "KI" and "KII"; "TY" and "TYY" still works
i'm putting all my LISP in acad2016doc.lsp file

acad2016doc.lsp file is reserved for AutoCAD!!!

Don't edit this file!!!

 

In notpad, or another text editor, put all your LISP's and seveas acaddoc.lsp, and AutoCAD will load it in hall dwg's.

 

EDIT: tested in AC2016, and everything worked as expected...

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 5 of 6

Anonymous
Not applicable

oh, it works now

ty

0 Likes
Message 6 of 6

hmsilva
Mentor
Mentor

@Anonymous wrote:

oh, it works now

ty


You're welcome, kevlee91
Glad I could help

Henrique

EESignature

0 Likes