Wednesday, February 18, 2009

Table object API not for VBA or Visual Lisp

I found AcDataLinkUpdateOption via VBA object browser but not much more. UpdateAllDataLinks and GetDataLink are not there. The VBA reference says UpdateAllDataLinks is a method on the Table object. This is also the case with AutoCAD 2010. I got confirmed via ADN that these APIs have been removed but the documentation was never updated. ObjectARX or AutoCAD .NET API are the way to go.

I also did try AutoLISP using (dictsearch (namedobjdict) "ACAD_DATALINK") and then entmod but there was a bug there that made it not work. The problem shows on assoc 302 where the value is duplicated when using entmod.

(setq grpList (dictsearch (namedobjdict) "ACAD_DATALINK"))
(setq i 1)
(while (setq grp (nth i grplist))
  (if (= (car grp) 3) (progn
   (setq en1 (cdr (nth (+ i 1) grplist)))
   (setq oldlist (entget en1))
   (princ (cdr (assoc 302 oldlist)))
   (entmod oldlist)
(setq i (+ 1 i))

Update regarding entmod. It is As Designed:

From the Help file. The following rules apply to dictionary objects:

  • Dictionary objects can be examined with entget and their xdata modified with entmod. Their entries cannot be altered with entmod. All access to their entries are made through the dictsearch and dictnext functions.
  • Dictionary entry contents cannot be modified through entmod, although xdata can be modified.
  • Dictionary entries that begin with ACAD* cannot be renamed.

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.