See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Datalinkupdate

  1. #1
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    0

    Default Datalinkupdate

    I want to put something like this in my ACADDOC, but it needs more than I know where to look to make it correct.
    It would need a conditional statement to only run in there is a datalink in the drawing.
    I can do the conditional statement, I can't do the drawing search for if one is in the drawing.
    Help please...

    Right now, my hammer method runs the command, tells me there isn't one in the current drawing, and then tries to run the "k" command (which there isn't one)

    Code:
    (COMMAND "_.datalinkupdate" "u" "k") ; u - Update datalink, k - all linKs

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

    Default Re: Datalinkupdate

    Code:
    (defun c:FOO ()
      (vlax-for x (vla-get-dictionaries
    		(vla-get-activedocument (vlax-get-acad-object))
    	      )
        (if
          (and
    	(vlax-property-available-p x 'name)
    	(= "ACAD_DATALINK" (vla-get-name x))
    	(< 0 (vla-get-count x))
          )
           (command "_.datalinkupdate" "_u" "_k")
        )
      )
      (princ)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    0

    Default Re: Datalinkupdate

    Thank ya sir.
    Well, they made that one pretty obvious in name.

  4. #4
    I could stop if I wanted to
    Join Date
    2001-10
    Location
    Defragging the internets.
    Posts
    350
    Login to Give a bone
    0

    Default Re: Datalinkupdate

    This is what I've been using:
    Code:
    (setq datalinkDict (dictsearch (namedobjdict) "ACAD_DATALINK"))
    (if datalinkdict (command "DATALINKUPDATE" "u" "k"))
    (princ)
    )

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

    Default Re: Datalinkupdate

    Quote Originally Posted by framedNlv View Post
    This is what I've been using:
    Code:
    (setq datalinkDict (dictsearch (namedobjdict) "ACAD_DATALINK"))
    (if datalinkdict (command "DATALINKUPDATE" "u" "k"))
    (princ)
    )
    The ACAD_DATALINK dictionary can exist in a drawing without any datalinks (empty); simply create a new datalink, save the drawing, then right click & delete datalink (dictionary is still there).

    Instead, consider:

    Code:
    (defun c:FOO2 (/ )
      (if (assoc 3 (dictsearch (namedobjdict) "ACAD_DATALINK"))
        (command "_.datalinkupdate" "_u" "_k")
      )
      (princ)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Posting Permissions

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