Results 1 to 3 of 3

Thread: Create list of Data Shortcuts

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2014-07
    Posts
    1
    Login to Give a bone
    0

    Default Create list of Data Shortcuts

    Hi All,

    I know Data Shortcuts are not Vault (more like the poor cousin), but this didn't seem to fit anywhere else. Please redirect me if you think this should be posted elsewhere...

    I need to manage Xrefs and Data Shortcuts very carefully. One way to do this is to make sure that all those used in a drawing are automatically listed on every sheet that is produced.

    I have found the RTEXT command with a DIESEL expression that can generate a list of Xrefs (this is perfect!).

    There's an explanation here (about halfway down under the heading "Using the XREFS function"


    My question is...Is there an equivalent to this Xrefs list for Data Shortcuts? Can I create an Mtext field or similar that includes all the Data Shortcuts in a drawing?

    Many thanks in advance

    C

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

    Default Re: Create list of Data Shortcuts

    Welcome to AUGI.

    The short answer is no, there is nothing like a DIESEL expression to accomplish this, but it can be done** using LISP or .NET API, and that is something I can help with. I'll move this thread once I have more information.

    Perhaps you could post a sample drawing of how and where you currently list this presumably manually populated information in each drawing, then I'll have something to work with.

    Cheers


    [Edit] - ** To an extent
    Last edited by BlackBox; 2017-11-18 at 07:26 PM. Reason: #ExpectationsManaged
    "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
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Create list of Data Shortcuts

    Here's a quick first attempt using LISP - this is not going to be as versatile as RText + Diesel are with XREFS.

    Add a FIELD to your MText in PaperSpace, using the *C3dDataRefs* LispVariable (see image), and simply moving from Model to Layout after you do some work will update the FIELD (depending on your FIELDEVAL sysvar setting). If you need it updated after working through a Viewport in Layout, just REGEN. If this becomes a PITA, I can have the code regen automagically, but that adds some lag, so I thought I'd start with what's faster and go from there.

    2017-11-18_14-24-08.png

    Just be mindful that anyone without this LISP being loaded via AcadDoc.lsp (meaning loaded into each drawing at open), will not have the global variable dependency pictured above, because this isn't being saved in the drawing, and thus not have the correct FIELD information. Again, this can be saved to the drawing, but that adds some time for LISP to do, and so I went with speed over complexity (for now).

    Another shortcoming, is that while MText typically sees "\P" as a carriage return for normal text string input, it does NOT evaluate that from a FIELD in kind - I had initially tried to include this in the global variable value, but it would not be recognized, so I opted for the format you'll see as an interim placeholder.

    Here's the LISP, you can add it to you AcadDoc.lsp, or I'd recommend saving this to its own LISP file and just add a LOAD statement to same:

    Code:
    (vl-load-com)
    
    (defun C3dDataRefs (/ dataReferences)
      (vlax-for x (vla-get-block
                    (vla-get-layout
                      (vla-get-modelspace
                        (vla-get-activedocument (vlax-get-acad-object))
                      )
                    )
                  )
        (if (and (vlax-method-applicable-p x 'isreferenceobject)
                 (= 1 (vlax-invoke x 'isreferenceobject))
            )
          (setq dataReferences
                   (cons
                     (strcat
                       (vl-catch-all-apply 'vla-get-name (list x))
                       ":["
                       (vl-catch-all-apply 'vla-get-objectname (list x))
                       "] "
                     )
                     dataReferences
                   )
            )
        )
      )
      (setq *C3dDataRefs*
             (if dataReferences
               (apply 'strcat (reverse dataReferences))
               "<none>"
             )
      )
    )
    ;;;--------------------------------------------------------------------;
    (defun DrefReactors:Start ()
      (or *DrefReactor_Command*
          (setq *DrefReactor_Command*
                 (vlr-command-reactor
                   "C3D DREF Command Reactor"
                   '(
                     (:vlr-commandWillStart . Callback:DrefReactor)
                    )
                 )
          )
      )
      (C3dDataRefs)
      (prompt "\n \n  >>  C3D DREF Reactor Loaded \n")
      (princ)
    )
    
    (defun Callback:DrefReactor (rea cmd /)
      (C3dDataRefs)
    )
    ;;;--------------------------------------------------------------------;
    (DrefReactors:Start)

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

Similar Threads

  1. Replies: 0
    Last Post: 2014-12-01, 04:36 AM
  2. 2014: Data Shortcuts
    By tim_newsome in forum AutoCAD Civil 3D - General
    Replies: 9
    Last Post: 2013-12-12, 04:52 PM
  3. Replies: 0
    Last Post: 2011-10-24, 03:30 PM
  4. data shortcuts
    By jenniferchavez in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2010-11-03, 03:08 AM
  5. Data shortcuts multiple shortcuts of same alignment
    By jenniferchavez in forum AutoCAD Civil 3D - General
    Replies: 0
    Last Post: 2009-07-20, 03:28 PM

Tags for this Thread

Posting Permissions

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