Jump to content

Hide - Unknown command "command_name". Press F1 for help.


Recommended Posts

Posted

I have some routines that I have put together and within the routine I see the following at the command line:

Unknown command "command_name". Press F1 for help.

I did not know if there is a way to prevent that from being seen to the user or not?

 

Thanks!

Posted

Just post one of the simplest routines if you want it fixed. The solution to the rest will probably be the same.

  • Like 1
Posted

I think I found out the error or why its give me this error. 

I noticed when setting up drawings, that there are no wipeouts, it shows me that error of the unknown command.

If that is the case, how would you code it with an if statement? if that is the fix.

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Sub Routine
(defun LM:SortentsTable ( space / dict result ) 
  (cond
    (
      (not
        (vl-catch-all-error-p
          (setq result
            (vl-catch-all-apply 'vla-item
              (list (setq dict (vla-GetExtensionDictionary space)) "ACAD_SORTENTS")
            )
          )
        )
      )
      result
    )
    ( (vla-AddObject dict "ACAD_SORTENTS" "AcDbSortentsTable") )
  )
)
(vl-load-com) (princ)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Sub Routine
(defun c:Wipeout_Back ( / acdoc )
  (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
  
  (vlax-for block (vla-get-blocks acdoc)
    (if
      (and
        (eq :vlax-false (vla-get-islayout block))
        (eq :vlax-false (vla-get-isxref   block))
      )
      (
        (lambda ( / lst )
          (vlax-for obj block
            (if (eq "AcDbWipeout" (vla-get-objectname obj))
              (setq lst (cons obj lst))
            )
          )
          (if lst
            (vla-movetobottom (LM:SortentsTable block)
              (vlax-make-variant
                (vlax-safearray-fill
                  (vlax-make-safearray vlax-vbobject (cons 0 (1- (length lst)))) lst
                )
              )
            )
          )
        )
      )
    )
  )
  (vla-regen acdoc acallviewports)
  (SSGET "X" '((0 . "WIPEOUT")))
  (command "draworder" "p" "" "b")
  (SSGET "X" '((0 . "LWPOLYLINE") (8 . "C-ANNO-VPORT")))
  (command "draworder" "p" "" "b")
  (princ)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:SetUp ()
(command "-layer" "set" "0" "")
(command "zoom" "extents")
(command "_.regenall")
(command "-layout" "" "")
(command "-layout" "Rename" "" "4.0")
(command "_move" (ssget "_x" '((0 . "INSERT")(2 .  "*legend*"))) "" "0,0" "23.1,21.0451")
(command "_.regenall")
(C:Wipeout_Back)
(command "-layer" "set" "C-ANNO-VPORT" "")
(command "_mview" "1.7,23.5719" "22.70,0.2006")
(command "_mspace")
(command "zoom" "extents")
(command "_pspace")
(princ))

 

Posted

Instead of 

(command "_move" (ssget "_x" '((0 . "INSERT")(2 .  "*legend*"))) "" "0,0" "23.1,21.0451")

create the selection set first then test sslength > 0 before using a command on it.

  • Like 1

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