Results 1 to 7 of 7

Thread: Update Data Link Location

  1. #1
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Update Data Link Location

    Good Afternoon All,

    Is there a way to update the path of a data link through LISP? I'd like to add data links, but the name of the excel file changes with each project.

    Thanks!

    -stu

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,744
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    Start here:

    Code:
    (dictsearch (namedobjdict) "ACAD_DATALINK")
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 5860, Xeon W7-2495X, 128GB RAM, Dual PCIe 4.0 M.2 SSD (RAID 0), 20GB NVIDIA RTX 4000 ADA

  3. #3
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    Oh! It is possible! Thanks Render-youda-man!

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,744
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    Quote Originally Posted by stusic View Post
    Oh! It is possible! Thanks Render-youda-man!
    Perhaps I spoke too soon:

    Quote Originally Posted by JTB World

    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.

    Code:
    (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.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 5860, Xeon W7-2495X, 128GB RAM, Dual PCIe 4.0 M.2 SSD (RAID 0), 20GB NVIDIA RTX 4000 ADA

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,744
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    This can however be done via the .NET API... As Kean demonstrates in this blog post.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 5860, Xeon W7-2495X, 128GB RAM, Dual PCIe 4.0 M.2 SSD (RAID 0), 20GB NVIDIA RTX 4000 ADA

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,744
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    Quote Originally Posted by RenderMan View Post
    This can however be done via the .NET API... As Kean demonstrates in this blog post.
    The more I think about it, Kean's code can be used to derive a more generic LispFunction Method for allowing LISP to make this sort of change, and is perhaps a submission item worthy of being suggested in this thread:

    New LISP Expressions created with .NET (VB or C#)
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 5860, Xeon W7-2495X, 128GB RAM, Dual PCIe 4.0 M.2 SSD (RAID 0), 20GB NVIDIA RTX 4000 ADA

  7. #7
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Update Data Link Location

    That is fantastic. I know zero .net, but your help (and research) is really appreciated. Btw, I wouldn't even know how to go about asking something like that in Peter's thread - that whole .Net stuff is greek to me. Geez, I'd shoot myself in the foot if LISP was a gun...

Similar Threads

  1. Replies: 1
    Last Post: 2015-04-29, 01:18 PM
  2. Data Link Update Problems
    By DBill2508 in forum AutoCAD Tables
    Replies: 5
    Last Post: 2011-10-26, 07:18 PM
  3. Replies: 3
    Last Post: 2009-10-20, 12:28 AM
  4. Field data lost at data link synchronization
    By brennsvette in forum AutoCAD 3D (2007 and above)
    Replies: 0
    Last Post: 2008-09-17, 03:07 PM
  5. Automatic Block Location update
    By boyerd in forum AutoCAD Fields
    Replies: 0
    Last Post: 2007-06-29, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •