Results 1 to 2 of 2

Thread: Suddenly getting "error: bad argument type: VLA-OBJECT nil" when running lisp

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Suddenly getting "error: bad argument type: VLA-OBJECT nil" when running lisp

    Hi folks,

    All of a sudden, running the routine below results in an error: "error: bad argument type: VLA-OBJECT nil". This routine has been working or years.

    Additionally, this very same routine works just fine at another office. Same version of AutoCAD Architecture, same drive letter, same file and block names...

    The only recent change is that we moved our support files from one server to another, but that is all still mapped to the same drive letter so AutoCAD should not see any difference.

    The routine is called using the following code in the tool palette:


    Code:
    ^C^C(if DetailSheetr30 (DetailSheetr30) (princ "Detail Sheet r30 not loaded."))

    Main code:

    Code:
    ;Detail Sheet r30
    (defun DetailSheetr30( / CL SCL DBX )
    (setq CL (getvar "CLAYER"))
    (command "_.-Layer" "m" "L-ANNO-SYMB" "c" "3" "L-ANNO-SYMB" "")
    (cond ((= (getvar "INSUNITS") 1) (setq SCL 1))
          ((= (getvar "INSUNITS") 2) (setq SCL 0.08333))
          ((= (getvar "INSUNITS") 4) (setq SCL 25.4))
          ((= (getvar "INSUNITS") 5) (setq SCL 2.54))
          ((= (getvar "INSUNITS") 6) (setq SCL 0.0254))
          (t (alert "Current DWG set to non-standard units.  Check UNITS settings"))
    )
    
    
    
    
    (defun open_dbx (dwg / dbx)
       (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
          (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument"))
          (setq dbx (vlax-create-object
          (strcat "ObjectDBX.AxDbDocument."
             (substr (getvar "ACADVER") 1 2)
             )
          )
       )
    )
    (vla-open dbx dwg)
    dbx
    )
    (setq Dbx (open_dbx "Z:/ACA 2019/Drawings/MVVA Callouts r30.dwg"))
    (vla-CopyObjects
    Dbx
    (vlax-safearray-fill
    (vlax-make-safearray vlax-vbObject '(0 . 0))
    (list (vla-item (vla-get-blocks dbx) "Detail Sheet r30"))
    )
    (vla-get-blocks
    (vla-get-activedocument (vlax-get-acad-object))
    )
    )
    (vlax-release-object dbx)
    
    
    (command "-insert" "Detail Sheet r30" "Scale" SCL PAUSE "0")
    
    
    (setvar "CLAYER" CL)
    (princ)
    )
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Thanks for any insight.

    -JP
    Last edited by jpcadconsulting347236; 2018-12-08 at 08:40 PM.

  2. #2
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Suddenly getting "error: bad argument type: VLA-OBJECT nil" when running lisp

    Well, I repaired my install of AutoCAD and now it's working fine. The fact that this happened concurrent to a server migration was tripping me up.

    Red Herring!!!!

    Stand down team... all is well.

Similar Threads

  1. Replies: 1
    Last Post: 2013-12-14, 07:15 PM
  2. Error: bad argument type: FILE "r"
    By shell2712 in forum AutoLISP
    Replies: 0
    Last Post: 2013-09-04, 08:29 PM
  3. Replies: 4
    Last Post: 2009-05-22, 05:21 AM
  4. Replies: 6
    Last Post: 2006-12-07, 11:42 PM
  5. Replies: 8
    Last Post: 2005-02-14, 11:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •