I have scrounged up a code that allows me to insert a particular block on a particular drawing using ObjectDBX. For some reason, I have to use the full address of the file in order for the LISP to retrieve the block. My intention is to set up a simple database for field laptops to use our blocks and thus the address of the file will most likely vary for each laptop. For that reason, I would prefer the LISP look in the support file path (easy enough for me to set that up when I prepare the new laptops). I am by no means an adequate LISP writer but I can typically figure these things out, any help would be appreciated.
;; (copy-blk "T:\\ACLAND\\2016\\Next_Gen\\APENDIX.dwg" "NORTH");;;;;;
;; return T if successful, nil otherwise;;;;;;;;;;
(vl-load-com)
(defun copy-blk (dwg blk / blkdbx catch odbx)
(if (findfile dwg)
(progn
(if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
(setq odbx (vlax-create-object "ObjectDBX.AxDbDocument"))
(setq odbx (vlax-create-object
(strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2))
)
)
)
(vla-open odbx dwg)
(if (not
(setq
catch (vl-catch-all-error-p
(vl-catch-all-apply
(function (lambda () (setq blkdbx (vla-item (vla-get-blocks odbx) blk))))
)
)
)
)
(vla-copyobjects
odbx
(vlax-safearray-fill
(vlax-make-safearray vlax-vbObject '(0 . 0))
(list blkdbx)
)
(vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
)
)
(vlax-release-object odbx)
(if (and (null catch)
(vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
blk
)
)
T
nil
)
)
nil
)
)
Edit: help I'm just a Mosquito!!!! haha