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