Author Topic: Weird LISP error - after loading, I get this error...help!!  (Read 3862 times)

0 Members and 1 Guest are viewing this topic.

kameron1967

  • Guest
Weird LISP error - after loading, I get this error...help!!
« on: February 02, 2011, 11:33:20 AM »
Can anyone tell me why I'm getting this error on just a simple lisp?

Command: KA
Unknown command "F".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "F".  Press F1 for help.
Unknown command "X*|S-GRID*MAT**".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-A".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "X*|S-GRID*MAT*-A".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-NOTE".  Press F1 for help.
Unknown command "KA".  Press F1 for help.

THIS IS THE CODE FOR KA.LSP
Code: [Select]
(defun c:KA ()
 (command "layer" "f" "*keyplan|*patt-*" "")
 (command "layer" "f" "X*|s-grid*mat**" "")
 (command "layer" "T" "*keyplan|*patt-A" "")
 (command "layer" "T" "X*|s-grid*mat*-A" "")
 (command "layer" "T" "*keyplan|*patt-NOTE" "")
(princ)   
)
[\CODE]

Nibster

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #1 on: February 02, 2011, 11:43:43 AM »
"-layer"

you forgot the hyphen, and you can shorten it up...


Code: [Select]
(defun c:KA ()
 (command "-layer"
 "f" "*keyplan|*patt-*"
 "f" "X*|s-grid*mat**"
 "T" "*keyplan|*patt-A"
 "T" "X*|s-grid*mat*-A"
 "T" "*keyplan|*patt-NOTE"
 "")
(princ)  
)
« Last Edit: February 02, 2011, 11:47:58 AM by Nibster »

kameron1967

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #2 on: February 02, 2011, 01:24:42 PM »
Quote from: HAWDesigner
Also, have you tried entering each line directly into the command line to see if you get the same error?

For instance:
Code: [Select]
Command: (command "layer" "f" "*keyplan|*patt-*" "")

 
This is what I got...
 
Command: (command "layer" "f" "*keyplan|*patt-*" "")
Unknown command "F".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.
nil

Do you suppose the autocad utility is not being loaded..??  Like acaddoc.lsp, etc..??

Nibster

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #3 on: February 02, 2011, 01:28:20 PM »
Quote from: HAWDesigner
Also, have you tried entering each line directly into the command line to see if you get the same error?

For instance:
Code: [Select]
Command: (command "layer" "f" "*keyplan|*patt-*" "")

 
This is what I got...
 
Command: (command "layer" "f" "*keyplan|*patt-*" "")
Unknown command "F".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.
nil

Do you suppose the autocad utility is not being loaded..??  Like acaddoc.lsp, etc..??
um, did you look at the post above this one that I am quoting?  :?

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #4 on: February 02, 2011, 01:29:57 PM »
and you can shorten it up...
Code: [Select]
(defun c:KA (/)
  (command "_.-layer" "_freeze" "*keyplan|*patt-*,X*|s-grid*mat*,*keyplan|*patt-A" "_thaw"
           "X*|s-grid*mat*-A,*keyplan|*patt-NOTE" ""
          )
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Nibster

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #5 on: February 02, 2011, 01:35:07 PM »
and you can shorten it up...
Code: [Select]
(defun c:KA (/)
  (command "_.-layer" "_freeze" "*keyplan|*patt-*,X*|s-grid*mat*,*keyplan|*patt-A" "_thaw"
           "X*|s-grid*mat*-A,*keyplan|*patt-NOTE" ""
          )
  (princ)
)
:roll: i would have gotten there eventually...  :wink:

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #6 on: February 02, 2011, 01:40:48 PM »
and you can shorten it up...
Code: [Select]
(defun c:KA (/)
  (command "_.-layer" "_freeze" "*keyplan|*patt-*,X*|s-grid*mat*,*keyplan|*patt-A" "_thaw"
           "X*|s-grid*mat*-A,*keyplan|*patt-NOTE" ""
          )
  (princ)
)
:roll: i would have gotten there eventually...  :wink:
I know. :)
VL option (runs transparently)...
Code: [Select]
(defun c:KA (/ name)
  (vl-load-com)
  (vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
    (and (wcmatch (setq name (strcase (vla-get-name x)))
                  "*KEYPLAN|*PATT-*,X*|S-GRID*MAT*,*KEYPLAN|*PATT-A"
         )
         (vla-put-freeze x :vlax-true)
    )
    (and (wcmatch name "X*|S-GRID*MAT*-A,*KEYPLAN|*PATT-NOTE") (vla-put-freeze x :vlax-false))
  )
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #7 on: February 02, 2011, 01:45:20 PM »
Vanilla method :wink:

Code: [Select]
(defun c:ka ( / _FreezeThawLayer frzestring thawstring layerdef layer )

  (setq frzestring "*keyplan|*patt-*,X*|s-grid*mat*,*keyplan|*patt-A"
        thawstring "X*|s-grid*mat*-A,*keyplan|*patt-NOTE"
  )

  (defun _FreezeThawLayer ( layer freeze )
    (if (setq layer (tblobjname "LAYER" layer))
      ( (lambda ( elist ) (entmod (subst (cons 70 (boole (if freeze 7 4) 1 (cdr (assoc 70 elist)))) (assoc 70 elist) elist)))
        (entget layer)
      )
    )
  )

  (while (setq layerdef (tblnext "LAYER" (null layerdef)))
    (setq layer (cdr (assoc 2 layerdef)))

    (cond
      ( (wcmatch layer frzestring)

        (_FreezeThawLayer layer t)
      )
      ( (wcmatch layer thawstring)

        (_FreezeThawLayer layer nil)
      )
    )
  )

  (princ)
)

kameron1967

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #8 on: February 02, 2011, 01:51:09 PM »
Love it when the programming gurus get together.  Unfortunately, it has not solved my initial problem.  :lol:

kameron1967

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #9 on: February 02, 2011, 01:54:26 PM »
Lee, so if I have sectors A-K, how I can do this in one routine - without copying over and over to make one for each sector?  Thanks!


Vanilla method :wink:

Code: [Select]
(defun c:ka ( / _FreezeThawLayer frzestring thawstring layerdef layer )

  (setq frzestring "*keyplan|*patt-*,X*|s-grid*mat*,*keyplan|*patt-A"
        thawstring "X*|s-grid*mat*-A,*keyplan|*patt-NOTE"
  )

  (defun _FreezeThawLayer ( layer freeze )
    (if (setq layer (tblobjname "LAYER" layer))
      ( (lambda ( elist ) (entmod (subst (cons 70 (boole (if freeze 7 4) 1 (cdr (assoc 70 elist)))) (assoc 70 elist) elist)))
        (entget layer)
      )
    )
  )

  (while (setq layerdef (tblnext "LAYER" (null layerdef)))
    (setq layer (cdr (assoc 2 layerdef)))

    (cond
      ( (wcmatch layer frzestring)

        (_FreezeThawLayer layer t)
      )
      ( (wcmatch layer thawstring)

        (_FreezeThawLayer layer nil)
      )
    )
  )

  (princ)
)

Nibster

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #10 on: February 02, 2011, 01:59:17 PM »
Love it when the programming gurus get together.  Unfortunately, it has not solved my initial problem:lol:

are you sure?  you asked about errors.  :-P

Can anyone tell me why I'm getting this error on just a simple lisp?

Command: KA
Unknown command "F".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-*".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "F".  Press F1 for help.
Unknown command "X*|S-GRID*MAT**".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-A".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "X*|S-GRID*MAT*-A".  Press F1 for help.
Unknown command "KA".  Press F1 for help.
Unknown command "T".  Press F1 for help.
Unknown command "*KEYPLAN|*PATT-NOTE".  Press F1 for help.
Unknown command "KA".  Press F1 for help.

THIS IS THE CODE FOR KA.LSP
Code: [Select]
(defun c:KA ()
 (command "layer" "f" "*keyplan|*patt-*" "")
 (command "layer" "f" "X*|s-grid*mat**" "")
 (command "layer" "T" "*keyplan|*patt-A" "")
 (command "layer" "T" "X*|s-grid*mat*-A" "")
 (command "layer" "T" "*keyplan|*patt-NOTE" "")
(princ)   
)
[\CODE]

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #11 on: February 02, 2011, 02:07:16 PM »
Vanilla method :wink:
FYI: -Layer is not case sensitive, wcmatch is.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

kameron1967

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #12 on: February 02, 2011, 02:17:10 PM »
Nibster - you're right.  I did not try this.  The "-layer" does do the track.  But I've never had that problem before.  Could that be that the  "CMDDIA" needs to be set to "0" always, then?

"-layer"

you forgot the hyphen, and you can shorten it up...


Code: [Select]
(defun c:KA ()
 (command "-layer"
 "f" "*keyplan|*patt-*"
 "f" "X*|s-grid*mat**"
 "T" "*keyplan|*patt-A"
 "T" "X*|s-grid*mat*-A"
 "T" "*keyplan|*patt-NOTE"
 "")
(princ)  
)

Nibster

  • Guest
Re: Weird LISP error - after loading, I get this error...help!!
« Reply #13 on: February 02, 2011, 02:31:24 PM »
Nibster - you're right.  I did not try this.  The "-layer" does do the track.  But I've never had that problem before.  Could that be that the  "CMDDIA" needs to be set to "0" always, then?

"-layer"

you forgot the hyphen, and you can shorten it up...


Code: [Select]
(defun c:KA ()
 (command "-layer"
 "f" "*keyplan|*patt-*"
 "f" "X*|s-grid*mat**"
 "T" "*keyplan|*patt-A"
 "T" "X*|s-grid*mat*-A"
 "T" "*keyplan|*patt-NOTE"
 "")
(princ)  
)
what was your previous ACAD version?