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")

No comments:

Post a Comment

Subscribe to the comments feed

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog
JTB World's website | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.