Monday, February 17, 2014

How to test if a DVB file is loaded using AutoLISP

This is a sample code snippet showing how you with AutoLISP (or rather Visual LISP) can test if a certain VBA DVB file is loaded in AutoCAD or not.

(vl-load-com)
(defun isDVBLoaded (dvb / oVBProjs c found)
  (setq oVBProjs (vlax-get (vla-get-vbe (vlax-get-acad-object)) "VBProjects"))
  (setq dvb (strcase dvb))
  (repeat (setq c (vla-get-count oVBProjs))
    (if (vl-string-search dvb (strcase (vla-get-FileName (vla-item oVBProjs c))))
      (setq found T)
    )
    (setq c (1- c))
  )
  found
)

Here’s how to call the function:
(isDVBLoaded "jtbworld.dvb")


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner