Results 1 to 10 of 10

Thread: Display list of Xrefs in a Field via LISP

  1. #1
    Member
    Join Date
    2004-08
    Posts
    19
    Login to Give a bone
    0

    Default Display list of Xrefs in a Field via LISP

    I just read an article in AUGIWORLD about combining AutoLisp & Fields. Does anyone know of a way to use a field to show the x-refs attached to a dwg?

    Thanks,
    Chris

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    No, but this is one thing that the old RTEXT can still do.

    Example: $(xrefs,3)

    See the ET help file (\Express\acet.chm) for more details.
    R.K. McSwain | CAD Panacea |

  3. #3
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    I don't know about fields, but I do know how to get a list of xrefs.
    Code:
    (defun XrefList (Doc / Lst)
    
    (vlax-for Blk (vla-get-Blocks Doc)
     (if (equal (vla-get-IsXref Blk) :vlax-true)
      (setq Lst (cons (vla-get-Name Blk) Lst))
     )
    )
    Lst
    )
    Called like (for current drawing)
    Code:
    (XrefList (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    Must have loaded
    Code:
    (vl-load-com)
    into the drawing at least once before you can use this.

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    I bet he was inquiring about using a FIELD because he wants a string that updates automatically. Although RTEXT has it's other limitations, it does update automatically, compared to having to run the lisp code each time.
    R.K. McSwain | CAD Panacea |

  5. #5
    Member
    Join Date
    2004-08
    Posts
    19
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    Correct. In the meantime will have to look into RTEXT. Thanks for the help.

  6. #6
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    You could use reactors then once the text in the drawing, to update it. Just another idea.

  7. #7
    Member
    Join Date
    2004-08
    Posts
    19
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    I can't figure out why this isn't working:

    MTEXT. Insert field. Add Diesel Expression (or something like that). I type $(xrefs,2). Ok.

    The result is $(XREFS)??

    I tried saving the dwg. I closed & reopened the dwg. I had one x-ref already in the dwg, but I added a couple more just in case, but the field doesn't show the x-refs.

    Can anyone tell what I'm doing wrong?

    Thanks a lot.

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    Quote Originally Posted by crohloff.72988

    Can anyone tell what I'm doing wrong?

    Thanks a lot.
    Please re-read my original reply.

    $(xrefs,2)
    is not a DIESEL string and it doesn't work in a FIELD.

    That is special syntax that only RTEXT recognizes.

    See the ET help file (\Express\acet.chm) for more details.
    R.K. McSwain | CAD Panacea |

  9. #9
    Member
    Join Date
    2004-08
    Posts
    19
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    Thanks RK. What was throwing me off is that in ET Help it does refer to $(xrefs) as a DIESEL function. However, for another function, $(getprop), it says it is supported only in RText objects. Apparently the same is true for $(xrefs).

  10. #10
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Display list of Xrefs in a Field via LISP

    there seems to be a limit on the number of characters rtext will dislplay... so be aware not all of your xrefs may display, i ended deleting this part of our tag because of that

Similar Threads

  1. Fields dispaly as # - xrefs and field categories
    By jkipfer in forum AutoCAD Fields
    Replies: 0
    Last Post: 2007-11-07, 03:36 PM
  2. Replies: 3
    Last Post: 2007-07-11, 06:13 PM
  3. Replies: 2
    Last Post: 2007-04-20, 05:40 AM
  4. List Xrefs in Field
    By red2002yzfr1 in forum AutoCAD Fields
    Replies: 11
    Last Post: 2006-08-04, 01:43 PM
  5. Field to list all XREFs in a drawing
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-03-13, 12:44 AM

Posting Permissions

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